Skip to content

Commit

Permalink
lele
Browse files Browse the repository at this point in the history
  • Loading branch information
arealmaas committed Dec 13, 2024
1 parent e6130a0 commit 07fa1f5
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/Digdir.Library.Utils.AspNet/AspNetUtilitiesExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,26 @@ public static WebApplicationBuilder ConfigureTelemetry(
.AddNpgsql()
.AddFusionCacheInstrumentation();
});
}
else
{
Console.WriteLine("[OpenTelemetry] OTLP exporter not configured - skipping");
}

if (!string.IsNullOrEmpty(settings.AppInsightsConnectionString))
{
telemetryBuilder.WithMetrics(metrics =>
{
metrics.AddRuntimeInstrumentation()
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddAzureMonitorMetricExporter();
.AddHttpClientInstrumentation();

if (!string.IsNullOrEmpty(settings.AppInsightsConnectionString))
{
metrics.AddAzureMonitorMetricExporter(options =>
{
options.ConnectionString = settings.AppInsightsConnectionString;
});
}
});
}
else
{
Console.WriteLine("[OpenTelemetry] OTLP exporter not configured - skipping");
}

return builder;
}
Expand Down

0 comments on commit 07fa1f5

Please sign in to comment.