MCPcopy Create free account
hub / github.com/aptabase/aptabase / ConfigureOpenTelemetry

Method ConfigureOpenTelemetry

src/Extensions/TelemetryExtensions.cs:34–60  ·  view source on GitHub ↗
(this IHostApplicationBuilder builder)

Source from the content-addressed store, hash-verified

32 }
33
34 public static IHostApplicationBuilder ConfigureOpenTelemetry(this IHostApplicationBuilder builder)
35 {
36 builder.Logging.AddOpenTelemetry(logging =>
37 {
38 logging.IncludeFormattedMessage = true;
39 logging.IncludeScopes = true;
40 });
41
42 builder.Services.AddOpenTelemetry()
43 .WithMetrics(metrics =>
44 {
45 metrics.AddAspNetCoreInstrumentation()
46 .AddHttpClientInstrumentation()
47 .AddRuntimeInstrumentation();
48 })
49 .WithTracing(tracing =>
50 {
51 tracing.AddAspNetCoreInstrumentation()
52 // Uncomment the following line to enable gRPC instrumentation (requires the OpenTelemetry.Instrumentation.GrpcNetClient package)
53 //.AddGrpcClientInstrumentation()
54 .AddHttpClientInstrumentation();
55 });
56
57 builder.AddOpenTelemetryExporters();
58
59 return builder;
60 }
61
62 private static IHostApplicationBuilder AddOpenTelemetryExporters(this IHostApplicationBuilder builder)
63 {

Callers 1

AddServiceDefaultsMethod · 0.80

Calls 1

Tested by

no test coverage detected