Skip to content
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

Merged
merged 2 commits into from
Mar 19, 2020
Merged

Conversation

hush-hush
Copy link
Member

@hush-hush hush-hush commented Jan 29, 2020

Adding telemetry to the client about packet sent and dropped. By default we flush the telemetry every 5s.

@hush-hush hush-hush force-pushed the maxime/telemetry branch 3 times, most recently from 466ca4d to 223f420 Compare January 30, 2020 00:05
@hush-hush hush-hush requested a review from a team as a code owner February 3, 2020 23:41
@hush-hush hush-hush changed the title [WIP] Adding dogstatsd telemetry to the client Adding dogstatsd telemetry to the client Feb 3, 2020
@sarina-dd
Copy link

Approving for the .md docs file, but please add another dev to review the java portion.

@hush-hush hush-hush force-pushed the maxime/telemetry branch 2 times, most recently from bb4611e to 8bd4026 Compare February 4, 2020 20:54
@hush-hush hush-hush force-pushed the maxime/telemetry branch 2 times, most recently from 7e0532a to fad5caf Compare February 11, 2020 22:30
Copy link
Member

@truthbk truthbk left a 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! 🙇

src/main/java/com/timgroup/statsd/Telemetry.java Outdated Show resolved Hide resolved
@@ -91,12 +97,17 @@ public void run() {
sizeOfBuffer));
}

telemetry.incrBytesSent(sizeOfBuffer);
Copy link
Member

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?

Copy link
Member Author

@hush-hush hush-hush Feb 13, 2020

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.

src/test/java/com/timgroup/statsd/TelemetryTest.java Outdated Show resolved Hide resolved
|| clientError.telemetry.packetsDropped.get() == 0
|| clientError.telemetry.bytesDropped.get() == 0) {
try {
Thread.sleep(50L);
Copy link
Member

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.

Copy link
Member Author

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).

@hush-hush hush-hush force-pushed the maxime/telemetry branch 3 times, most recently from 128f386 to 8233c1a Compare February 18, 2020 23:32
Copy link
Member

@truthbk truthbk left a 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);
Copy link
Member

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;
Copy link
Member

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}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍰

@truthbk truthbk merged commit 697afbe into jaime/perf Mar 19, 2020
@truthbk truthbk deleted the maxime/telemetry branch March 19, 2020 02:45
@truthbk truthbk added this to the 2.10.0 milestone May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants