Allow additional Tags for activity creation #50488
Labels
api-suggestion
Early API idea and discussion, it is NOT ready for implementation
area-networking
Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
When doing sampling with Activity/Traces, the information that you have to make the decision on whether to Sample of Drop is only that which is passed in as tags to Start/CreateActivity method. Sampling at the Head (root activity) is the most efficient method as it allows child activitys to inherit that decision and therefore reduce processing. You can sample at an individual (child) activity level too.
Right now, there is very little information to go on when trying to apply Head Sampling in a .NET application. This is because of the Activity being created having no tags being used as part of the Create.
aspnetcore/src/Hosting/Hosting/src/Internal/HostingApplicationDiagnostics.cs
Line 389 in 2f7a3f7
This means that the samplers can only base their decision on the parent context.
In order to use other contextual information, you need to use something like the IHttpContextAccessor to access the ambient context.
Describe the solution you'd like
What would make this better from a consumer perspective would be an extension point to augment the activity tags at creation time.
I don't know if Features for HTTP are available to get during the pipeline, however, something like the following
This would allow users to do that enrichment at the right time. It would allow the level of data being used to be configured according to the performance concerns of the user.
Additional context
No response
The text was updated successfully, but these errors were encountered: