Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracing configuration similar to MetricsBuilder #100317

Open
Tracked by #109396
lmolkova opened this issue Mar 1, 2024 · 2 comments
Open
Tracked by #109396

Tracing configuration similar to MetricsBuilder #100317

lmolkova opened this issue Mar 1, 2024 · 2 comments

Comments

@lmolkova
Copy link

lmolkova commented Mar 1, 2024

When configuring distributed tracing, it's useful to be able to enable and disable sources based on name(space) and other properties.

For example, Azure SDKs create multiple sources per library:

  • Azure.Messaging.ServiceBus.SenderClient,
  • Azure.Messaging.ServiceBus.ReceiverClient
  • .. but also also to trace individual message via Azure.Messaging.ServiceBus.Message.

Some customer want per-message tracing, some don't, and we need to be able to tell them to enable Azure.* (or Azure.Messaging.ServiceBus.*) but disable the Azure.Messaging.ServiceBus.Message.

Another example is more common: client libraries want to report logical operations (that trace public API surface calls), but want to make protocol level opt-in. E.g. Azure.CosmosDb.Operation is a source for logical operations that we want users and OTel distros to enable by default and Azure.CosmosDb.Request would contain more verbose network traces that users should be able to opt into.
With MetricsBuilder-like API this would look like

builder.Services.AddDistributedTracing(b => b.EnableTracing("Azure.")
                                  .DisableTracing("Azure.CosmosDb.Request"));

It's not super-convenient for end-users but should be reasonable for OTel Distros. OTel might provide better ways to do it (see below).

So, it would be great to have parity with metrics and provide builder-like API allowing to enable and disable sources.

At the same time, name is not enough/future-proof in both (tracing and metrics) cases.

It would be great to support some form of EnableSource(Predicate<ActivitySource>) or a list of EnableSource(string name, string? version, IEnumerable<>? scopeAttributes, ....) overloads.

Separate from this issue, but it would be great to have consistent IMetricsBuilder.Enable|Disable(Func<Meter, Instrument, bool>) API or something else that allows to control metrics based on all meter properties.

See open-telemetry/opentelemetry-dotnet#5353 for more details.

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Mar 1, 2024
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Mar 1, 2024
@jeffschwMSFT jeffschwMSFT transferred this issue from dotnet/runtime Mar 3, 2024
@mkArtakMSFT mkArtakMSFT removed untriaged New issue has not been triaged by the area owner needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Mar 3, 2024
@lmolkova
Copy link
Author

based on the discussion with otel-dotnet people, they are not open to take contributions and are not ready to take "maintenance burden".

Given that it's problematic for any big set of libraries and turning of sources is one of a common asks we have on Azure SDKs specifically in .NET, I'd like to check if we can provide ability to turn off sources on the BCL level.

@lmolkova
Copy link
Author

lmolkova commented Mar 26, 2024

@jeffschwMSFT @mkArtakMSFT I think it belongs in dotnet/runtime repo (Microsoft.Extensions.Diagnostics component) and the area should be diagnostics. Could you please check?
Thanks!

@jeffschwMSFT jeffschwMSFT transferred this issue from dotnet/aspnetcore Mar 26, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Mar 26, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Mar 26, 2024
@eerhardt eerhardt added area-System.Diagnostics.Activity and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Mar 27, 2024
@tarekgh tarekgh added this to the Future milestone Jun 20, 2024
@tarekgh tarekgh removed the untriaged New issue has not been triaged by the area owner label Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants