Skip to content

Allow control over Activity creation #27237

Closed
@shirhatti

Description

@shirhatti

Is your feature request related to a problem? Please describe.

It is currently not possible to override (or suppress) creation of a new System.Diagnostics.Activity since it happens as a part of hosting.

Describe the solution you'd like

We should move Activity creation from hosting into a new middleware

Additional context

Customer quote:

Our service is in the middle of a bunch of other services which all use a Http header, x-ms-correlation-id with the value being a Guid formatted with dashes, to pass correlation for aligning traces and logs. I want to just reuse their Id without my developers having to even care, but if I let ASP.NET do its magic, there is no incoming traceparent header so a new activity is created from scratch (not calling SetParentId beforehand). This means and I have to do a bunch of gymnastics to grab x-ms-correlation-id and attach it as baggage and ensure I log it as well with everything (so now I have 2 “traceids”). I just want to be able to reuse an incoming traceid/guid and let Activity do all the hard work propagating and adding to logs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: DesignThis issue requires design work before implementating.affected-fewThis issue impacts only small number of customersarea-hostingIncludes Hostingarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneseverity-minorThis label is used by an internal tool

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions