Skip to content

Get CodaHale metrics working by starting up the stream consumers#1586

Merged
mattrjacobs merged 1 commit intoNetflix:masterfrom
mattrjacobs:fix-codahale-metrics
May 16, 2017
Merged

Get CodaHale metrics working by starting up the stream consumers#1586
mattrjacobs merged 1 commit intoNetflix:masterfrom
mattrjacobs:fix-codahale-metrics

Conversation

@mattrjacobs
Copy link
Contributor

Fix #1581

Issue was twofold:

  1. The metric-consuming streams were not being started
  2. Since reads are only available after a window passes, we need to wait in the unit test for the value to show up
Copy link

@KevinJCross KevinJCross left a comment

Choose a reason for hiding this comment

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

Suggestions to improve the tests to guard the quality of the code.

Command command = new Command();
command.execute();

Thread.sleep(1000);

Choose a reason for hiding this comment

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

surely you can use await here instead of sleep from https://github.com/awaitility/awaitility
such as

Gauge<Long> successGauge = metricRegistry.getGauges().get("test.test.countSuccess"); await().atMost(1, SECONDS).until(successGauge::getValue, isEqualTo(1L)); 
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could, but then I introduce an extra dependency for this specific test. You could argue that a utility like this should be applied across all of the unit tests. My personal opinions is that the current state isn't enhanced by that much by a wholesale change to this style, but I'm happy to be convinced otherwise


Thread.sleep(1000);

assertThat((Long) metricRegistry.getGauges().get("test.test.countSuccess").getValue(), is(1L));

Choose a reason for hiding this comment

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

Hmm ... should this also test the other gauges ?
how about a counter from each stream ?

RollingCommandEventCounterStream
RollingCommandLatencyDistributionStream
RollingCommandUserLatencyDistributionStream
RollingCommandMaxConcurrencyStream

Which stream to timeouts happen on ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, more test coverage here would be great. Would you like to submit a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants