onflow / flow-go

A fast, secure, and developer-friendly blockchain built to support the next generation of games, apps, and the digital assets that power them.
GNU Affero General Public License v3.0
533 stars 178 forks source link

Add support for OpenTelemetry tracing #2796

Closed sjonpaulbrown closed 2 years ago

sjonpaulbrown commented 2 years ago

Problem Definition

We would like to add support for tracing with OpenTelemetry. Currently, we support tracing with Open Tracer, but we would like to support OpenTelemetry so that we can integrate into our standard model for distributed tracing.

Proposed Solution

To add support for OpenTelemetry, we can add a new struct that implements the Tracer interface, and we need to add support for enabling tracing with OpenTelemetry.

Definition of Done

sjonpaulbrown commented 2 years ago

The initial work for this has been started here.

ramtinms commented 2 years ago

Some notes on how this should be handled:

SaveTheRbtz commented 2 years ago

Seems like OTEL supports overriding both:

This way we can likely make it backwards compatible with the current tracer. Let me try migrating existing code to it.

SaveTheRbtz commented 2 years ago

OpenTelemetry support has landed.

To control new library, feel free to switch from old JAEGER_* env vars to the new OTEL_EXPORTER_OTLP_TRACES_*, for example localnet uses following: https://github.com/onflow/flow-go/pull/2823/commits/a97f4167339c436f2d5cb50cf17cc032a829eff1. Full list of env vars: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.12.0/specification/protocol/exporter.md

(NB! We use gRPC exporter by default, so you need to use gRPC-enabled collector on the other side.)

Re-assigning back to @sjonpaulbrown for verification. (cc: @haroldsphinx)