-
Notifications
You must be signed in to change notification settings - Fork 101
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
Adding dogstatsd telemetry to the client #97
Conversation
466ca4d
to
223f420
Compare
223f420
to
9bbdda3
Compare
9bbdda3
to
f75b87a
Compare
Approving for the .md docs file, but please add another dev to review the java portion. |
bb4611e
to
8bd4026
Compare
7e0532a
to
fad5caf
Compare
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.
Great stuff, added some feedback but all minor stuff. Looks clean! 🙇
@@ -91,12 +97,17 @@ public void run() { | |||
sizeOfBuffer)); | |||
} | |||
|
|||
telemetry.incrBytesSent(sizeOfBuffer); |
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 are we not using sentBytes
instead of sizeOfBuffer
?
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.
Both are the smae if we're at that line since we check if (sizeOfBuffer != sentBytes)
before.
|| clientError.telemetry.packetsDropped.get() == 0 | ||
|| clientError.telemetry.bytesDropped.get() == 0) { | ||
try { | ||
Thread.sleep(50L); |
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.
Am I correct to assume that you're doing this because you enabled the telemetry to flush in 50ms intervals here: https://github.com/DataDog/java-dogstatsd-client/pull/97/files#diff-bedc79efc014c08d01856bdf92f57801R288 ? If so, we're making the assumption the tests will run in order, which may be a safe assumption but is something I would prefer we did not assume in any case. If every test can be self-contained, that would be best.
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.
No we're actually waiting for the whole process to flush metrics. This is the same than when we wait for messages in our DummyServer https://github.com/DataDog/java-dogstatsd-client/blob/master/src/test/java/com/timgroup/statsd/DummyStatsDServer.java#L61.
Tests are unrelated from one another (one use client
and the other clientError
also).
128f386
to
8233c1a
Compare
8233c1a
to
b8afcdc
Compare
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.
Couple nits, but ready to go if you don't feel they should be addressed.
|
||
private void sendMetric(final String message) { | ||
send(message); | ||
this.telemetry.incrMetricsSent(1); |
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.
Should this be done only if telemetry is enabled? It could maybe be implemented on the telemetry end, as a NOP if it's not enabled. Same would apply to all increment operations scattered all over the code.
protected AtomicInteger packetsDropped; | ||
protected AtomicInteger packetsDroppedQueue; | ||
|
||
protected String metricsSentMetric; |
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.
This is going to conflict a little bit with the implementation in #105, no worries we can merge this first and I can fix it in that PR. These should be final
too, I can also fix that in a follow-up.
@@ -0,0 +1 @@ | |||
dogstatsd_client_version=${project.version} |
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.
🍰
Adding telemetry to the client about packet sent and dropped. By default we flush the telemetry every 5s.