Skip to content

Commit b4b387e

Browse files
feat: add basic auth support for OTLP and Pyroscope endpoints
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ffb9052 commit b4b387e

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,8 @@ ENV DOTNET_EnableDiagnostics_IPC=0
4444
ENV DOTNET_EnableDiagnostics_Debugger=0
4545
ENV DOTNET_EnableDiagnostics_Profiler=1
4646

47+
# Pyroscope basic auth (set at runtime)
48+
ENV PYROSCOPE_BASIC_AUTH_USER=""
49+
ENV PYROSCOPE_BASIC_AUTH_PASSWORD=""
50+
4751
ENTRYPOINT ["dotnet", "GithubActionsOrchestrator.dll"]

Program.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,16 @@ public static void Main(string[] args)
110110
.AddSource("Npgsql")
111111
.AddAspNetCoreInstrumentation()
112112
.AddHttpClientInstrumentation()
113-
.AddOtlpExporter()
113+
.AddOtlpExporter(opt =>
114+
{
115+
var otlpUser = Environment.GetEnvironmentVariable("OTEL_EXPORTER_OTLP_AUTH_USER");
116+
var otlpPass = Environment.GetEnvironmentVariable("OTEL_EXPORTER_OTLP_AUTH_PASSWORD");
117+
if (!string.IsNullOrEmpty(otlpUser) && !string.IsNullOrEmpty(otlpPass))
118+
{
119+
var credentials = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes($"{otlpUser}:{otlpPass}"));
120+
opt.Headers = $"Authorization=Basic {credentials}";
121+
}
122+
})
114123
.AddProcessor(new Pyroscope.OpenTelemetry.PyroscopeSpanProcessor());
115124
});
116125
builder.Services.AddSingleton<RunnerQueue>();

0 commit comments

Comments
 (0)