Skip to content

Commit

Permalink
Add capability to turn off logback instrumentation (#3082)
Browse files Browse the repository at this point in the history
  • Loading branch information
heyams authored May 18, 2023
1 parent d76835e commit 7b98085
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public Map<String, String> apply(ConfigProperties otelConfig) {
"applicationinsights.internal.micrometer.step.millis",
Long.toString(SECONDS.toMillis(configuration.metricIntervalSeconds)));

enableInstrumentations(configuration, properties);
enableInstrumentations(otelConfig, configuration, properties);

if (!configuration.preview.captureControllerSpans) {
properties.put(
Expand Down Expand Up @@ -116,7 +116,8 @@ public Map<String, String> apply(ConfigProperties otelConfig) {
return properties;
}

private static void enableInstrumentations(Configuration config, Map<String, String> properties) {
private static void enableInstrumentations(
ConfigProperties otelConfig, Configuration config, Map<String, String> properties) {
properties.put("otel.instrumentation.common.default-enabled", "false");

properties.put("otel.instrumentation.experimental.span-suppression-strategy", "client");
Expand Down Expand Up @@ -148,7 +149,9 @@ private static void enableInstrumentations(Configuration config, Map<String, Str
properties.put("otel.instrumentation.liberty.enabled", "true");
properties.put("otel.instrumentation.liberty-dispatcher.enabled", "true");
properties.put("otel.instrumentation.log4j-appender.enabled", "true");
properties.put("otel.instrumentation.logback-appender.enabled", "true");
if (otelConfig.getBoolean("otel.instrumentation.logback-appender.enabled", true)) {
properties.put("otel.instrumentation.logback-appender.enabled", "true");
}
properties.put("otel.instrumentation.log4j-mdc.enabled", "true");
properties.put("otel.instrumentation.log4j-context-data.enabled", "true");
properties.put("otel.instrumentation.logback-mdc.enabled", "true");
Expand Down

0 comments on commit 7b98085

Please sign in to comment.