Skip to content

Commit 1b5b1bc

Browse files
authored
Remove Trace and Log from Open Telemitery (#2456)
♻️ (ActivitySourceProvider.cs): comment out OpenTelemetry tracing and logging configuration The OpenTelemetry tracing and logging configuration is commented out to temporarily disable these features. This change is likely made to troubleshoot or isolate issues related to telemetry or to reduce overhead during development. The code is preserved for easy reactivation when needed.
2 parents 6a6e0e2 + 53242e4 commit 1b5b1bc

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

src/MigrationTools/Services/ActivitySourceProvider.cs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -144,22 +144,22 @@ public static IHostBuilder UseOpenTelemeter(this IHostBuilder builder, string ve
144144
Assembly entryAssembly = Assembly.GetEntryAssembly();
145145
string entryAssemblyName = entryAssembly?.GetName().Name;
146146
services.AddOpenTelemetry()
147-
.WithTracing(builder =>
148-
{
149-
builder
150-
.SetSampler(new AlwaysOnSampler())
151-
.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService(entryAssemblyName, serviceVersion: versionString))
152-
.AddSource(ActivitySourceProvider.ActivitySourceName) // Register your custom ActivitySource
153-
//.AddConsoleExporter() // Export traces to console
154-
.AddProcessor(new ActivitySourceProvider.ActivityFilteringProcessor())
155-
.AddHttpClientInstrumentation()
156-
.SetErrorStatusOnException()
157-
.AddAzureMonitorTraceExporter(options =>
158-
{
159-
options.ConnectionString = ActivitySourceProvider.GetConnectionString();
160-
161-
});
162-
})
147+
//.WithTracing(builder =>
148+
//{
149+
// builder
150+
// .SetSampler(new AlwaysOnSampler())
151+
// .SetResourceBuilder(ResourceBuilder.CreateDefault().AddService(entryAssemblyName, serviceVersion: versionString))
152+
// .AddSource(ActivitySourceProvider.ActivitySourceName) // Register your custom ActivitySource
153+
// //.AddConsoleExporter() // Export traces to console
154+
// .AddProcessor(new ActivitySourceProvider.ActivityFilteringProcessor())
155+
// .AddHttpClientInstrumentation()
156+
// .SetErrorStatusOnException()
157+
// .AddAzureMonitorTraceExporter(options =>
158+
// {
159+
// options.ConnectionString = ActivitySourceProvider.GetConnectionString();
160+
161+
// });
162+
//})
163163
.WithMetrics(builder =>
164164
{
165165
builder
@@ -175,17 +175,17 @@ public static IHostBuilder UseOpenTelemeter(this IHostBuilder builder, string ve
175175
options.ConnectionString = ActivitySourceProvider.GetConnectionString();
176176
});
177177
});
178-
services.AddLogging(loggingBuilder =>
179-
{
180-
loggingBuilder.AddOpenTelemetry(options =>
181-
{
182-
//options.AddConsoleExporter();
183-
options.AddAzureMonitorLogExporter(config =>
184-
{
185-
config.ConnectionString = ActivitySourceProvider.GetConnectionString();
186-
});
187-
});
188-
});
178+
//services.AddLogging(loggingBuilder =>
179+
//{
180+
// loggingBuilder.AddOpenTelemetry(options =>
181+
// {
182+
// //options.AddConsoleExporter();
183+
// options.AddAzureMonitorLogExporter(config =>
184+
// {
185+
// config.ConnectionString = ActivitySourceProvider.GetConnectionString();
186+
// });
187+
// });
188+
//});
189189
services.AddSingleton(sp => ActivitySourceProvider.GetActivitySource());
190190
});
191191

0 commit comments

Comments
 (0)