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

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

Merged
merged 1 commit into from
May 16, 2017

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants