Skip to content

Read Activity data into event (OTEL) #334

Closed as not planned
Closed as not planned

Description

@bruno-garcia

ASP.NET Core 3.0+ have support to W3C context propagation out of the box.
The current SDK already has an options to control whether to read Activity data and some data is already read.

The goal is to read the new values and enhance the SDK and possibly the protocol to read them.

Research

I did a bit of digging into this. From the W3C Spec:

Design Overview
Trace context is split into two individual propagation fields supporting interoperability and vendor-specific extensibility:

  1. traceparent describes the position of the incoming request in its trace graph <...snip...>
  2. tracestate extends traceparent with vendor-specific data represented by a set of name/value pairs. <...snip...>

Given that the data in tracestate is vendor specific, we're mainly interested in the traceparent then.

Traceparent Header
The traceparent HTTP header field identifies the incoming request in a tracing system. It has four fields:

  • version - specifies the version of the traceparent header.
  • trace-id - used to uniquely identify a distributed trace through a system
  • parent-id - the ID of this request as known by the caller
  • trace-flags - an 8-bit field that controls tracing flags such as sampling, trace level, etc.

Nothing in the W3C Traceparent Header itself is relevant beyond Sentry's Open Telemetry Integration then.

It looks like what we're more interested in is anything that could be gleaned from System.Diagnostics.Activity.Current. In the context of an ASP.NET [Core] application, everything that Microsoft currently store in there is to facilitate distributed tracing. I think the only time it might contain anything else is if one of our SDK users or some third party library was explicitly storing stuff in Activity.Tags. If they're doing that, then setting SentryOptions.IncludeActivityData will already ensure we capture this.

Activity

  1. alesdvorakcz commented on May 30, 2021

    @alesdvorakcz

    Would be nice if sentry tracing would be compatible with default dotnet core distributed tracing. Are there any plans for that?

  2. bruno-garcia commented on May 31, 2021

    @bruno-garcia
    MemberAuthor

    @alesdvorakcz could you please elaborate what are your expectations in that regard?

    Using the W3C trace headers? Something else?

  3. alesdvorakcz commented on Jun 1, 2021

    @alesdvorakcz

    Yes exactly. dotnet core has build in tracing, from .NET 5 it is using open telemetry standard from W3C. It works trough System.Diagnostics.Activity and System.Diagnostics.ActivitySource classes and it should be well integrated with many dotnet core libraries.
    I think it would be great if sentry could connect to this system so there is no need to create other Spans/Activities specifically for sentry.
    More info in official docs

  4. bruno-garcia commented on Jun 1, 2021

    @bruno-garcia
    MemberAuthor

    That aligns with the goals of this issue. Thanks for sharing.

  5. ccurrens commented on Mar 3, 2022

    @ccurrens

    Any update on this? Not having this greatly reduces the usefulness of the SDK.

    In particular, third-party libraries that are already instrumented using Activity won't include span information. So instead, we would have to wrap all calls with our own calls to StartChild. Additionally, the code in our project was already instrumented with Activity, so to get value out of this, we have to start calling the SentrySDK.* methods directly.

  6. changed the title [-]Read Activity data into event[/-] [+]Read Activity data into event (OTEL)[/+] on Oct 20, 2022
  7. mattjohnsonpint commented on Nov 16, 2022

    @mattjohnsonpint
    Contributor

    Just an update for everyone. This is still on our radar, and we're planning out how it would work exactly. We'd like to have support for Open Telemetry in the base .NET SDK, and integrate with ASP.NET Core's support where appropriate. I'm very open to feedback and suggestions of exactly how this would work and what the APIs would look like.

    David Fowler recently posted this thread on Twitter:
    https://twitter.com/davidfowl/status/1588942067157594112

    We could take a similar approach. Or we could try to do more automagically. Thoughts?

  8. removed their assignment
    on Jun 20, 2023
  9. jamescrosswell commented on Jul 6, 2023

    @jamescrosswell
    Collaborator

    @bruno-garcia is there anything additional implied in this issue that isn't already covered by the work we're doing on OpenTelemetry or would releasing Sentry.OpenTelementry close this issue?

  10. bruno-garcia commented on Jul 7, 2023

    @bruno-garcia
    MemberAuthor

    I didn't look into what's available. The goal of the ticket was to find out opportunities and enhance our context/scope with that data when available. So feel free to close if that's done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions