Skip to content

Commit

Permalink
telemetry.distro.name and telemetry.distro.version (#3006)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kielek authored Oct 12, 2023
1 parent 47a0f8c commit 220f331
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ This component adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.h
- Added support for `Elastic.Transport` traces instrumentation 0.4.16+.
`Elastic.Clients.Elasticsearch` 8.10.0+ traces instrumentation is covered by
`Elastic.Transport` traces instrumentation.
- Added `telemetry.distro.name` resource attribute. The value is set to `opentelemetry-dotnet-instrumentation`.

### Changed

- Change telemetry resource attribute name from `telemetry.auto.version` to `telemetry.distro.version`.

#### Dependency updates

- .NET Framework only, `Google.Protobuf` updated from `3.24.3` to `3.24.4`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public static ResourceBuilder CreateResourceBuilder(IReadOnlyList<ResourceDetect
.AddTelemetrySdk()
.AddAttributes(new KeyValuePair<string, object>[]
{
new(Constants.Tracer.AutoInstrumentationVersionName, AutoInstrumentationVersion.Version)
new(Constants.DistributionAttributes.TelemetryDistroNameAttributeName, Constants.DistributionAttributes.TelemetryDistroNameAttributeValue),
new(Constants.DistributionAttributes.TelemetryDistroVersionAttributeName, AutoInstrumentationVersion.Version)
});

foreach (var enabledResourceDetector in enabledResourceDetectors)
Expand Down
6 changes: 4 additions & 2 deletions src/OpenTelemetry.AutoInstrumentation/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ namespace OpenTelemetry.AutoInstrumentation;

internal static class Constants
{
public static class Tracer
public static class DistributionAttributes
{
public const string AutoInstrumentationVersionName = "telemetry.auto.version";
public const string TelemetryDistroNameAttributeName = "telemetry.distro.name";
public const string TelemetryDistroNameAttributeValue = "opentelemetry-dotnet-instrumentation";
public const string TelemetryDistroVersionAttributeName = "telemetry.distro.version";
}

public static class ConfigurationValues
Expand Down
3 changes: 2 additions & 1 deletion test/IntegrationTests/SmokeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,8 @@ private static void ExpectResources(OtlpResourceExpector resourceExpector)
resourceExpector.Expect("telemetry.sdk.name", "opentelemetry");
resourceExpector.Expect("telemetry.sdk.language", "dotnet");
resourceExpector.Expect("telemetry.sdk.version", typeof(OpenTelemetry.Resources.Resource).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()!.InformationalVersion.Split('+')[0]);
resourceExpector.Expect("telemetry.auto.version", typeof(OpenTelemetry.AutoInstrumentation.Constants).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()!.InformationalVersion.Split('+')[0]);
resourceExpector.Expect("telemetry.distro.name", "opentelemetry-dotnet-instrumentation");
resourceExpector.Expect("telemetry.distro.version", typeof(OpenTelemetry.AutoInstrumentation.Constants).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()!.InformationalVersion.Split('+')[0]);
}

private void VerifyTestApplicationInstrumented(TestAppStartupMode startupMode = TestAppStartupMode.Auto)
Expand Down

0 comments on commit 220f331

Please sign in to comment.