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

Histograms #14

Merged
merged 3 commits into from
Nov 21, 2017
Merged

Histograms #14

merged 3 commits into from
Nov 21, 2017

Conversation

talex5
Copy link
Contributor

@talex5 talex5 commented Nov 21, 2017

This is the core part of #10 (which was a bit big to review), with a few changes:

  • When a metric has an invalid label, give the reason rather than saying the metric name is wrong.
  • Change the validation to reject only the exact strings, not any string starting with the reserved label.
  • Replace the tuple with a sample record type (added in Add Sample_set module #13).
  • Separate the histogram spec from the runtime values and put those functions in their own Histogram_spec module.
  • Fixed of_exponential so the first bucket is at start, not start * factor.
  • Add doc-string for DefaultHistogram.

@stijn-devriendt : does this look OK to you?

[talex5: report label name in error, not metric name]
[talex5: rebased and tidied a bit, fixed of_exponential]
@stijn-devriendt
Copy link
Contributor

Looks OK to me. Thanks for taking the time to refine this.

I saw that you stripped out the getters. Is this something you'd prefer leaving out forever? The Java client for example does have these methods, so it's not like adding it would make it a one-off.
So does it make sense for me to send a pull request later, re-adding them (perhaps when we've had more internal exposure over the next few weeks about which bits we're actually finding useful, leaving out others) or do you prefer not having in-process retrieval?

@talex5
Copy link
Contributor Author

talex5 commented Nov 21, 2017

Splitting it is to make it simpler to review. I need to think a bit more about the getters.

Ideally, I'd prefer that code doesn't have access to any mutable global state, so that the behaviour of a component can't depend on other components to which it wasn't explicitly given access. However, OCaml does not make it possible to enforce this, and we have to expose CollectorRegistry anyway. So it's really just to discourage people from trying to read the values, since that's probably the wrong thing to do. e.g. if a web-server library reads the counters to make decisions, then you can't run two web-servers in the same process. But on the other hand, there may be valid uses for it and it's really up to library authors to write sensible code.

@talex5 talex5 merged commit a504f1b into mirage:master Nov 21, 2017
@talex5 talex5 deleted the histogram branch November 21, 2017 11:46
@talex5 talex5 mentioned this pull request Dec 18, 2017
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