Function span_v2_to_span_v1

Source
pub fn span_v2_to_span_v1(span_v2: SpanV2) -> Span
Expand description

Transforms a Sentry span V2 to a Sentry span V1.

This uses attributes in the V2 span to populate various fields in the V1 span.

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

All other attributes are carried over from the V2 span to the V1 span’s data.