opentelemetry-go icon indicating copy to clipboard operation
opentelemetry-go copied to clipboard

OpenCensus Metrics bridge doesn't work with the OpenTelemetry prometheus exporter

Open dashpole opened this issue 2 years ago • 2 comments

Problem Statement

I'd like to be able to send metrics from OpenCensus and OpenTelemetry SDKs to the same prometheus endpoint. This will allow me to migrate my OpenCensus metrics to OpenTelemetry over time.

Proposed Solution

Still investigating

Additional Context

From https://github.com/open-telemetry/opentelemetry-collector/pull/3816

@dashpole thanks for the suggestion! I tried the bridge, but ran into two problems:

Any idea where I'm going wrong?

dashpole avatar Aug 27 '21 18:08 dashpole

This one blocks collector transition as well. Consider to prioritize this.

bogdandrutu avatar Apr 08 '22 17:04 bogdandrutu

Agreed. Once the SDK is rewritten to be spec-compliant, I'll make sure the prometheus exporter works well with the otel SDK. I'll also want to make sure the prometheus exporter for go is compliant with the prom <-> otlp spec I wrote.

dashpole avatar Apr 08 '22 17:04 dashpole

Once #3541 lands, the following will work to use the OpenCensus bridge with the prometheus exporter:

exporter, err := prometheus.New()
// handle err
// Register the OpenCensus producer with the Prometheus exporter
exporter.RegisterProducer(opencensus.NewMetricProducer())
provider := metric.NewMeterProvider(metric.WithReader(exporter))
// use meter provider

dashpole avatar Dec 15 '22 21:12 dashpole