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
metrics: add library #1148
metrics: add library #1148
Conversation
|
Webrevs
|
public WithOneLabel(String name, String label) { | ||
this.name = name; | ||
this.label = label; | ||
this.value = new ConcurrentHashMap<String, DoubleAdder>(); |
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.
Can leave out the types between <> here.
public WithOneLabel(String name, String label) { | ||
this.name = name; | ||
this.label = label; | ||
this.value = new ConcurrentHashMap<String, DoubleAdder>(); |
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.
And here.
@edvbld This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been no new commits pushed to the
|
Thanks @erikj79 for reviewing! /integrate |
Hi all,
please review this patch that adds the new
metrics
library. The metrics library can be used to collect runtime metrics, such as the number of HTTP requests or the number of bot runs. The library is designed according to the Prometheus library guide and currently features the two Prometheus types gauge and counter. The library is designed to allow it to be extended with the histogram and summary types if we find a need for them.The
Counter
andGauge
types are designed to be thread-safe and should typically be stored in aprivate final static
variable in a classes (similar to how one might store aLogger
instance). A minimalCounter
example looks like:I won't go into details here on how Prometheus naming and labelling works, please see the Prometheus documentation for those concepts. The goal is that library should be fairly self-explanatory for someone with an understanding of how Prometheus works. Note though that the
metrics
library itself is not tied to Prometheus in any way, it only supports the collection of runtime metrics. It is however designed to make it easy to write a Prometheus exporter, something I will show in a follow-up patch.I also added a bunch of unit tests for the new library.
Thanks,
Erik
Progress
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/skara pull/1148/head:pull/1148
$ git checkout pull/1148
Update a local copy of the PR:
$ git checkout pull/1148
$ git pull https://git.openjdk.java.net/skara pull/1148/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1148
View PR using the GUI difftool:
$ git pr show -t 1148
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/skara/pull/1148.diff