Skip to content

Add convenience 'get'-methods to nolabel-Counter, Gauge and Summary#193

Merged
brian-brazil merged 4 commits intoprometheus:masterfrom
pskiwi:master
Feb 7, 2017
Merged

Add convenience 'get'-methods to nolabel-Counter, Gauge and Summary#193
brian-brazil merged 4 commits intoprometheus:masterfrom
pskiwi:master

Conversation

@pskiwi
Copy link
Copy Markdown
Contributor

@pskiwi pskiwi commented Feb 1, 2017

Child classes of Counter, Gauge and Summary have get() methods for the current value.
This adds this capability to the base classes to make nolabel-objects able to get the current value.

@brian-brazil
Copy link
Copy Markdown
Contributor

brian-brazil commented Feb 1, 2017

This is mostly only used for unittests, and even then unittests of metrics are rare. Is this a common use case for you?

@pskiwi
Copy link
Copy Markdown
Contributor Author

pskiwi commented Feb 2, 2017

In some cases I use metric values collected by Prometheus for internal calculations and statistics. It is very handy to directly use the existing instrumentation, otherwise I would have to duplicate the code.
I was wondering because the child-classes already had the getters but not the nolabel versions.

package io.prometheus.client;

import io.prometheus.client.CKMSQuantiles.Quantile;
import io.prometheus.client.Summary.Child.Value;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why the import?

@pskiwi
Copy link
Copy Markdown
Contributor Author

pskiwi commented Feb 2, 2017

It seems to be useless. I will fix this. But I have no access to my development machine until Monday.

@pskiwi
Copy link
Copy Markdown
Contributor Author

pskiwi commented Feb 6, 2017

The import wasn't useless. It doesn't compile this way. But after qualifying the return value with Child.Value it works without import.

@pskiwi
Copy link
Copy Markdown
Contributor Author

pskiwi commented Feb 6, 2017

@brian-brazil
The build fails with the goal org.apache.maven.plugins:maven-javadoc-plugin:2.8:aggregate.
Do you have any idea what is going wrong here?

@brian-brazil
Copy link
Copy Markdown
Contributor

brian-brazil commented Feb 6, 2017

Offhand you're missing a </p>

@pskiwi
Copy link
Copy Markdown
Contributor Author

pskiwi commented Feb 7, 2017

Thanks for the response. The cause was the missing qualification of the return type.

@brian-brazil brian-brazil merged commit 944e692 into prometheus:master Feb 7, 2017
@brian-brazil
Copy link
Copy Markdown
Contributor

Thanks!

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