mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
Update OpenTelemetry exporter configuration
This commit is contained in:
@@ -7,8 +7,6 @@ using OpenTelemetry.Trace;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
const string endpoint = "http://localhost:4317";
|
||||
|
||||
Console.WriteLine($"Env var: {Environment.GetEnvironmentVariable("OTEL_EXPORTER_OTLP_HEADERS")?.ToString()}");
|
||||
|
||||
|
||||
@@ -30,14 +28,7 @@ builder.Logging.AddOpenTelemetry(logging =>
|
||||
.AddConsoleExporter()
|
||||
.AddOtlpExporter(opt =>
|
||||
{
|
||||
// If endpoint was not specified, the proper one will be selected according to the protocol.
|
||||
if (!string.IsNullOrEmpty(endpoint))
|
||||
{
|
||||
opt.Endpoint = new Uri(endpoint);
|
||||
|
||||
// Set headers in OTLP exporter
|
||||
// opt.Headers = "oneuptime-service-token=0a00ebc0-7f39-11ee-ac8c-3fb43926b224";
|
||||
}
|
||||
|
||||
|
||||
System.Console.WriteLine($"OTLP Exporter is using {opt.Protocol} protocol and endpoint {opt.Endpoint}");
|
||||
});
|
||||
@@ -52,15 +43,7 @@ builder.Services.AddOpenTelemetry()
|
||||
.AddConsoleExporter()
|
||||
.AddOtlpExporter(opt =>
|
||||
{
|
||||
// If endpoint was not specified, the proper one will be selected according to the protocol.
|
||||
if (!string.IsNullOrEmpty(endpoint))
|
||||
{
|
||||
opt.Endpoint = new Uri(endpoint);
|
||||
// Set headers in OTLP exporter
|
||||
// opt.Headers = "oneuptime-service-token=0a00ebc0-7f39-11ee-ac8c-3fb43926b224";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
System.Console.WriteLine($"OTLP Exporter is using {opt.Protocol} protocol and endpoint {opt.Endpoint}");
|
||||
}));
|
||||
@@ -82,13 +65,7 @@ builder.Services.AddOpenTelemetry()
|
||||
})
|
||||
.AddOtlpExporter(opt =>
|
||||
{
|
||||
// If endpoint was not specified, the proper one will be selected according to the protocol.
|
||||
if (!string.IsNullOrEmpty(endpoint))
|
||||
{
|
||||
opt.Endpoint = new Uri(endpoint);
|
||||
// Set headers in OTLP exporter
|
||||
// opt.Headers = "oneuptime-service-token=0a00ebc0-7f39-11ee-ac8c-3fb43926b224";
|
||||
}
|
||||
|
||||
|
||||
System.Console.WriteLine($"OTLP Exporter is using {opt.Protocol} protocol and endpoint {opt.Endpoint}");
|
||||
|
||||
|
||||
@@ -5,5 +5,6 @@
|
||||
Please use
|
||||
|
||||
```bash
|
||||
export OTEL_EXPORTER_OTLP_HEADERS="x-oneuptime-service-token=9c8806e0-a4aa-11ee-be95-010d5967b068" && export OTEL_EXPORTER_OTLP_ENDPOINT="https://localhost/opentelemetry-collector" && dotnet run --urls=http://localhost:7856/
|
||||
```
|
||||
export OTEL_EXPORTER_OTLP_HEADERS="x-oneuptime-service-token=9c8806e0-a4aa-11ee-be95-010d5967b068" && export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost/opentelemetry-collector" && dotnet run --urls=http://localhost:7856/
|
||||
```
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -41,3 +41,8 @@
|
||||
2.0
|
||||
2.0
|
||||
2.0
|
||||
2.0
|
||||
2.0
|
||||
2.0
|
||||
2.0
|
||||
2.0
|
||||
|
||||
Reference in New Issue
Block a user