fix(billing): update otlexporter duplicate call

This commit is contained in:
Stephon Brown
2026-01-19 10:38:32 -05:00
parent b0641603f4
commit 3e1ee8a57f
2 changed files with 13 additions and 5 deletions

View File

@@ -3,10 +3,6 @@ using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using OpenTelemetry;
using OpenTelemetry.Metrics;
using OpenTelemetry.Trace;
namespace Bit.ServiceDefaults;
@@ -189,7 +185,15 @@ public static class Extensions
var useOtlpExporter = !string.IsNullOrWhiteSpace(context.Configuration["OTEL_EXPORTER_OTLP_ENDPOINT"]);
if (useOtlpExporter)
{
services.AddOpenTelemetry().UseOtlpExporter();
// Check if OTLP exporter is already configured
var otlpExporterAlreadyRegistered = services.Any(sd =>
sd.ServiceType.FullName?.Contains("OtlpExporter") == true ||
sd.ImplementationType?.FullName?.Contains("OtlpExporter") == true);
if (!otlpExporterAlreadyRegistered)
{
services.AddOpenTelemetry().UseOtlpExporter();
}
}
});
return hostBuilder;

View File

@@ -379,6 +379,10 @@ Global
{FFB09376-595B-6F93-36F0-70CAE90AFECB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FFB09376-595B-6F93-36F0-70CAE90AFECB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FFB09376-595B-6F93-36F0-70CAE90AFECB}.Release|Any CPU.Build.0 = Release|Any CPU
{B4CC25D0-BD09-459E-9885-DF9A56E304F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B4CC25D0-BD09-459E-9885-DF9A56E304F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D6F3351-9CA6-4B35-956F-1EE346330A41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7D6F3351-9CA6-4B35-956F-1EE346330A41}.Debug|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE