Function otel_to_sentry_span

Source
pub fn otel_to_sentry_span(otel_span: Span) -> Result<Span, Error>
Expand description

Transforms an OTEL span to a Sentry span.

This uses attributes in the OTEL span to populate various fields in the Sentry span.

  • The Sentry span’s name field may be set based on db or http attributes if the OTEL span’s name is empty.
  • The Sentry span’s op field will be inferred based on the OTEL span’s sentry.op attribute, or other available attributes if sentry.op is not provided.
  • The Sentry span’s description field will be inferred based on the OTEL span’s sentry.description attribute, or other available attributes if sentry.description is not provided.
  • The Sentry span’s status field is set based on the OTEL span’s status field and http.status_code and rpc.grpc.status_code attributes.
  • The Sentry span’s exclusive_time field is set based on the OTEL span’s exclusive_time_nano attribute, or the difference between the start and end timestamp if that attribute is not set.
  • The Sentry span’s platform field is set based on the OTEL span’s sentry.platform attribute.
  • The Sentry span’s profile_id field is set based on the OTEL span’s sentry.profile.id attribute.
  • The Sentry span’s segment_id field is set based on the OTEL span’s sentry.segment.id attribute.

All other attributes are carried over from the OTEL span to the Sentry span’s data.