mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-01-26 03:52:03 +02:00
Removes the functionality of the Describe in prometheus exporter. (#3342)
* remove prom exporter Describe * Apply suggestions from code review Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com> Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
parent
0963f59955
commit
8b25cb2a85
@ -16,6 +16,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||||||
|
|
||||||
- `sdktrace.TraceProvider.Shutdown` and `sdktrace.TraceProvider.ForceFlush` to not return error when no processor register. (#3268)
|
- `sdktrace.TraceProvider.Shutdown` and `sdktrace.TraceProvider.ForceFlush` to not return error when no processor register. (#3268)
|
||||||
- The `"go.opentelemetry.io/otel/exporters/prometheus".New` now also returns an error indicating the failure to register the exporter with Prometheus. (#3239)
|
- The `"go.opentelemetry.io/otel/exporters/prometheus".New` now also returns an error indicating the failure to register the exporter with Prometheus. (#3239)
|
||||||
|
- The prometheus exporter will no longer try to enumerate the metrics it will send to prometheus on startup.
|
||||||
|
This fixes the `reader is not registered` warning currently emitted on startup. (#3291 #3342)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
@ -69,13 +69,11 @@ func New(opts ...Option) (*Exporter, error) {
|
|||||||
|
|
||||||
// Describe implements prometheus.Collector.
|
// Describe implements prometheus.Collector.
|
||||||
func (c *collector) Describe(ch chan<- *prometheus.Desc) {
|
func (c *collector) Describe(ch chan<- *prometheus.Desc) {
|
||||||
metrics, err := c.reader.Collect(context.TODO())
|
// The Opentelemetry SDK doesn't have information on which will exist when the collector
|
||||||
if err != nil {
|
// is registered. By returning nothing we are an "unchecked" collector in Prometheus,
|
||||||
otel.Handle(err)
|
// and assume responsibility for consistency of the metrics produced.
|
||||||
}
|
//
|
||||||
for _, metricData := range getMetricData(metrics) {
|
// See https://pkg.go.dev/github.com/prometheus/client_golang@v1.13.0/prometheus#hdr-Custom_Collectors_and_constant_Metrics
|
||||||
ch <- metricData.description
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect implements prometheus.Collector.
|
// Collect implements prometheus.Collector.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user