OpenTelemetry Support

This document details Sentry's work in integrating and supporting OpenTelemetry, the open standard for metrics, traces and logs. In particular, it focuses on the integration between Sentry's performance monitoring product and OpenTelemetry's tracing spec.

Background

When Sentry performance monitoring was initially introduced, OpenTelemetry was in early stages. This lead to us adopt a slightly different model from OpenTelemetry, notably we have this concept of transactions that OpenTelemetry does not have. We've described this, and some more historical background, in our performance monitoring research document.

TODO: Add history about OpenTelemetry Sentry Exporter: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/sentryexporter

Approach

TODO: Talk about the approach we are using, based on Matt's hackweek project - https://github.com/getsentry/sentry-ruby/pull/1876

Protocol

Transaction Protocol

TODO: Talk about generating transactions

Span Protocol

Below describe the transformations between an OpenTelemetry span and a Sentry Span. Related: the interface for a Sentry Span, the Relay spec for a Sentry Span and the spec for an OpenTelemetry span.

This is based on a mapping done as part of work on the OpenTelemetry Sentry Exporter.

OpenTelemetry SpanSentry SpanNote
Span.TraceIDSpan.trace_id
Span.SpanIDSpan.span_id
Span.ParentSpanIDSpan.parent_span_id
Span.ParentSpanIDSpan.parent_span_idIf a span does not have a parent span ID, it is a root span. For a root span:
  • If there is an active Sentry transaction, add it to the transaction
  • If there is no active Sentry transaction, construct a new transaction from that span
  • Span.Name, Span.Attributes, Span.KindSpan.descriptionThe span description is decided using OpenTelemetry Semantic Conventions. Generally, the OpenTelemetry Span.Name maps to a Sentry Span.description.
    Span.Name, Span.Attributes, Span.KindSpan.op

    Semantic Conventions

    Using the Span.Name, Span.Attributes, and Span.Kind of OpenTelemetry Spans, we can generate ops, descriptions, and tags. This exact mapping is described below.

    TODO: Talk about what we do here: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/48ee3288c030ed32374125190a8abf7ced1a4238/exporter/sentryexporter/sentry_exporter.go#L226-L267

    SDK Spec

    You can edit this page on GitHub.