Skip to content

Commit

Permalink
try removing comments in func
Browse files Browse the repository at this point in the history
  • Loading branch information
andracc committed Oct 9, 2024
1 parent a106f7a commit 168f4db
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions Backend/Otel/OtelKernel.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@

// using System;
using System.Diagnostics;
using BackendFramework.Interfaces;

using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
using OpenTelemetry;
Expand All @@ -12,7 +9,6 @@
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;
using System.Linq;
// using MongoDB.Driver.Core.Events;

namespace BackendFramework.Otel
{
Expand Down Expand Up @@ -46,7 +42,7 @@ private static void AspNetCoreBuilder(AspNetCoreTraceInstrumentationOptions opti
}
else
{
// activity.SetTag("sessionId", "NULL");
activity.SetTag("sessionId", "NULL");
// activity.SetBaggage("sessionId", "NULL");
}
};
Expand All @@ -69,7 +65,7 @@ private static void AspNetCoreBuilder(AspNetCoreTraceInstrumentationOptions opti
}
else
{
// activity.SetTag("sessionId", "NULL");
activity.SetTag("sessionId", "NULL");
// activity.SetBaggage("sessionId", "NULL");
}
};
Expand Down Expand Up @@ -108,7 +104,7 @@ private static void HttpClientBuilder(HttpClientTraceInstrumentationOptions opti
}
else
{
// activity.SetTag("sessionId", "NULL");
activity.SetTag("sessionId", "NULL");
// activity.SetBaggage("sessionId", "NULL");
}
};
Expand Down Expand Up @@ -143,31 +139,12 @@ public static void AddOpenTelemetryInstrumentation(this IServiceCollection servi
.AddProcessor<LocationEnricher>()
.AddAspNetCoreInstrumentation(AspNetCoreBuilder)
.AddHttpClientInstrumentation(HttpClientBuilder)
// .AddSource("MongoDB.Driver.Core.Extensions.DiagnosticSources")
.AddConsoleExporter()
.AddOtlpExporter()
);

}

// private static void EnrichWithSession(this Activity activity, HttpContext httpContext)
// {

// // in progress

// string? sessionId = httpContext.Headers.TryGetValues("sessionId", out var values) ? values.FirstOrDefault() : null;
// if (sessionId != null)
// {
// activity.SetTag("SESSIONID HTTP RESPONSE", sessionId);
// }
// else
// {
// activity.SetTag("SESSIONID HTTP RESPONSE", "NULL");
// }


// }

internal class LocationEnricher(ILocationProvider locationProvider) : BaseProcessor<Activity>
{
public override async void OnEnd(Activity data)
Expand Down

0 comments on commit 168f4db

Please sign in to comment.