Skip to content

Commit

Permalink
Skip verbose logs when logger names start with our exporter package n…
Browse files Browse the repository at this point in the history
…ame (#40615)

* Skip export log when logger names start with our exporter package name

* Rename constant

* Add a todo
  • Loading branch information
heyams authored Jul 24, 2024
1 parent b1e19ed commit 12ece53
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/
class AzureMonitorLogRecordExporter implements LogRecordExporter {

private static final String EXPORTER_LOGGER_PREFIX = "com.azure.monitor.opentelemetry.exporter";
private static final ClientLogger LOGGER = new ClientLogger(AzureMonitorLogRecordExporter.class);
private static final OperationLogger OPERATION_LOGGER =
new OperationLogger(AzureMonitorLogRecordExporter.class, "Exporting log");
Expand Down Expand Up @@ -54,6 +55,10 @@ public CompletableResultCode export(Collection<LogRecordData> logs) {

List<TelemetryItem> telemetryItems = new ArrayList<>();
for (LogRecordData log : logs) {
// TODO (heya) consider using suppress_instrumentation https://github.com/open-telemetry/opentelemetry-java/pull/6546 later when available
if (log.getInstrumentationScopeInfo().getName().startsWith(EXPORTER_LOGGER_PREFIX)) {
continue;
}
LOGGER.verbose("exporting log: {}", log);
try {
String stack = log.getAttributes().get(SemanticAttributes.EXCEPTION_STACKTRACE);
Expand Down

0 comments on commit 12ece53

Please sign in to comment.