Skip to content

Allow access to the operation id #1338

Closed

Description

I'm doing some Serilog integration currently in ASP.NET Core 3, where it would be really nice to be able to access the current operation_id and operation_ParentId, to ship that off along with the traces sent to Application Insights. Particularly in a situation where we use telemetryClient.StartOperation<RequestTelemetry>()

An earlier issue , suggested System.Diagnostics.Activity.Current?.RootId - but that's not accurate anymore. Looking through the codebase it seems like the
operation_Id is equivalent to Activity.TraceId and the operation_ParentId is constructed via $"|{activity.TraceId}.{activity.Parent.SpanId}." inside W3CUtilities.FormatTelemetryId

Is this:
a) Correct?
b) Guaranteed to be stable, if I end up creating this logic into my logging integration
c) Or it is perhaps possible to expose the functionality for getting these ID's, so we don't have to go through all of these hoops

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

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions