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

Removes the functionality of the Describe in prometheus exporter. #3342

Merged
merged 3 commits into from Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -16,6 +16,7 @@ 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)
- 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 a warning on startup. (#????)
MadVikingGod marked this conversation as resolved.
Show resolved Hide resolved

### Fixed

Expand Down
13 changes: 6 additions & 7 deletions exporters/prometheus/exporter.go
Expand Up @@ -68,14 +68,13 @@ func New(opts ...Option) (*Exporter, error) {
}

// Describe implements prometheus.Collector.
//
// Opentelemetry SDK doesn't have information on which will exist when the collector
// is registered. By returning nothing we are an "unckeched" collector in prometheus,
MadVikingGod marked this conversation as resolved.
Show resolved Hide resolved
// and assume responsibility for consistency of the metrics produced.
//
// See https://pkg.go.dev/github.com/prometheus/client_golang@v1.13.0/prometheus#hdr-Custom_Collectors_and_constant_Metrics
func (c *collector) Describe(ch chan<- *prometheus.Desc) {
MadVikingGod marked this conversation as resolved.
Show resolved Hide resolved
metrics, err := c.reader.Collect(context.TODO())
if err != nil {
otel.Handle(err)
}
for _, metricData := range getMetricData(metrics) {
ch <- metricData.description
}
}

// Collect implements prometheus.Collector.
Expand Down