Skip to content

Commit

Permalink
fix(api): Remove workaround for #752
Browse files Browse the repository at this point in the history
  • Loading branch information
VMelnalksnis committed Jan 14, 2024
1 parent 28d27e4 commit 70bef98
Showing 1 changed file with 1 addition and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the GNU Affero General Public License v3.0 or later.
// See LICENSE.txt file in the project root for full license information.

using System;
using System.Collections.Generic;

using Gnomeshade.WebApi.Configuration.Options;
Expand Down Expand Up @@ -75,22 +74,7 @@ internal static IServiceCollection AddGnomeshadeOpenTelemetry(

services.AddLogging(builder => builder.AddOpenTelemetry(options =>
{
options.AddOtlpExporter((exporterOptions, loggerOptions) =>
{
loggerOptions.ExportProcessorType = ExportProcessorType.Simple;

// HACK: Force the open telemetry endpoint environment variable to be populated even if
// the value is already provided through other configuration means.
//
// https://github.com/open-telemetry/opentelemetry-dotnet/issues/4014

var defaultOptions = new OpenTelemetryOptions();
var endpoint = configuration.GetValue<Uri>($"{OpenTelemetryOptions.SectionName}:{nameof(OpenTelemetryOptions.ExporterEndpoint)}") ?? defaultOptions.ExporterEndpoint;
var protocol = configuration.GetValue<OtlpExportProtocol>($"{OpenTelemetryOptions.SectionName}:{nameof(OpenTelemetryOptions.ExportProtocol)}");

exporterOptions.Endpoint = endpoint;
exporterOptions.Protocol = protocol;
});
options.AddOtlpExporter((_, loggerOptions) => loggerOptions.ExportProcessorType = ExportProcessorType.Simple);
options.SetResourceBuilder(resourceBuilder);
options.IncludeScopes = true;
options.IncludeFormattedMessage = true;
Expand Down

0 comments on commit 70bef98

Please sign in to comment.