-
Notifications
You must be signed in to change notification settings - Fork 834
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
Stabilize MetricProducer, allow custom MetricReaders #5835
Stabilize MetricProducer, allow custom MetricReaders #5835
Conversation
SdkMeterProvider.builder().registerMetricReader(OpenCensusMetrics.attachTo(reader)).build(); | ||
SdkMeterProvider.builder() | ||
.registerMetricReader(reader) | ||
.registerMetricProducer(OpenCensusMetricProducer.create()) |
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.
This demonstrates how you would register a custom metric producer with SdkMeterProvider. Nice and tidy.
All the MetricData produced flow to any registered MetricReaders.
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.
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.
Looks great.
...cs/src/main/java/io/opentelemetry/sdk/metrics/internal/export/MultiMetricProducerReader.java
Outdated
Show resolved
Hide resolved
Codecov ReportAttention:
... and 2 files with indirect coverage changes 📢 Thoughts on this report? Let us know!. |
…y-java into stabilize-metric-producer
@@ -60,7 +59,7 @@ public final class PrometheusHttpServer implements MetricReader { | |||
|
|||
private final HttpServer server; | |||
private final ExecutorService executor; | |||
private volatile MetricProducer metricProducer = MetricProducer.noop(); | |||
private volatile CollectionRegistration collectionRegistration = CollectionRegistration.noop(); |
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.
Is it currently possible to use the OC bridge with the Prometheus exporter?
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.
Sure - the OC metrics will go to any registered MetricReader. Built in MetricReaders include PrometheusHttpServer, PeriodicMetricReader (to support any push based MetricExporter), and InMemoryMetricReader for testing.
SdkMeterProvider.builder().registerMetricReader(OpenCensusMetrics.attachTo(reader)).build(); | ||
SdkMeterProvider.builder() | ||
.registerMetricReader(reader) | ||
.registerMetricProducer(OpenCensusMetricProducer.create()) |
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.
Looks great.
…y-java into stabilize-metric-producer
@jkwatson can you take a look when you have a chance? |
API changes seem reasonable to me. 👍🏽 |
Resolves #5317. Resolves #5011.
Spec PR #3685 marked MetricProducer as stable, and was released in spec version 1.25.0.
The stabilization of MetricProducer was blocking custom MetricReaders, so now custom MetricReaders are supported as well.