Skip to content
Merged
23 changes: 12 additions & 11 deletions instrumentation/logback/logback-appender-1.0/javaagent/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Settings for the Logback Appender instrumentation

| System property | Type | Default | Description |
|----------------------------------------------------------------------------------------|---------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `otel.instrumentation.logback-appender.experimental-log-attributes` | Boolean | `false` | Enable the capture of experimental log attributes `thread.name` and `thread.id`. |
| `otel.instrumentation.logback-appender.experimental.capture-code-attributes` | Boolean | `false` | Enable the capture of [source code attributes]. Note that capturing source code attributes at logging sites might add a performance overhead. |
| `otel.instrumentation.logback-appender.experimental.capture-marker-attribute` | Boolean | `false` | Enable the capture of Logback markers as attributes. |
| `otel.instrumentation.logback-appender.experimental.capture-key-value-pair-attributes` | Boolean | `false` | Enable the capture of Logback key value pairs as attributes. |
| `otel.instrumentation.logback-appender.experimental.capture-logger-context-attributes` | Boolean | `false` | Enable the capture of Logback logger context properties as attributes. |
| `otel.instrumentation.logback-appender.experimental.capture-arguments` | Boolean | `false` | Enable the capture of Logback logger arguments. |
| `otel.instrumentation.logback-appender.experimental.capture-logstash-attributes` | Boolean | `false` | Enable the capture of Logstash attributes, supported are those added to logs via `Markers.append()`, `Markers.appendEntries()`, `Markers.appendArray()` and `Markers.appendRaw()` methods. |
| `otel.instrumentation.logback-appender.experimental.capture-mdc-attributes` | String | | Comma separated list of MDC attributes to capture. Use the wildcard character `*` to capture all attributes. |
| `otel.instrumentation.logback-appender.experimental.capture-event-name` | Boolean | `false` | Enable moving the `event.name` attribute (captured by one of the other mechanisms of capturing attributes) to the log event name. |
| System property | Type | Default | Description |
|--------------------------------------------------------------------------------------------|---------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `otel.instrumentation.logback-appender.experimental-log-attributes` | Boolean | `false` | Enable the capture of experimental log attributes `thread.name` and `thread.id`. |
| `otel.instrumentation.logback-appender.experimental.capture-code-attributes` | Boolean | `false` | Enable the capture of [source code attributes]. Note that capturing source code attributes at logging sites might add a performance overhead. |
| `otel.instrumentation.logback-appender.experimental.capture-marker-attribute` | Boolean | `false` | Enable the capture of Logback markers as attributes. |
| `otel.instrumentation.logback-appender.experimental.capture-key-value-pair-attributes` | Boolean | `false` | Enable the capture of Logback key value pairs as attributes. |
| `otel.instrumentation.logback-appender.experimental.capture-logger-context-attributes` | Boolean | `false` | Enable the capture of Logback logger context properties as attributes. |
| `otel.instrumentation.logback-appender.experimental.capture-arguments` | Boolean | `false` | Enable the capture of Logback logger arguments. |
| `otel.instrumentation.logback-appender.experimental.capture-logstash-marker-attributes` | Boolean | `false` | Enable the capture of Logstash markers, supported are those added to logs via `Markers.append()`, `Markers.appendEntries()`, `Markers.appendArray()` and `Markers.appendRaw()` methods. |
| `otel.instrumentation.logback-appender.experimental.capture-logstash-structured-arguments` | Boolean | `false` | Enable the capture of Logstash StructuredArguments as attributes (e.g., `StructuredArguments.v()` and `StructuredArguments.keyValue()`). |
| `otel.instrumentation.logback-appender.experimental.capture-mdc-attributes` | String | | Comma separated list of MDC attributes to capture. Use the wildcard character `*` to capture all attributes. |
| `otel.instrumentation.logback-appender.experimental.capture-event-name` | Boolean | `false` | Enable moving the `event.name` attribute (captured by one of the other mechanisms of capturing attributes) to the log event name. |

[source code attributes]: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/general/attributes.md#source-code-attributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import io.opentelemetry.instrumentation.api.incubator.config.internal.InstrumentationConfig;
import io.opentelemetry.instrumentation.logback.appender.v1_0.internal.LoggingEventMapper;
import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig;
import io.opentelemetry.javaagent.bootstrap.internal.DeprecatedConfigProperties;
import java.util.List;

public final class LogbackSingletons {
Expand Down Expand Up @@ -39,9 +40,15 @@ public final class LogbackSingletons {
boolean captureArguments =
config.getBoolean(
"otel.instrumentation.logback-appender.experimental.capture-arguments", false);
boolean captureLogstashAttributes =
config.getBoolean(
boolean captureLogstashMarkerAttributes =
DeprecatedConfigProperties.getBoolean(
config,
"otel.instrumentation.logback-appender.experimental.capture-logstash-attributes",
"otel.instrumentation.logback-appender.experimental.capture-logstash-marker-attributes",
false);
boolean captureLogstashStructuredArguments =
config.getBoolean(
"otel.instrumentation.logback-appender.experimental.capture-logstash-structured-arguments",
false);
List<String> captureMdcAttributes =
config.getList(
Expand All @@ -60,7 +67,8 @@ public final class LogbackSingletons {
.setCaptureKeyValuePairAttributes(captureKeyValuePairAttributes)
.setCaptureLoggerContext(captureLoggerContext)
.setCaptureArguments(captureArguments)
.setCaptureLogstashAttributes(captureLogstashAttributes)
.setCaptureLogstashMarkerAttributes(captureLogstashMarkerAttributes)
.setCaptureLogstashStructuredArguments(captureLogstashStructuredArguments)
.setCaptureEventName(captureEventName)
.build();
}
Expand Down
25 changes: 13 additions & 12 deletions instrumentation/logback/logback-appender-1.0/library/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,19 @@ Settings can be configured in `logback.xml`, for example:

The available settings are:

| XML Element | Type | Default | Description |
|------------------------------------|---------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `captureExperimentalAttributes` | Boolean | `false` | Enable the capture of experimental log attributes `thread.name` and `thread.id`. |
| `captureCodeAttributes` | Boolean | `false` | Enable the capture of [source code attributes]. Note that capturing source code attributes at logging sites might add a performance overhead. |
| `captureMarkerAttribute` | Boolean | `false` | Enable the capture of Logback markers as attributes. |
| `captureKeyValuePairAttributes` | Boolean | `false` | Enable the capture of Logback key value pairs as attributes. |
| `captureLoggerContext` | Boolean | `false` | Enable the capture of Logback logger context properties as attributes. |
| `captureArguments` | Boolean | `false` | Enable the capture of Logback logger arguments. |
| `captureLogstashAttributes` | Boolean | `false` | Enable the capture of Logstash attributes, supported are those added to logs via `Markers.append()`, `Markers.appendEntries()`, `Markers.appendArray()` and `Markers.appendRaw()` methods. |
| `captureMdcAttributes` | String | | Comma separated list of MDC attributes to capture. Use the wildcard character `*` to capture all attributes. |
| `captureEventName` | Boolean | `false` | Enable moving the `event.name` attribute (captured by one of the other mechanisms of capturing attributes) to the log event name. |
| `numLogsCapturedBeforeOtelInstall` | Integer | 1000 | Log telemetry is emitted after the initialization of the OpenTelemetry Logback appender with an OpenTelemetry object. This setting allows you to modify the size of the cache used to replay the first logs. thread.id attribute is not captured. |
| XML Element | Type | Default | Description |
|--------------------------------------|---------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `captureExperimentalAttributes` | Boolean | `false` | Enable the capture of experimental log attributes `thread.name` and `thread.id`. |
| `captureCodeAttributes` | Boolean | `false` | Enable the capture of [source code attributes]. Note that capturing source code attributes at logging sites might add a performance overhead. |
| `captureMarkerAttribute` | Boolean | `false` | Enable the capture of Logback markers as attributes. |
| `captureKeyValuePairAttributes` | Boolean | `false` | Enable the capture of Logback key value pairs as attributes. |
| `captureLoggerContext` | Boolean | `false` | Enable the capture of Logback logger context properties as attributes. |
| `captureArguments` | Boolean | `false` | Enable the capture of Logback logger arguments. |
| `captureLogstashMarkerAttributes` | Boolean | `false` | Enable the capture of Logstash markers, supported are those added to logs via `Markers.append()`, `Markers.appendEntries()`, `Markers.appendArray()` and `Markers.appendRaw()` methods. |
| `captureLogstashStructuredArguments` | Boolean | `false` | Enable the capture of Logstash StructuredArguments as attributes (e.g., `StructuredArguments.v()` and `StructuredArguments.keyValue()`). |
| `captureMdcAttributes` | String | | Comma separated list of MDC attributes to capture. Use the wildcard character `*` to capture all attributes. |
| `captureEventName` | Boolean | `false` | Enable moving the `event.name` attribute (captured by one of the other mechanisms of capturing attributes) to the log event name. |
| `numLogsCapturedBeforeOtelInstall` | Integer | 1000 | Log telemetry is emitted after the initialization of the OpenTelemetry Logback appender with an OpenTelemetry object. This setting allows you to modify the size of the cache used to replay the first logs. thread.id attribute is not captured. |


[source code attributes]: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/general/attributes.md#source-code-attributes
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,30 @@ val latestDepTest = findProperty("testLatestDeps") as Boolean
testing {
suites {
val slf4j2ApiTest by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":instrumentation:logback:logback-appender-1.0:library"))
implementation("io.opentelemetry:opentelemetry-sdk-testing")
implementation(project(":testing-common"))

if (latestDepTest) {
implementation("ch.qos.logback:logback-classic:latest.release")
implementation("org.slf4j:slf4j-api:latest.release")
} else {
implementation("ch.qos.logback:logback-classic") {
version {
strictly("1.3.0")
}
}
implementation("org.slf4j:slf4j-api") {
version {
strictly("2.0.0")
}
}
}
}
}

val logstashMarkerTest by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":instrumentation:logback:logback-appender-1.0:library"))
implementation("io.opentelemetry:opentelemetry-sdk-testing")
Expand Down Expand Up @@ -103,6 +127,36 @@ testing {
}
}

val logstashStructuredArgsTest by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":instrumentation:logback:logback-appender-1.0:library"))
implementation("io.opentelemetry:opentelemetry-sdk-testing")
implementation(project(":testing-common"))

if (latestDepTest) {
implementation("ch.qos.logback:logback-classic:latest.release")
implementation("org.slf4j:slf4j-api:latest.release")
implementation("net.logstash.logback:logstash-logback-encoder:latest.release")
} else {
implementation("ch.qos.logback:logback-classic") {
version {
strictly("1.3.0")
}
}
implementation("org.slf4j:slf4j-api") {
version {
strictly("2.0.0")
}
}
implementation("net.logstash.logback:logstash-logback-encoder") {
version {
strictly("6.6")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StructuredArguments was introduced after LogstashMarker which is why separate test suite here

}
}
}
}
}

val asyncAppenderTest by registering(JvmTestSuite::class) {
dependencies {
implementation(project(":instrumentation:logback:logback-appender-1.0:library"))
Expand Down
Loading
Loading