open-telemetry / opentelemetry-go

OpenTelemetry Go API and SDK
https://opentelemetry.io/docs/languages/go
Apache License 2.0
5.27k stars 1.07k forks source link

Stable Metrics API missing OTLP exporter #4132

Closed JobberRT closed 1 year ago

JobberRT commented 1 year ago

First of all, the release of stable metrics api is such a great news for me(I've checking github everyday for a month and didn't expcet this soon)

What I want to achieve

  1. Using trace.Tracer and metrics.Meter to record tracing/metrics data, and implement Console(for debug)/HTTP/GRPC exporter for both.
  2. Send data to OTEL-Collector
  3. Using OTEL-Collector's Exporter to send data to different backend(prometheus/jaeger)
  4. Using Grafana to visualize the data

What problem I met

It seems that metrics api doesn't provide a OTLP exporter(or anything else), only stdoutmetric.exporter which prints data to stdout.

I see in otel/exporters there's two type of exporter to use: stdout and otlp, and trace api implements both exporter while metrics api only has stdout exporter.

Is this a TODO or excepted? If excepted, how can I send metrics data to OTEL-Collector?

dmathieu commented 1 year ago

There is an OTLP exporter for metrics, both for HTTP and gRPC: https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/otlp/otlpmetric

pellared commented 1 year ago

Take a look at https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp and https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc

There are not stable but I think they are good to use 😉

JobberRT commented 1 year ago

@dmathieu @pellared

I'm sorry, it was my oversight. I only executed go.opentelemetry.io/otel and forgot to execute go.opentelemetry.io/otel/..., which resulted in not updating all the submodules.

No wonder I vaguely remember seeing the Metrics OTLP Exporter when I checked the code yesterday after the Stable API was just released.

Thank you all for your efforts! 🥰🥰🥰