Skip to content

Commit

Permalink
Default to using stable HTTP semantic conventions (grafana#38)
Browse files Browse the repository at this point in the history
* Default to using stable HTTP semantic conventions

* Fix spacing
  • Loading branch information
pyohannes authored Nov 8, 2023
1 parent fa4a775 commit 2d1e90a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2d1e90a

Please sign in to comment.