Skip to content

Commit

Permalink
try remove onend
Browse files Browse the repository at this point in the history
  • Loading branch information
andracc committed Oct 10, 2024
1 parent 99f7853 commit ee382de
Showing 1 changed file with 3 additions and 30 deletions.
33 changes: 3 additions & 30 deletions Backend/Otel/OtelKernel.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Diagnostics;
// using System.Diagnostics;
// using BackendFramework.Interfaces;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
using OpenTelemetry;
// using OpenTelemetry;
using OpenTelemetry.Instrumentation.AspNetCore;
using OpenTelemetry.Instrumentation.Http;
using OpenTelemetry.Metrics;
Expand Down Expand Up @@ -129,40 +129,13 @@ public static void AddOpenTelemetryInstrumentation(this IServiceCollection servi
services.AddOpenTelemetry().WithTracing(tracerProviderBuilder => tracerProviderBuilder
.SetResourceBuilder(appResourceBuilder)
.AddSource(SourceName)
.AddProcessor<LocationEnricher>()
// .AddProcessor<LocationEnricher>()
.AddAspNetCoreInstrumentation(AspNetCoreBuilder)
.AddHttpClientInstrumentation(HttpClientBuilder)
.AddConsoleExporter()
.AddOtlpExporter()
);
}
}
internal class LocationEnricher() : BaseProcessor<Activity>
{
public override void OnEnd(Activity data)
{
// string? uriPath = (string?)data.GetTagItem("url.full");
// string locationUri = LocationProvider.locationGetterUri;
// if (uriPath == null || !uriPath.Contains(locationUri))
// {
// LocationApi? response = await locationProvider.GetLocation();
// var location = new
// {
// Country = response?.country,
// Region = response?.regionName,
// City = response?.city,
// };
// data?.AddTag("country", location.Country);
// data?.AddTag("region", location.Region);
// data?.AddTag("city", location.City);
// }
// data?.SetTag("SESSIONID BAGGAGE", data?.GetBaggageItem("sessionId"));
// if (uriPath != null && uriPath.Contains(locationUri))
// {
// data?.SetTag("url.full", "");
// data?.SetTag("url.redacted.ip", LocationProvider.locationGetterUri);
// }
}
}
}

0 comments on commit ee382de

Please sign in to comment.