Skip to content

Commit 2cf74f3

Browse files
author
Timothy Mothra
authored
[AzureMonitorExporter] remove Telemetry and EventSource messages from Console Output (Azure#38016)
* introduce environment variable to opt-in to DebugWriter. Off by default. * remove environment variables. change to DEBUG only. * cleanup
1 parent d8a1e49 commit 2cf74f3

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Customizations/ApplicationInsightsRestClient.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,18 @@ internal HttpMessage CreateTrackRequest(IEnumerable<TelemetryItem> body)
8989
content.WriteNewLine();
9090
}
9191

92+
#if DEBUG
9293
TelemetryDebugWriter.WriteTelemetry(content);
94+
#endif
9395

9496
return CreateRequest(RequestContent.Create(content.ToBytes()));
9597
}
9698

9799
internal HttpMessage CreateTrackRequest(ReadOnlyMemory<byte> body)
98100
{
101+
#if DEBUG
99102
TelemetryDebugWriter.WriteTelemetryFromStorage(body);
103+
#endif
100104

101105
return CreateRequest(RequestContent.Create(body));
102106
}

sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Diagnostics/AzureMonitorExporterEventSource.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ internal sealed class AzureMonitorExporterEventSource : EventSource
3737
internal const string EventSourceName = "OpenTelemetry-AzureMonitor-Exporter";
3838

3939
internal static readonly AzureMonitorExporterEventSource Log = new AzureMonitorExporterEventSource();
40+
#if DEBUG
4041
internal static readonly AzureMonitorExporterEventListener Listener = new AzureMonitorExporterEventListener();
42+
#endif
4143

4244
[NonEvent]
4345
[MethodImpl(MethodImplOptions.AggressiveInlining)]

0 commit comments

Comments
 (0)