diff --git a/src/Grafana.OpenTelemetry.Base/MeterProviderBuilderExtensions.cs b/src/Grafana.OpenTelemetry.Base/MeterProviderBuilderExtensions.cs index 1a228b3..bdf639e 100644 --- a/src/Grafana.OpenTelemetry.Base/MeterProviderBuilderExtensions.cs +++ b/src/Grafana.OpenTelemetry.Base/MeterProviderBuilderExtensions.cs @@ -31,6 +31,12 @@ public static MeterProviderBuilder UseGrafana(this MeterProviderBuilder builder, GrafanaOpenTelemetryEventSource.Log.InitializeDistribution(settings); + // Default to using stable HTTP semantic conventions + if (Environment.GetEnvironmentVariable("OTEL_SEMCONV_STABILITY_OPT_IN") == null) + { + Environment.SetEnvironmentVariable("OTEL_SEMCONV_STABILITY_OPT_IN", "http"); + } + return builder .AddGrafanaExporter(settings?.ExporterSettings) .AddInstrumentations(settings?.Instrumentations) diff --git a/src/Grafana.OpenTelemetry.Base/OpenTelemetryLoggerOptionsExtensions.cs b/src/Grafana.OpenTelemetry.Base/OpenTelemetryLoggerOptionsExtensions.cs index b4f8a2b..3ca5fb3 100644 --- a/src/Grafana.OpenTelemetry.Base/OpenTelemetryLoggerOptionsExtensions.cs +++ b/src/Grafana.OpenTelemetry.Base/OpenTelemetryLoggerOptionsExtensions.cs @@ -32,6 +32,12 @@ public static OpenTelemetryLoggerOptions UseGrafana(this OpenTelemetryLoggerOpti GrafanaOpenTelemetryEventSource.Log.InitializeDistribution(settings); + // Default to using stable HTTP semantic conventions + if (Environment.GetEnvironmentVariable("OTEL_SEMCONV_STABILITY_OPT_IN") == null) + { + Environment.SetEnvironmentVariable("OTEL_SEMCONV_STABILITY_OPT_IN", "http"); + } + var resourceBuilder = ResourceBuilder .CreateDefault() .AddGrafanaResource(settings); diff --git a/src/Grafana.OpenTelemetry.Base/TracerProviderBuilderExtensions.cs b/src/Grafana.OpenTelemetry.Base/TracerProviderBuilderExtensions.cs index f39484e..bc0da04 100644 --- a/src/Grafana.OpenTelemetry.Base/TracerProviderBuilderExtensions.cs +++ b/src/Grafana.OpenTelemetry.Base/TracerProviderBuilderExtensions.cs @@ -31,6 +31,12 @@ public static TracerProviderBuilder UseGrafana(this TracerProviderBuilder builde GrafanaOpenTelemetryEventSource.Log.InitializeDistribution(settings); + // Default to using stable HTTP semantic conventions + if (Environment.GetEnvironmentVariable("OTEL_SEMCONV_STABILITY_OPT_IN") == null) + { + Environment.SetEnvironmentVariable("OTEL_SEMCONV_STABILITY_OPT_IN", "http"); + } + return builder .AddGrafanaExporter(settings?.ExporterSettings) .AddInstrumentations(settings?.Instrumentations)