-
Notifications
You must be signed in to change notification settings - Fork 576
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
Add prometheus bridge #4227
Add prometheus bridge #4227
Conversation
Codecov Report
@@ Coverage Diff @@
## main #4227 +/- ##
======================================
Coverage 82.1% 82.2%
======================================
Files 142 144 +2
Lines 9818 10005 +187
======================================
+ Hits 8067 8229 +162
- Misses 1617 1636 +19
- Partials 134 140 +6
|
d4391a1
to
e5c6c89
Compare
I've addressed open comments on the original PR. |
Is there not a summary metric type in OTLP for exactly that reason? Or is it missing in the Go SDK data model? |
It is missing in the Go SDK data model. Adding it to the data model would mean in-process exporters would have to handle summary-typed metrics. But maybe it is better to add it, and expect most exporters other than OTLP to drop it... |
Got it! |
e5c6c89
to
80ce130
Compare
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.
LGTM outside of some naming issue and module tracking in versions.yaml
.
3803ef3
to
e8567f7
Compare
e8567f7
to
58688c1
Compare
58688c1
to
3bcca5a
Compare
Rebased. I think this is good to go |
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.
I just left some comments for the documentation. Reference: https://github.com/open-telemetry/opentelemetry-go/blob/main/CONTRIBUTING.md#documentation
@dashpole let me know if you want me to merge this PR as it is.
* Summary metrics are dropped by the bridge. | ||
* Start times for histograms and counters are set to the process start time. | ||
* It does not currently support exponential histograms. |
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 we move it to doc.go
?
## Usage | ||
|
||
```golang | ||
// Make a Promethes bridge "Metric Producer" that adds metrics from the | ||
// Prometheus DefaultGatherer. Add the WithGatherer(registry) option to add | ||
// metrics from other registries. | ||
bridge := prometheus.NewMetricProducer() | ||
// Make a Periodic Reader to periodically gather metrics from the bridge, and | ||
// push to an OpenTelemetry exporter. | ||
reader := metric.NewPeriodicReader(otelExporter, metric.WithProducer(bridge)) | ||
// Create an OTel MeterProvider with our reader. Metrics from OpenTelemetry | ||
// instruments are combined with metrics from Prometheus instruments in | ||
// exported batches of metrics. | ||
mp := metric.NewMeterProvider(metric.WithReader(reader)) | ||
``` |
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.
We can make a "testable example" in example_test.go
instead.
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.
I think we can get rid of this file in favor of doc.go
and example_test.go
.
The Prometheus Bridge allows using the Prometheus Golang client library | ||
(github.com/prometheus/client_golang) with the OpenTelemetry SDK. |
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.
You can move it to doc.go
.
I'd prefer to merge as-is. I'll open a follow-up with the new docs. |
Migrated from open-telemetry/opentelemetry-go#4351
This allows applications instrumented with the prometheus client library to use OpenTelemetry exporters (e.g. OTLP).
Limitations:
Despite the limitations, I think this still has a lot of value to users.