dotnet / dotnet-api-docs

.NET API reference documentation (.NET 5+, .NET Core, .NET Framework)
https://docs.microsoft.com/dotnet/api/
Other
708 stars 1.55k forks source link

Document Tracing/Activity sampling #9978

Open samsp-msft opened 4 months ago

samsp-msft commented 4 months ago

There is infrastructure via ActivityListener.Sample and in ASP.NET core when the request comes in to pull the trace flags from the incoming request to create the TraceID and set the Recorded bit on the activity. These can be overridden if necessary to add custom logic such as only trusting trace information from certain hosts, however its not currently documented.

@noahfalk has the knowledge in his head - we need to put this into documentation in the form of a sampling scenarios HowTo or cookbook.

dotnet-policy-service[bot] commented 4 months ago

Tagging subscribers to this area: @dotnet/area-system-diagnostics-activity See info in area-owners.md if you want to be subscribed.

dotnet-issue-labeler[bot] commented 4 months ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

dotnet-policy-service[bot] commented 4 months ago

Tagging subscribers to this area: @dotnet/area-system-diagnostics-tracing

noahfalk commented 4 months ago

Are you looking for an OpenTelemetry sampling cookbook? I'm guessing the number of people writing their custom sampling logic directly against the ActivityListener.Sample API is very small. The 99+% usage case is probably going to be sampling with OTel's API (or some other vendor specific API). The current docs do discuss that callback, but they don't give any recommendation about common sampling approaches someone might want to code up.

samsp-msft commented 4 months ago

I want to cover a couple of aspects: