Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
statsd: support sending metrics with timestamp. #262
statsd: support sending metrics with timestamp. #262
Changes from 2 commits
97e39ef
3529331
87572b0
68308a5
6e8a1ef
0325b2a
4d27807
da9d9c6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why only
gauge
andcount
?rate
/set
doesn't make send but we might want to sendtiming
,histogram
anddistribution
with timestamp too, no ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, timed metrics ingestion will only be supported for Gauge and Count (DogStatsD server side and backend side).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should explain that somewhere, maybe the README or the Go doc string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should return an error if timestamp is 0 (same for count).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, that's not an invalid timestamp. A weird one, but not an invalid one. For instance,
1
is also a weird one, you see what I mean?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's an error since go has default value. This means an non-initialized timestamp.
Sending a
time.Time
at 0 will produce aUnix
timestamp of-62135596800
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A gotcha... Also linked to your other question about
time.Time
vsuint64
...You are right I'll add a test
if timestamp.Unix() < 0
, WDYT?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to understand why
0
(jan 1970) is the limit here.0
is a valid timestamp that can be represented, separate from the go zero-value.There is a
t.IsZero()
that differentiates between the two:https://go.dev/play/p/njBnvlej3Rf
Dogstatsd parsing correctly handles negative timestamps. src
I think the limiting factor here is the intake according to this comment:
So my suggestion here is to add a comment about why this is the minimum supported epoch.
BTW - I noticed that the public metrics api says:
I assume this doesn't apply to us? Or should we be enforcing that condition here by rejecting timestamps older than 1hr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah.. We have to draw a limit somewhere in the clients and since the intake has a "minimum timestamp" limit and we already have other places limiting to the unix epoch in the Agent, I think having
int(0)
as the minimal possible value is speaking to everyone in a client. Let me know if you think I'm wrong, really open to discussion with these topics.It doesn't indeed, a future PR will update the public documentation, with things more related about the "features" than the technical chunks in the client.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is to provide a hard-coded limit instead of no limit, even if it has no actual feature meaning here.
I added a mention in the comment to redirect to the feature documentation.