Skip to content

Commit eb74496

Browse files
committed
Move initialization earlier to ensure it is before any kusto clients are made
1 parent 8ad211e commit eb74496

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/OpenTelemetry.Instrumentation.Kusto/MeterProviderBuilderExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ public static MeterProviderBuilder AddKustoInstrumentation(this MeterProviderBui
3333

3434
configureKustoInstrumentationOptions(KustoInstrumentation.Options);
3535

36+
// Be sure to eagerly initialize the instrumentation, as we must set environment variables before any clients are created.
37+
KustoInstrumentation.Initialize();
38+
3639
builder.AddInstrumentation(sp =>
3740
{
38-
KustoInstrumentation.Initialize();
3941
return KustoInstrumentation.HandleManager.AddMetricHandle();
4042
});
4143

src/OpenTelemetry.Instrumentation.Kusto/TracerProviderBuilderExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ public static TracerProviderBuilder AddKustoInstrumentation(
3535

3636
configureKustoInstrumentationOptions(KustoInstrumentation.Options);
3737

38+
// Be sure to eagerly initialize the instrumentation, as we must set environment variables before any clients are created.
39+
KustoInstrumentation.Initialize();
40+
3841
builder.AddInstrumentation(sp =>
3942
{
40-
KustoInstrumentation.Initialize();
4143
return KustoInstrumentation.HandleManager.AddTracingHandle();
4244
});
4345

0 commit comments

Comments
 (0)