Repository navigation
Description
When creating a tracer (ActivitySource) users should be able to specify a set of instrumentation scope attributes - https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#get-a-tracer.
See open-telemetry/opentelemetry-dotnet#4316 for the context.
Instrumentation scope attributes can be used to reduce instrumentation overhead and reduce the over-the-wire size of attributes.
For example, Azure SDK provides Azure resource provider namespace is used by Azure Monitor (and can be used by other backends) to show icons, find corresponding resources in Azure, and allow navigating to them, etc. this value is constant for a given tracer and should be passed as an instr scope attribute rather than span attribute.
.NET does not allow to provide such attributes as of today.
proposal added by @tarekgh
Proposal
namespace System.Diagnostics;
public sealed class ActivitySource : IDisposable
{
public ActivitySource(string name, string? version = "") { ... }
+ public ActivitySource(string name, string? version, IEnumerable<KeyValuePair<string, object?>>? tags) { ... }
+ public IEnumerable<KeyValuePair<string, object?>>? Tags { get; }
}Alternative Proposal
namespace System.Diagnostics;
public class ActivitySourceOptions
{
public ActivitySourceOptions(string name) { }
public string Name { get; set; }
public string? Version { get; set; }
public IEnumerable<KeyValuePair<string, object?>>? Tags { get; set; }
}
public sealed class ActivitySource : IDisposable
{
...
public ActivitySource(ActivitySourceOptions options) { ... }
public IEnumerable<KeyValuePair<string, object?>>? Tags { get; }
}
Activity
tommcdon commentedon Oct 23, 2023
Assigning to @noahfalk to help coordinate
tarekgh commentedon Oct 23, 2023
This is a duplicate of #63651. @lmolkova can we close this and continue the discussion on the other one?
CC @cijothomas @reyang
2 remaining items
[-][Feature request]: Support SchemaUrl and instrumentation scope attributes for OpenTelemetry tracing and metrics[/-][+][Feature request]: Support instrumentation scope attributes for OpenTelemetry tracing and metrics[/+]tarekgh commentedon Oct 23, 2023
Thanks @lmolkova for clarification. We already done #84321 in .NET 8.0. Is that what you are asking for? or you want to have the same for ActivitySource too?
lmolkova commentedon Oct 23, 2023
Cool! Yes, I mean
ActivitySource, great to know it's addressed on meters.[-][Feature request]: Support instrumentation scope attributes for OpenTelemetry tracing and metrics[/-][+][Feature request]: Support instrumentation scope attributes on ActivitySource[/+]tarekgh commentedon Oct 25, 2023
open-telemetry/opentelemetry-dotnet#3636
terrajobst commentedon May 21, 2024
Video