Add configuration type to metadata (#13825)

This commit is contained in:
Jay DeLuca 2025-05-09 15:44:23 -04:00 committed by GitHub
parent 03dffb1e88
commit 61c1f63983
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 160 additions and 19 deletions

View File

@ -5,6 +5,8 @@
libraries:
activej:
- name: activej-http-6.0
description: This instrumentation provides SERVER spans and metrics for the ActiveJ
HTTP server.
source_path: instrumentation/activej-http-6.0
minimum_java_version: 17
scope:
@ -42,6 +44,8 @@ libraries:
- com.typesafe.akka:akka-actor_2.13:[2.3,)
alibaba:
- name: alibaba-druid-1.0
description: |
The Alibaba Druid instrumentation generates database connection pool metrics for druid data sources.
source_path: instrumentation/alibaba-druid-1.0
scope:
name: io.opentelemetry.alibaba-druid-1.0
@ -149,6 +153,17 @@ libraries:
target_versions:
javaagent:
- org.asynchttpclient:async-http-client:[2.0.0,)
avaje:
- name: avaje-jex-3.0
description: |
This instrumentation does not emit telemetry on its own. Instead, it hooks into the Avaje Jex Context to extract the HTTP route and attach it to existing SERVER spans and HTTP server metrics.
source_path: instrumentation/avaje-jex-3.0
minimum_java_version: 21
scope:
name: io.opentelemetry.avaje-jex-3.0
target_versions:
javaagent:
- io.avaje:avaje-jex:[3.0,)
aws:
- name: aws-lambda-events-2.2
source_path: instrumentation/aws-lambda/aws-lambda-events-2.2
@ -250,7 +265,8 @@ libraries:
configurations:
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
description: Enables statement sanitization for database queries.
default: 'true'
type: boolean
default: true
- name: cassandra-4.4
description: |
Instruments the Cassandra database client, providing database client spans and metrics for Cassandra queries.
@ -265,7 +281,8 @@ libraries:
configurations:
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
description: Enables statement sanitization for database queries.
default: 'true'
type: boolean
default: true
- name: cassandra-3.0
description: |
Instruments the Cassandra database client, providing database client spans and metrics for Cassandra queries.
@ -278,7 +295,8 @@ libraries:
configurations:
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
description: Enables statement sanitization for database queries.
default: 'true'
type: boolean
default: true
clickhouse:
- name: clickhouse-client-0.5
description: Instruments the V1 ClickHouseClient, providing database client spans
@ -292,7 +310,8 @@ libraries:
configurations:
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
description: Enables statement sanitization for database queries.
default: 'true'
type: boolean
default: true
couchbase:
- name: couchbase-3.1.6
source_path: instrumentation/couchbase/couchbase-3.1.6
@ -415,10 +434,12 @@ libraries:
configurations:
- name: otel.instrumentation.executors.include
description: List of Executor subclasses to be instrumented.
type: list
default: ''
- name: otel.instrumentation.executors.include-all
description: Whether to instrument all classes that implement the Executor interface.
default: 'false'
type: boolean
default: false
finagle:
- name: finagle-http-23.11
source_path: instrumentation/finagle-http-23.11
@ -741,7 +762,7 @@ libraries:
- name: jdbc
description: |
The JDBC instrumentation provides database client spans and metrics. Each call produces a span named after the SQL verb, enriched with standard DB client attributes (system, database, operation, sanitized statement, peer address) and error details if an exception occurs.
disabled_by_default: true
There is also a "jdbc-datasource" instrumentation that creates spans for datasource connections, but is disabled by default due to the volume of telemetry produced.
source_path: instrumentation/jdbc
scope:
name: io.opentelemetry.jdbc
@ -752,14 +773,21 @@ libraries:
- name: otel.instrumentation.jdbc.statement-sanitizer.enabled
description: Enables statement sanitization for database queries. Takes precedent
to otel.instrumentation.common.db-statement-sanitizer.enabled.
default: 'true'
type: boolean
default: true
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
description: Enables statement sanitization for database queries.
default: 'true'
type: boolean
default: true
- name: otel.instrumentation.common.peer-service-mapping
description: Used to specify a mapping from host names or IP addresses to peer
services.
type: map
default: ''
- name: otel.instrumentation.jdbc-datasource.enabled
description: Enables instrumentation of JDBC datasource connections.
type: boolean
default: false
jedis:
- name: jedis-1.4
source_path: instrumentation/jedis/jedis-1.4
@ -916,6 +944,15 @@ libraries:
target_versions:
javaagent:
- org.apache.kafka:kafka-clients:[0.11.0.0,)
configurations:
- name: otel.instrumentation.kafka.producer-propagation.enabled
description: Enable context propagation for kafka message producers.
type: boolean
default: true
- name: otel.instrumentation.kafka.experimental-span-attributes
description: Enables the capture of the experimental consumer attribute "kafka.record.queue_time_ms"
type: boolean
default: false
kotlinx:
- name: kotlinx-coroutines
source_path: instrumentation/kotlinx-coroutines
@ -1169,6 +1206,14 @@ libraries:
javaagent:
- com.squareup.okhttp:okhttp:[2.2,3)
opensearch:
- name: opensearch-rest-3.0
source_path: instrumentation/opensearch/opensearch-rest-3.0
minimum_java_version: 11
scope:
name: io.opentelemetry.opensearch-rest-3.0
target_versions:
javaagent:
- org.opensearch.client:opensearch-rest-client:[3.0,)
- name: opensearch-rest-1.0
source_path: instrumentation/opensearch/opensearch-rest-1.0
minimum_java_version: 11
@ -1176,7 +1221,7 @@ libraries:
name: io.opentelemetry.opensearch-rest-1.0
target_versions:
javaagent:
- org.opensearch.client:opensearch-rest-client:[1.0,)
- org.opensearch.client:opensearch-rest-client:[1.0,3.0)
oracle:
- name: oracle-ucp-11.2
source_path: instrumentation/oracle-ucp-11.2

View File

@ -69,7 +69,7 @@ public class SpringWebInstrumentationModule extends InstrumentationModule
* Name: The scope name of the instrumentation, `io.opentelemetry.{instrumentation name}`
* configurations settings
* List of settings that are available for the instrumentation module
* Each setting has a name, description, and default value
* Each setting has a name, description, type, and default value
## Methodology
@ -87,6 +87,7 @@ classification: internal # instrumentation classification: library | inte
configurations:
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
description: Enables statement sanitization for database queries.
type: boolean # boolean | string | list | map
default: true
```

View File

@ -6,10 +6,26 @@
package io.opentelemetry.instrumentation.docs.internal;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
* Represents a configuration option available for an instrumentation. This class is internal and is
* hence not for public use. Its APIs are unstable and can change at any time.
*/
public record ConfigurationOption(
String name, String description, @JsonProperty("default") String defaultValue) {}
String name,
String description,
@JsonProperty("default") String defaultValue,
ConfigurationType type) {
public ConfigurationOption {
Objects.requireNonNull(name, "name");
Objects.requireNonNull(description, "description");
Objects.requireNonNull(defaultValue, "defaultValue");
Objects.requireNonNull(type, "type");
if (name.isBlank() || description.isBlank()) {
throw new IllegalArgumentException("ConfigurationOption name/description cannot be blank");
}
}
}

View File

@ -0,0 +1,34 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.instrumentation.docs.internal;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Locale;
/**
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
* any time.
*/
public enum ConfigurationType {
BOOLEAN("boolean"),
STRING("string"),
MAP("map"),
LIST("list");
ConfigurationType(String unused) {}
@JsonCreator
public static ConfigurationType from(String value) {
return ConfigurationType.valueOf(value.toUpperCase(Locale.ROOT));
}
@JsonValue
@Override
public String toString() {
return name().toLowerCase(Locale.ROOT);
}
}

View File

@ -9,6 +9,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import io.opentelemetry.instrumentation.docs.internal.ConfigurationOption;
import io.opentelemetry.instrumentation.docs.internal.ConfigurationType;
import io.opentelemetry.instrumentation.docs.internal.InstrumentationClassification;
import io.opentelemetry.instrumentation.docs.internal.InstrumentationMetaData;
import io.opentelemetry.instrumentation.docs.internal.InstrumentationModule;
@ -144,12 +145,18 @@ public class YamlHelper {
}
if (module.getMetadata() != null && !module.getMetadata().getConfigurations().isEmpty()) {
List<Map<String, String>> configurations = new ArrayList<>();
List<Map<String, Object>> configurations = new ArrayList<>();
for (ConfigurationOption configuration : module.getMetadata().getConfigurations()) {
Map<String, String> conf = new LinkedHashMap<>();
Map<String, Object> conf = new LinkedHashMap<>();
conf.put("name", configuration.name());
conf.put("description", configuration.description());
conf.put("default", configuration.defaultValue());
conf.put("type", configuration.type().toString());
if (configuration.type().equals(ConfigurationType.BOOLEAN)) {
conf.put("default", Boolean.parseBoolean(configuration.defaultValue()));
} else {
conf.put("default", configuration.defaultValue());
}
configurations.add(conf);
}
moduleMap.put("configurations", configurations);

View File

@ -9,6 +9,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import com.fasterxml.jackson.core.JsonProcessingException;
import io.opentelemetry.instrumentation.docs.internal.ConfigurationOption;
import io.opentelemetry.instrumentation.docs.internal.ConfigurationType;
import io.opentelemetry.instrumentation.docs.internal.InstrumentationClassification;
import io.opentelemetry.instrumentation.docs.internal.InstrumentationMetaData;
import io.opentelemetry.instrumentation.docs.internal.InstrumentationModule;
@ -112,7 +113,8 @@ class YamlHelperTest {
new ConfigurationOption(
"otel.instrumentation.spring-web-6.0.enabled",
"Enables or disables Spring Web 6.0 instrumentation.",
"true")));
"true",
ConfigurationType.BOOLEAN)));
modules.add(
new InstrumentationModule.Builder()
@ -180,7 +182,8 @@ class YamlHelperTest {
configurations:
- name: otel.instrumentation.spring-web-6.0.enabled
description: Enables or disables Spring Web 6.0 instrumentation.
default: 'true'
type: boolean
default: true
internal:
- name: internal-application-logger
source_path: instrumentation/internal/internal-application-logger
@ -209,6 +212,7 @@ class YamlHelperTest {
configurations:
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
description: Enables statement sanitization for database queries.
type: boolean
default: true
""";
@ -262,6 +266,7 @@ class YamlHelperTest {
configurations:
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
description: Enables statement sanitization for database queries.
type: boolean
default: true
""";
InstrumentationMetaData metadata = YamlHelper.metaDataParser(input);
@ -276,5 +281,6 @@ class YamlHelperTest {
assertThat(config.description())
.isEqualTo("Enables statement sanitization for database queries.");
assertThat(config.defaultValue()).isEqualTo("true");
assertThat(config.type()).isEqualTo(ConfigurationType.BOOLEAN);
}
}

View File

@ -0,0 +1 @@
description: This instrumentation provides SERVER spans and metrics for the ActiveJ HTTP server.

View File

@ -0,0 +1,3 @@
description: >
The Alibaba Druid instrumentation generates database connection pool metrics for druid data
sources.

View File

@ -0,0 +1,4 @@
description: >
This instrumentation does not emit telemetry on its own. Instead, it hooks into the Avaje Jex
Context to extract the HTTP route and attach it to existing SERVER spans and HTTP server
metrics.

View File

@ -4,4 +4,5 @@ description: >
configurations:
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
description: Enables statement sanitization for database queries.
type: boolean
default: true

View File

@ -4,4 +4,5 @@ description: >
configurations:
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
description: Enables statement sanitization for database queries.
type: boolean
default: true

View File

@ -4,4 +4,5 @@ description: >
configurations:
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
description: Enables statement sanitization for database queries.
type: boolean
default: true

View File

@ -2,4 +2,5 @@ description: Instruments the V1 ClickHouseClient, providing database client span
configurations:
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
description: Enables statement sanitization for database queries.
type: boolean
default: true

View File

@ -8,7 +8,9 @@ description: >
configurations:
- name: otel.instrumentation.executors.include
description: List of Executor subclasses to be instrumented.
type: list
default: ""
- name: otel.instrumentation.executors.include-all
description: Whether to instrument all classes that implement the Executor interface.
type: boolean
default: false

View File

@ -1,16 +1,25 @@
disabled_by_default: true
description: >
The JDBC instrumentation provides database client spans and metrics. Each call produces a span
named after the SQL verb, enriched with standard DB client attributes (system, database,
operation, sanitized statement, peer address) and error details if an exception occurs.
There is also a "jdbc-datasource" instrumentation that creates spans for datasource connections,
but is disabled by default due to the volume of telemetry produced.
configurations:
- name: otel.instrumentation.jdbc.statement-sanitizer.enabled
description: Enables statement sanitization for database queries. Takes precedent to
otel.instrumentation.common.db-statement-sanitizer.enabled.
type: boolean
default: true
- name: otel.instrumentation.common.db-statement-sanitizer.enabled
description: Enables statement sanitization for database queries.
type: boolean
default: true
- name: otel.instrumentation.common.peer-service-mapping
description: Used to specify a mapping from host names or IP addresses to peer services.
type: map
default: ""
- name: otel.instrumentation.jdbc-datasource.enabled
description: Enables instrumentation of JDBC datasource connections.
type: boolean
default: false

View File

@ -0,0 +1,9 @@
configurations:
- name: otel.instrumentation.kafka.producer-propagation.enabled
description: Enable context propagation for kafka message producers.
type: boolean
default: true
- name: otel.instrumentation.kafka.experimental-span-attributes
description: Enables the capture of the experimental consumer attribute "kafka.record.queue_time_ms"
type: boolean
default: false