|
13 | 13 | var appBuilder = WebApplication.CreateBuilder(args);
|
14 | 14 |
|
15 | 15 | // Note: Switch between Zipkin/OTLP/Console by setting UseTracingExporter in appsettings.json.
|
16 |
| -var tracingExporter = appBuilder.Configuration.GetValue("UseTracingExporter", defaultValue: "console")!.ToLowerInvariant(); |
| 16 | +var tracingExporter = appBuilder.Configuration.GetValue("UseTracingExporter", defaultValue: "console").ToLowerInvariant(); |
17 | 17 |
|
18 | 18 | // Note: Switch between Prometheus/OTLP/Console by setting UseMetricsExporter in appsettings.json.
|
19 |
| -var metricsExporter = appBuilder.Configuration.GetValue("UseMetricsExporter", defaultValue: "console")!.ToLowerInvariant(); |
| 19 | +var metricsExporter = appBuilder.Configuration.GetValue("UseMetricsExporter", defaultValue: "console").ToLowerInvariant(); |
20 | 20 |
|
21 | 21 | // Note: Switch between Console/OTLP by setting UseLogExporter in appsettings.json.
|
22 |
| -var logExporter = appBuilder.Configuration.GetValue("UseLogExporter", defaultValue: "console")!.ToLowerInvariant(); |
| 22 | +var logExporter = appBuilder.Configuration.GetValue("UseLogExporter", defaultValue: "console").ToLowerInvariant(); |
23 | 23 |
|
24 | 24 | // Note: Switch between Explicit/Exponential by setting HistogramAggregation in appsettings.json
|
25 |
| -var histogramAggregation = appBuilder.Configuration.GetValue("HistogramAggregation", defaultValue: "explicit")!.ToLowerInvariant(); |
| 25 | +var histogramAggregation = appBuilder.Configuration.GetValue("HistogramAggregation", defaultValue: "explicit").ToLowerInvariant(); |
26 | 26 |
|
27 | 27 | // Create a service to expose ActivitySource, and Metric Instruments
|
28 | 28 | // for manual instrumentation
|
|
69 | 69 | builder.AddOtlpExporter(otlpOptions =>
|
70 | 70 | {
|
71 | 71 | // Use IConfiguration directly for Otlp exporter endpoint option.
|
72 |
| - otlpOptions.Endpoint = new Uri(appBuilder.Configuration.GetValue("Otlp:Endpoint", defaultValue: "http://localhost:4317")!); |
| 72 | + otlpOptions.Endpoint = new Uri(appBuilder.Configuration.GetValue("Otlp:Endpoint", defaultValue: "http://localhost:4317")); |
73 | 73 | });
|
74 | 74 | break;
|
75 | 75 |
|
|
133 | 133 | builder.AddOtlpExporter(otlpOptions =>
|
134 | 134 | {
|
135 | 135 | // Use IConfiguration directly for Otlp exporter endpoint option.
|
136 |
| - otlpOptions.Endpoint = new Uri(appBuilder.Configuration.GetValue("Otlp:Endpoint", defaultValue: "http://localhost:4317")!); |
| 136 | + otlpOptions.Endpoint = new Uri(appBuilder.Configuration.GetValue("Otlp:Endpoint", defaultValue: "http://localhost:4317")); |
137 | 137 | });
|
138 | 138 | break;
|
139 | 139 | default:
|
|
0 commit comments