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

Allow specifying a default reservoir for a registry. #680

Closed
wants to merge 1 commit into from
Closed

Allow specifying a default reservoir for a registry. #680

wants to merge 1 commit into from

Conversation

julio-lopez
Copy link

Motivation:

A usage pattern for the metrics library is to create a MetricRegistry
and use the counter(), histogram(), meter() and timer() methods to
create metrics for the application. When these methods are called
MetricRegistry potentially creates new metrics with their default
parameters.

Creating metrics with non-default parameters, in particular a
non-default reservoir, currently requires explicitly creating the
metric and then registering it and remembering it for future use.
This prevents leveraging functionality already provided by
MetricsRegistry.

Proposed approach:
Allow specifying a ReservoirBuilder at MetricsRegistry creation
time. ReservoirBuilder creates new reservoirs with custom
parameters. This allows the creation of histograms and timers
with custom default reservoirs.

Alternate approaches:
A potentially more comprehensive approach would be to allow
passing a custom "MetricsBuilder" to the MetricsRegistry
constructor. This approach is definitely worth exploring.

Closes #679

Motivation:

 A usage pattern for the metrics library is to create a MetricRegistry
 and use the counter(), histogram(), meter() and timer() methods to
 create metrics for the application.  When these methods are called
 MetricRegistry potentially creates new metrics with their default
 parameters.

 Creating metrics with non-default parameters, in particular a
 non-default reservoir, currently requires explicitly creating the
 metric and then registering it and remembering it for future use.
 This prevents leveraging functionality already provided by
 MetricsRegistry.

Proposed approach:
 Allow specifying a ReservoirBuilder at MetricsRegistry creation
 time.  ReservoirBuilder creates new reservoirs with custom
 parameters.  This allows the creation of histograms and timers
 with custom default reservoirs.

Alternate approaches:
 A potentially more comprehensive approach would be to allow
 passing a custom "MetricsBuilder" to the MetricsRegistry
 constructor.  This approach is definitely worth exploring.

Closes #679
@ryantenney ryantenney added this to the 4.0.0 milestone Oct 8, 2014
@ryantenney
Copy link
Contributor

Thanks! This may have to wait for v4, as I don't anticipate a 3.2 release.

@ryantenney
Copy link
Contributor

This will be supported by v4, but the API for it will look different from this.

@ryantenney ryantenney closed this Nov 2, 2015
@arteam arteam removed this from the 4.0.0 milestone Dec 24, 2017
@sternr
Copy link

sternr commented Aug 8, 2019

The original idea was really good, is this on the roadmap?

@davigotxi
Copy link

any plans to release these changes?

@julio-lopez
Copy link
Author

It's up to the maintainers.

Not sure if anything similar got included in 4.x.

(Chasing gophers on k8s nowadays)

@cielowu
Copy link

cielowu commented Nov 20, 2020

@ryantenney Checked the latest implementation MetricsRegistry certainly does not align with what you suggested, meaning no customize for reservoir in MetricsRegistry.

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.

None yet

6 participants