From ff91c28d2092c601c479ac9f6743d192c96fb627 Mon Sep 17 00:00:00 2001 From: Jay DeLuca Date: Wed, 30 Jul 2025 15:30:12 -0400 Subject: [PATCH] Add descriptions and metadata for spring modules (#14309) --- docs/instrumentation-list.yaml | 735 +++++++++++++++++- instrumentation-docs/collect.sh | 27 +- instrumentation-docs/readme.md | 2 +- .../docs/InstrumentationAnalyzer.java | 3 +- .../docs/parsers/SpanParser.java | 3 +- .../aws-sdk/aws-sdk-1.11/metadata.yaml | 4 +- .../aws-sdk/aws-sdk-2.2/metadata.yaml | 4 +- .../dropwizard-views-0.7/metadata.yaml | 4 +- .../kafka-clients-0.11/metadata.yaml | 4 +- .../javaagent/build.gradle.kts | 3 + .../openai/openai-java-1.1/metadata.yaml | 9 + instrumentation/spring/README.md | 2 + .../javaagent/build.gradle.kts | 4 + .../spring/spring-batch-3.0/metadata.yaml | 14 + .../metadata.yaml | 3 + .../spring-boot-autoconfigure/README.md | 5 +- .../spring-boot-autoconfigure/metadata.yaml | 4 + .../spring-boot-resources/metadata.yaml | 14 + .../spring/spring-cloud-aws-3.0/metadata.yaml | 4 + .../spring-cloud-gateway-2.0/metadata.yaml | 11 + .../spring-cloud-gateway-2.2/metadata.yaml | 11 + .../javaagent/build.gradle.kts | 7 + .../spring/spring-core-2.0/metadata.yaml | 5 + .../javaagent/build.gradle.kts | 4 + .../spring-data/spring-data-1.8/metadata.yaml | 4 + .../javaagent/build.gradle.kts | 5 + .../spring-integration-4.1/metadata.yaml | 18 + .../spring-jms-2.0/javaagent/build.gradle.kts | 2 + .../spring-jms/spring-jms-2.0/metadata.yaml | 12 + .../spring-jms-6.0/javaagent/build.gradle.kts | 2 + .../spring-jms/spring-jms-6.0/metadata.yaml | 12 + .../javaagent/build.gradle.kts | 8 + .../spring/spring-kafka-2.7/metadata.yaml | 16 + .../javaagent/build.gradle.kts | 6 +- .../spring/spring-pulsar-1.0/metadata.yaml | 17 + .../pulsar/v1_0/AbstractSpringPulsarTest.java | 11 +- .../javaagent/build.gradle.kts | 2 + .../spring/spring-rabbit-1.0/metadata.yaml | 6 + .../spring-rmi-4.0/javaagent/build.gradle.kts | 2 + .../spring/spring-rmi-4.0/metadata.yaml | 1 + .../javaagent/build.gradle.kts | 19 +- .../scheduling/v3_1/SpringSchedulingTest.java | 16 +- .../spring-scheduling-3.1/metadata.yaml | 6 + .../library/build.gradle.kts | 6 + .../spring-security-config-6.0/metadata.yaml | 26 + .../spring-web-3.1/library/build.gradle.kts | 7 + .../spring-web/spring-web-3.1/metadata.yaml | 4 + .../spring-web/spring-web-6.0/metadata.yaml | 1 + .../javaagent/build.gradle.kts | 8 +- .../spring-webflux-5.0/metadata.yaml | 8 + .../library/build.gradle.kts | 7 + .../spring-webflux-5.3/metadata.yaml | 3 + .../javaagent/build.gradle.kts | 31 +- .../spring-webmvc-3.1/metadata.yaml | 17 + .../library/build.gradle.kts | 7 + .../spring-webmvc-5.3/metadata.yaml | 4 + .../javaagent/build.gradle.kts | 30 +- .../spring-webmvc-6.0/metadata.yaml | 17 + .../boot/AbstractSpringBootBasedTest.java | 13 +- 59 files changed, 1171 insertions(+), 69 deletions(-) create mode 100644 instrumentation/openai/openai-java-1.1/metadata.yaml create mode 100644 instrumentation/spring/spring-boot-autoconfigure/metadata.yaml create mode 100644 instrumentation/spring/spring-boot-resources/metadata.yaml create mode 100644 instrumentation/spring/spring-cloud-aws-3.0/metadata.yaml create mode 100644 instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-2.0/metadata.yaml create mode 100644 instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-2.2/metadata.yaml create mode 100644 instrumentation/spring/spring-core-2.0/metadata.yaml create mode 100644 instrumentation/spring/spring-data/spring-data-1.8/metadata.yaml create mode 100644 instrumentation/spring/spring-integration-4.1/metadata.yaml create mode 100644 instrumentation/spring/spring-jms/spring-jms-2.0/metadata.yaml create mode 100644 instrumentation/spring/spring-jms/spring-jms-6.0/metadata.yaml create mode 100644 instrumentation/spring/spring-kafka-2.7/metadata.yaml create mode 100644 instrumentation/spring/spring-pulsar-1.0/metadata.yaml create mode 100644 instrumentation/spring/spring-rabbit-1.0/metadata.yaml create mode 100644 instrumentation/spring/spring-rmi-4.0/metadata.yaml create mode 100644 instrumentation/spring/spring-scheduling-3.1/metadata.yaml create mode 100644 instrumentation/spring/spring-security-config-6.0/metadata.yaml create mode 100644 instrumentation/spring/spring-web/spring-web-3.1/metadata.yaml create mode 100644 instrumentation/spring/spring-web/spring-web-6.0/metadata.yaml create mode 100644 instrumentation/spring/spring-webflux/spring-webflux-5.0/metadata.yaml create mode 100644 instrumentation/spring/spring-webflux/spring-webflux-5.3/metadata.yaml create mode 100644 instrumentation/spring/spring-webmvc/spring-webmvc-3.1/metadata.yaml create mode 100644 instrumentation/spring/spring-webmvc/spring-webmvc-5.3/metadata.yaml create mode 100644 instrumentation/spring/spring-webmvc/spring-webmvc-6.0/metadata.yaml diff --git a/docs/instrumentation-list.yaml b/docs/instrumentation-list.yaml index ce84a39bc1..a27e3541d8 100644 --- a/docs/instrumentation-list.yaml +++ b/docs/instrumentation-list.yaml @@ -935,7 +935,8 @@ libraries: type: boolean default: false - name: otel.instrumentation.messaging.experimental.receive-telemetry.enabled - description: Enables experimental receive telemetry for AWS SDK instrumentation. + description: | + Enables experimental receive telemetry, which will cause consumers to start a new trace, with only a span link connecting it to the producer trace. type: boolean default: false - name: otel.instrumentation.messaging.experimental.capture-headers @@ -977,7 +978,8 @@ libraries: - software.amazon.awssdk:lambda:2.2.0 configurations: - name: otel.instrumentation.messaging.experimental.receive-telemetry.enabled - description: Enables experimental receive telemetry for AWS SDK instrumentation. + description: | + Enables experimental receive telemetry, which will cause consumers to start a new trace, with only a span link connecting it to the producer trace. type: boolean default: false - name: otel.instrumentation.messaging.experimental.capture-headers @@ -1324,11 +1326,11 @@ libraries: - io.dropwizard:dropwizard-views:(,3.0.0) configurations: - name: otel.instrumentation.common.experimental.view-telemetry.enabled - description: Enables experimental view telemetry. + description: Enables the creation of experimental view (INTERNAL) spans. type: boolean default: false - name: otel.instrumentation.common.experimental.controller-telemetry.enabled - description: Enables experimental controller telemetry. + description: Enables the creation of experimental controller (INTERNAL) spans. type: boolean default: false elasticsearch: @@ -2463,12 +2465,13 @@ libraries: type: list default: '' - name: otel.instrumentation.messaging.experimental.receive-telemetry.enabled - description: Enables experimental receive telemetry for Kafka instrumentation. + description: | + Enables experimental receive telemetry, which will cause consumers to start a new trace, with only a span link connecting it to the producer trace. type: boolean default: false - name: kafka-clients-2.6 description: | - This instrumentation provides a library integeration that enables messaging spans and metrics for Apache Kafka 2.6+ clients. + This instrumentation provides a library integration that enables messaging spans and metrics for Apache Kafka 2.6+ clients. source_path: instrumentation/kafka/kafka-clients/kafka-clients-2.6 scope: name: io.opentelemetry.kafka-clients-2.6 @@ -2881,6 +2884,88 @@ libraries: type: STRING - name: server.port type: LONG + openai: + - name: openai-java-1.1 + description: This instrumentation enables Gen AI client spans and metrics for + OpenAI Java SDK 1.1+. + source_path: instrumentation/openai/openai-java-1.1 + scope: + name: io.opentelemetry.openai-java-1.1 + target_versions: + javaagent: + - com.openai:openai-java:[1.1.0,) + library: + - com.openai:openai-java:1.1.0 + configurations: + - name: otel.instrumentation.genai.capture-message-content + description: | + Enables including the full content of user and assistant messages in emitted log events. Note that full content can have data privacy and size concerns, and care should be taken when enabling this. + type: boolean + default: false + telemetry: + - when: default + metrics: + - name: gen_ai.client.operation.duration + description: GenAI operation duration. + type: HISTOGRAM + unit: s + attributes: + - name: gen_ai.operation.name + type: STRING + - name: gen_ai.request.model + type: STRING + - name: gen_ai.response.model + type: STRING + - name: gen_ai.system + type: STRING + - name: gen_ai.client.token.usage + description: Measures number of input and output tokens used. + type: HISTOGRAM + unit: token + attributes: + - name: gen_ai.operation.name + type: STRING + - name: gen_ai.request.model + type: STRING + - name: gen_ai.response.model + type: STRING + - name: gen_ai.system + type: STRING + - name: gen_ai.token.type + type: STRING + spans: + - span_kind: INTERNAL + attributes: + - name: gen_ai.operation.name + type: STRING + - name: gen_ai.request.frequency_penalty + type: DOUBLE + - name: gen_ai.request.max_tokens + type: LONG + - name: gen_ai.request.model + type: STRING + - name: gen_ai.request.presence_penalty + type: DOUBLE + - name: gen_ai.request.seed + type: LONG + - name: gen_ai.request.stop_sequences + type: STRING_ARRAY + - name: gen_ai.request.temperature + type: DOUBLE + - name: gen_ai.request.top_p + type: DOUBLE + - name: gen_ai.response.finish_reasons + type: STRING_ARRAY + - name: gen_ai.response.id + type: STRING + - name: gen_ai.response.model + type: STRING + - name: gen_ai.system + type: STRING + - name: gen_ai.usage.input_tokens + type: LONG + - name: gen_ai.usage.output_tokens + type: LONG opensearch: - name: opensearch-rest-1.0 source_path: instrumentation/opensearch/opensearch-rest-1.0 @@ -3565,6 +3650,8 @@ libraries: - com.sparkjava:spark-core:[2.3,) spring: - name: spring-batch-3.0 + description: This instrumentation enables INTERNAL spans for jobs run by the Spring + Batch framework. disabled_by_default: true source_path: instrumentation/spring/spring-batch-3.0 scope: @@ -3572,7 +3659,31 @@ libraries: target_versions: javaagent: - org.springframework.batch:spring-batch-core:[3.0.0.RELEASE,5) + configurations: + - name: otel.instrumentation.spring-batch.experimental-span-attributes + description: Adds the experimental attribute `job.system` to spans. + type: boolean + default: false + - name: otel.instrumentation.spring-batch.experimental.chunk.new-trace + description: When enabled, a new root span will be created for each chunk processing. + Please note that this may lead to a high number of spans being created. + type: boolean + default: false + - name: otel.instrumentation.spring-batch.item.enabled + description: When enabled, spans will be created for each item processed. Please + note that this may lead to a high number of spans being created. + type: boolean + default: false + telemetry: + - when: otel.instrumentation.spring-batch.experimental-span-attributes=true + spans: + - span_kind: INTERNAL + attributes: + - name: job.system + type: STRING - name: spring-boot-actuator-autoconfigure-2.0 + description: | + This instrumentation configures the OpenTelemetry Micrometer bridge to receive metrics from Spring Boot Actuator. It does not produce telemetry on its own. disabled_by_default: true source_path: instrumentation/spring/spring-boot-actuator-autoconfigure-2.0 scope: @@ -3581,10 +3692,23 @@ libraries: javaagent: - org.springframework.boot:spring-boot-actuator-autoconfigure:[2.0.0.RELEASE,) - name: spring-boot-resources + description: | + This instrumentation automatically detects the `service.name` and `service.version` for Spring Boot applications and sets them as resource attributes. + It uses the following strategies (first successful wins): + - Check for the SPRING_APPLICATION_NAME environment variable + - Check for spring.application.name system property + - Check for application.properties file on the classpath + - Check for application.properties in the current working dir + - Check for application.yml on the classpath + - Check for application.yml in the current working dir + - Check for --spring.application.name program argument (not jvm arg) via ProcessHandle + - Check for --spring.application.name program argument via sun.java.command system property source_path: instrumentation/spring/spring-boot-resources scope: name: io.opentelemetry.spring-boot-resources - name: spring-cloud-aws-3.0 + description: | + This instrumentation enhances tracing for Spring Cloud AWS. It augments the existing AWS SDK instrumentation by providing higher-level tracing for SQS operations, capturing details specific to Spring Cloud AWS SQS usage and linking them to the underlying AWS SDK traces. source_path: instrumentation/spring/spring-cloud-aws-3.0 minimum_java_version: 17 scope: @@ -3593,13 +3717,23 @@ libraries: javaagent: - io.awspring.cloud:spring-cloud-aws-sqs:[3.0.0,) - name: spring-cloud-gateway-2.0 + description: | + This instrumentation enhances tracing for Spring Cloud Gateway. It does not generate new telemetry on its own, but rather enriches existing traces produced by other instrumentations like Netty and Spring WebFlux with Spring Cloud Gateway-specific attributes. source_path: instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-2.0 scope: name: io.opentelemetry.spring-cloud-gateway-2.0 target_versions: javaagent: - org.springframework.cloud:spring-cloud-starter-gateway:[2.0.0.RELEASE,] + configurations: + - name: otel.instrumentation.spring-cloud-gateway.experimental-span-attributes + description: | + Enables experimental `spring-cloud-gateway.route` attributes (e.g., `spring-cloud-gateway.route.id`, `spring-cloud-gateway.route.uri`, etc.) on spans. + type: boolean + default: false - name: spring-core-2.0 + description: | + This instrumentation ensures proper context propagation for asynchronous operations within Spring Core. It modifies how tasks are submitted and executed to ensure that spans created by other instrumentations are correctly linked across thread boundaries, rather than generating any new telemetry itself. source_path: instrumentation/spring/spring-core-2.0 minimum_java_version: 17 scope: @@ -3608,6 +3742,8 @@ libraries: javaagent: - org.springframework:spring-core:[2.0,] - name: spring-data-1.8 + description: | + This instrumentation enhances tracing for Spring Data operations. It works in conjunction with other instrumentations, such as JDBC, to provide additional context and details for database interactions initiated through Spring Data. source_path: instrumentation/spring/spring-data/spring-data-1.8 scope: name: io.opentelemetry.spring-data-1.8 @@ -3615,7 +3751,18 @@ libraries: javaagent: - org.springframework:spring-aop:[1.2,] - org.springframework.data:spring-data-commons:[1.8.0.RELEASE,] + telemetry: + - when: default + spans: + - span_kind: INTERNAL + attributes: + - name: code.function + type: STRING + - name: code.namespace + type: STRING - name: spring-integration-4.1 + description: This instrumentation enables PRODUCER and CONSUMER spans for Spring + Integration. source_path: instrumentation/spring/spring-integration-4.1 scope: name: io.opentelemetry.spring-integration-4.1 @@ -3624,14 +3771,72 @@ libraries: - org.springframework.integration:spring-integration-core:[4.1.0.RELEASE,) library: - org.springframework.integration:spring-integration-core:[4.1.0.RELEASE,5.+) + configurations: + - name: otel.instrumentation.spring-integration.producer.enabled + description: | + Create producer spans when messages are sent to an output channel. Enable when you're using a messaging library that doesn't have its own instrumentation for generating producer spans. Note that the detection of output channels only works for Spring Cloud Stream `DirectWithAttributesChannel`. + type: boolean + default: false + - name: otel.instrumentation.spring-integration.global-channel-interceptor-patterns + description: An array of Spring channel name patterns that will be intercepted. + type: list + default: '*' + - name: otel.instrumentation.messaging.experimental.capture-headers + description: Allows configuring headers to capture as span attributes. + type: list + default: '' + telemetry: + - when: default + spans: + - span_kind: CONSUMER + attributes: + - name: messaging.operation + type: STRING + - when: otel.instrumentation.spring-integration.producer.enabled=true + spans: + - span_kind: CONSUMER + attributes: + - name: messaging.operation + type: STRING + - span_kind: PRODUCER + attributes: + - name: messaging.operation + type: STRING - name: spring-jms-2.0 + description: This instrumentation enables the generation of CONSUMER spans for + Spring JMS. source_path: instrumentation/spring/spring-jms/spring-jms-2.0 scope: name: io.opentelemetry.spring-jms-2.0 target_versions: javaagent: - org.springframework:spring-jms:[2.0,6) + configurations: + - name: otel.instrumentation.messaging.experimental.receive-telemetry.enabled + description: | + Enables experimental receive telemetry, which will cause consumers to start a new trace, with only a span link connecting it to the producer trace. + type: boolean + default: false + - name: otel.instrumentation.messaging.experimental.capture-headers + description: A comma-separated list of header names to capture as span attributes. + type: list + default: '' + telemetry: + - when: default + spans: + - span_kind: CONSUMER + attributes: + - name: messaging.destination.name + type: STRING + - name: messaging.message.id + type: STRING + - name: messaging.operation + type: STRING + - name: messaging.system + type: STRING - name: spring-jms-6.0 + description: This instrumentation enables the generation of CONSUMER spans for + Spring JMS. source_path: instrumentation/spring/spring-jms/spring-jms-6.0 minimum_java_version: 17 scope: @@ -3639,14 +3844,104 @@ libraries: target_versions: javaagent: - org.springframework:spring-jms:[6.0.0,) + configurations: + - name: otel.instrumentation.messaging.experimental.receive-telemetry.enabled + description: | + Enables experimental receive telemetry, which will cause consumers to start a new trace, with only a span link connecting it to the producer trace. + type: boolean + default: false + - name: otel.instrumentation.messaging.experimental.capture-headers + description: A comma-separated list of header names to capture as span attributes. + type: list + default: '' + telemetry: + - when: default + spans: + - span_kind: CONSUMER + attributes: + - name: messaging.destination.name + type: STRING + - name: messaging.message.id + type: STRING + - name: messaging.operation + type: STRING + - name: messaging.system + type: STRING - name: spring-kafka-2.7 + description: This instrumentation enables CONSUMER spans for Spring Kafka listeners. source_path: instrumentation/spring/spring-kafka-2.7 scope: name: io.opentelemetry.spring-kafka-2.7 target_versions: javaagent: - org.springframework.kafka:spring-kafka:[2.7.0,) + configurations: + - name: otel.instrumentation.messaging.experimental.receive-telemetry.enabled + description: | + Enables experimental receive telemetry, which will cause consumers to start a new trace, with only a span link connecting it to the producer trace. + type: boolean + default: false + - name: otel.instrumentation.messaging.experimental.capture-headers + description: A comma-separated list of header names to capture as span attributes. + type: list + default: '' + - name: otel.instrumentation.kafka.experimental-span-attributes + description: Enables capturing experimental span attribute `kafka.record.queue_time_ms` + type: boolean + default: false + telemetry: + - when: otel.instrumentation.kafka.experimental-span-attributes=true + spans: + - span_kind: CONSUMER + attributes: + - name: kafka.record.queue_time_ms + type: LONG + - name: messaging.batch.message_count + type: LONG + - name: messaging.client_id + type: STRING + - name: messaging.destination.name + type: STRING + - name: messaging.destination.partition.id + type: STRING + - name: messaging.kafka.consumer.group + type: STRING + - name: messaging.kafka.message.key + type: STRING + - name: messaging.kafka.message.offset + type: LONG + - name: messaging.message.body.size + type: LONG + - name: messaging.operation + type: STRING + - name: messaging.system + type: STRING + - when: default + spans: + - span_kind: CONSUMER + attributes: + - name: messaging.batch.message_count + type: LONG + - name: messaging.client_id + type: STRING + - name: messaging.destination.name + type: STRING + - name: messaging.destination.partition.id + type: STRING + - name: messaging.kafka.consumer.group + type: STRING + - name: messaging.kafka.message.key + type: STRING + - name: messaging.kafka.message.offset + type: LONG + - name: messaging.message.body.size + type: LONG + - name: messaging.operation + type: STRING + - name: messaging.system + type: STRING - name: spring-pulsar-1.0 + description: This instrumentation enables CONSUMER spans for Spring Pulsar listeners. source_path: instrumentation/spring/spring-pulsar-1.0 minimum_java_version: 17 scope: @@ -3654,28 +3949,141 @@ libraries: target_versions: javaagent: - org.springframework.pulsar:spring-pulsar:[1.0.0,) + configurations: + - name: otel.instrumentation.messaging.experimental.receive-telemetry.enabled + description: | + Enables experimental receive telemetry, which will cause consumers to start a new trace, with only a span link connecting it to the producer trace. + type: boolean + default: false + - name: otel.instrumentation.messaging.experimental.capture-headers + description: A comma-separated list of header names to capture as span attributes. + type: list + default: '' + - name: otel.instrumentation.pulsar.experimental-span-attributes + description: | + Enables capturing experimental span attribute `messaging.pulsar.message.type` on PRODUCER spans. + type: boolean + default: false + telemetry: + - when: default + spans: + - span_kind: CONSUMER + attributes: + - name: messaging.destination.name + type: STRING + - name: messaging.message.body.size + type: LONG + - name: messaging.message.id + type: STRING + - name: messaging.operation + type: STRING + - name: messaging.system + type: STRING + - when: otel.instrumentation.pulsar.experimental-span-attributes=true + spans: + - span_kind: CONSUMER + attributes: + - name: messaging.destination.name + type: STRING + - name: messaging.message.body.size + type: LONG + - name: messaging.message.id + type: STRING + - name: messaging.operation + type: STRING + - name: messaging.system + type: STRING - name: spring-rabbit-1.0 + description: This instrumentation enables CONSUMER spans for Spring RabbitMQ listeners. source_path: instrumentation/spring/spring-rabbit-1.0 scope: name: io.opentelemetry.spring-rabbit-1.0 target_versions: javaagent: - org.springframework.amqp:spring-rabbit:(,) + configurations: + - name: otel.instrumentation.messaging.experimental.capture-headers + description: A comma-separated list of header names to capture as span attributes. + type: list + default: '' + telemetry: + - when: default + spans: + - span_kind: CONSUMER + attributes: + - name: messaging.destination.name + type: STRING + - name: messaging.message.body.size + type: LONG + - name: messaging.operation + type: STRING + - name: messaging.system + type: STRING - name: spring-rmi-4.0 + description: This instrumentation enables CLIENT and SERVER spans for Spring RMI + applications. source_path: instrumentation/spring/spring-rmi-4.0 scope: name: io.opentelemetry.spring-rmi-4.0 target_versions: javaagent: - org.springframework:spring-context:[4.0.0.RELEASE,6) + telemetry: + - when: default + spans: + - span_kind: CLIENT + attributes: + - name: rpc.method + type: STRING + - name: rpc.service + type: STRING + - name: rpc.system + type: STRING + - span_kind: SERVER + attributes: + - name: rpc.method + type: STRING + - name: rpc.service + type: STRING + - name: rpc.system + type: STRING - name: spring-scheduling-3.1 + description: This instrumentation enables tracing for Spring Scheduling tasks. source_path: instrumentation/spring/spring-scheduling-3.1 scope: name: io.opentelemetry.spring-scheduling-3.1 target_versions: javaagent: - org.springframework:spring-context:[3.1.0.RELEASE,] + configurations: + - name: otel.instrumentation.spring-scheduling.experimental-span-attributes + description: Adds the experimental span attribute `job.system` with the value + `spring_scheduling`. + type: boolean + default: false + telemetry: + - when: default + spans: + - span_kind: INTERNAL + attributes: + - name: code.function + type: STRING + - name: code.namespace + type: STRING + - when: otel.instrumentation.spring-scheduling.experimental-span-attributes=true + spans: + - span_kind: INTERNAL + attributes: + - name: code.function + type: STRING + - name: code.namespace + type: STRING + - name: job.system + type: STRING - name: spring-security-config-6.0 + description: | + This instrumentation does not emit any telemetry on its own. Instead, it captures enduser attributes, and is only enabled when at least one of the `enduser` configurations is enabled. + NOTE: The `enduser` attributes have been deprecated and will be removed in 3.0+ of the java agent. source_path: instrumentation/spring/spring-security-config-6.0 minimum_java_version: 17 scope: @@ -3689,29 +4097,38 @@ libraries: - org.springframework:spring-web:6.0.0 - jakarta.servlet:jakarta.servlet-api:6.0.0 - org.springframework.security:spring-security-web:6.0.0 + configurations: + - name: otel.instrumentation.common.enduser.id.enabled + description: Enables capturing the enduser.id attribute. + type: boolean + default: false + - name: otel.instrumentation.common.enduser.role.enabled + description: Enables capturing the enduser.role attribute. + type: boolean + default: false + - name: otel.instrumentation.common.enduser.scope.enabled + description: Enables capturing the enduser.scope attribute. + type: boolean + default: false + - name: otel.instrumentation.spring-security.enduser.role.granted-authority-prefix + description: Prefix of granted authorities identifying roles to capture in the + `enduser.role` semantic attribute. + type: string + default: ROLE_ + - name: otel.instrumentation.spring-security.scope.role.granted-authority-prefix + description: Prefix of granted authorities identifying scopes to capture in + the `enduser.scopes` semantic attribute. + type: string + default: SCOPE_ - name: spring-web-3.1 + description: | + This instrumentation provides a library integration that enables capturing HTTP client spans and metrics for Spring's RestTemplate. The agent integration enriches HTTP server spans and metrics with route information. source_path: instrumentation/spring/spring-web/spring-web-3.1 scope: name: io.opentelemetry.spring-web-3.1 target_versions: javaagent: - org.springframework:spring-web:[3.1.0.RELEASE,6) - - name: spring-web-6.0 - source_path: instrumentation/spring/spring-web/spring-web-6.0 - scope: - name: io.opentelemetry.spring-web-6.0 - target_versions: - javaagent: - - org.springframework:spring-web:[6.0.0,) - - name: spring-webflux-5.0 - source_path: instrumentation/spring/spring-webflux/spring-webflux-5.0 - scope: - name: io.opentelemetry.spring-webflux-5.0 - target_versions: - javaagent: - - io.projectreactor.ipc:reactor-netty:[0.7.0.RELEASE,) - - org.springframework:spring-webflux:[5.0.0.RELEASE,) - - io.projectreactor.netty:reactor-netty:[0.8.0.RELEASE,) telemetry: - when: default metrics: @@ -3728,25 +4145,266 @@ libraries: type: STRING - name: server.port type: LONG + spans: + - span_kind: CLIENT + attributes: + - name: error.type + type: STRING + - name: http.request.method + type: STRING + - name: http.response.status_code + type: LONG + - name: server.address + type: STRING + - name: server.port + type: LONG + - name: url.full + type: STRING + - name: spring-web-6.0 + description: This instrumentation enriches HTTP server spans and metrics with + route information. + source_path: instrumentation/spring/spring-web/spring-web-6.0 + scope: + name: io.opentelemetry.spring-web-6.0 + target_versions: + javaagent: + - org.springframework:spring-web:[6.0.0,) + - name: spring-webflux-5.0 + description: | + This instrumentation enables HTTP client spans and metrics for Spring WebFlux 5.0. It also optionally enables experimental controller (INTERNAL) spans. + source_path: instrumentation/spring/spring-webflux/spring-webflux-5.0 + scope: + name: io.opentelemetry.spring-webflux-5.0 + target_versions: + javaagent: + - io.projectreactor.ipc:reactor-netty:[0.7.0.RELEASE,) + - org.springframework:spring-webflux:[5.0.0.RELEASE,) + - io.projectreactor.netty:reactor-netty:[0.8.0.RELEASE,) + configurations: + - name: otel.instrumentation.common.experimental.controller-telemetry.enabled + description: Enables the creation of experimental controller (INTERNAL) spans. + type: boolean + default: false + telemetry: + - when: otel.instrumentation.common.experimental.controller-telemetry.enabled + metrics: + - name: http.client.request.duration + description: Duration of HTTP client requests. + type: HISTOGRAM + unit: s + attributes: + - name: http.request.method + type: STRING + - name: http.response.status_code + type: LONG + - name: server.address + type: STRING + - name: server.port + type: LONG + spans: + - span_kind: CLIENT + attributes: + - name: error.type + type: STRING + - name: http.request.method + type: STRING + - name: http.response.status_code + type: LONG + - name: server.address + type: STRING + - name: server.port + type: LONG + - name: url.full + type: STRING + - span_kind: INTERNAL + attributes: + - name: code.function + type: STRING + - name: code.namespace + type: STRING - name: spring-webflux-5.3 + description: | + This instrumentation provides a library integration for the Spring WebFlux WebClient and Webflux server versions 5.3+ that enables HTTP client and server spans and metrics. source_path: instrumentation/spring/spring-webflux/spring-webflux-5.3 scope: name: io.opentelemetry.spring-webflux-5.3 target_versions: library: - org.springframework:spring-webflux:5.3.0 + telemetry: + - when: default + metrics: + - name: http.client.request.duration + description: Duration of HTTP client requests. + type: HISTOGRAM + unit: s + attributes: + - name: http.request.method + type: STRING + - name: http.response.status_code + type: LONG + - name: server.address + type: STRING + - name: server.port + type: LONG + - name: http.server.request.duration + description: Duration of HTTP server requests. + type: HISTOGRAM + unit: s + attributes: + - name: http.request.method + type: STRING + - name: http.response.status_code + type: LONG + - name: http.route + type: STRING + - name: url.scheme + type: STRING + spans: + - span_kind: CLIENT + attributes: + - name: error.type + type: STRING + - name: http.request.method + type: STRING + - name: http.response.status_code + type: LONG + - name: server.address + type: STRING + - name: server.port + type: LONG + - name: url.full + type: STRING + - span_kind: SERVER + attributes: + - name: client.address + type: STRING + - name: error.type + type: STRING + - name: http.request.method + type: STRING + - name: http.response.status_code + type: LONG + - name: http.route + type: STRING + - name: network.peer.address + type: STRING + - name: network.peer.port + type: LONG + - name: server.address + type: STRING + - name: server.port + type: LONG + - name: url.path + type: STRING + - name: url.query + type: STRING + - name: url.scheme + type: STRING + - name: user_agent.original + type: STRING - name: spring-webmvc-3.1 + description: | + This instrumentation enables optional Controller and View (INTERNAL) spans for Spring WebMVC 3.1+. source_path: instrumentation/spring/spring-webmvc/spring-webmvc-3.1 scope: name: io.opentelemetry.spring-webmvc-3.1 target_versions: javaagent: - org.springframework:spring-webmvc:[3.1.0.RELEASE,6) + configurations: + - name: otel.instrumentation.spring-webmvc.experimental-span-attributes + description: | + Enables the capture of experimental span attributes `spring-webmvc-view-name` and `spring-webmvc.view.type`. + type: boolean + default: false + - name: otel.instrumentation.common.experimental.controller-telemetry.enabled + description: Enables the creation of experimental controller (INTERNAL) spans. + type: boolean + default: false + - name: otel.instrumentation.common.experimental.view-telemetry.enabled + description: Enables the creation of experimental view (INTERNAL) spans. + type: boolean + default: false + telemetry: + - when: default + spans: + - span_kind: INTERNAL + attributes: + - name: code.function + type: STRING + - name: code.namespace + type: STRING + - when: otel.instrumentation.spring-webmvc.experimental-span-attributes=true + spans: + - span_kind: INTERNAL + attributes: + - name: code.function + type: STRING + - name: code.namespace + type: STRING + - name: spring-webmvc.view.type + type: STRING - name: spring-webmvc-5.3 + description: | + This instrumentation provides a library integration for Spring WebMVC controllers, that enables the creation of HTTP server spans and metrics for requests processed by the Spring servlet container. source_path: instrumentation/spring/spring-webmvc/spring-webmvc-5.3 scope: name: io.opentelemetry.spring-webmvc-5.3 + telemetry: + - when: default + metrics: + - name: http.server.request.duration + description: Duration of HTTP server requests. + type: HISTOGRAM + unit: s + attributes: + - name: http.request.method + type: STRING + - name: http.response.status_code + type: LONG + - name: http.route + type: STRING + - name: network.protocol.version + type: STRING + - name: url.scheme + type: STRING + spans: + - span_kind: SERVER + attributes: + - name: client.address + type: STRING + - name: error.type + type: STRING + - name: http.request.method + type: STRING + - name: http.request.method_original + type: STRING + - name: http.response.status_code + type: LONG + - name: http.route + type: STRING + - name: network.peer.address + type: STRING + - name: network.peer.port + type: LONG + - name: network.protocol.version + type: STRING + - name: server.address + type: STRING + - name: server.port + type: LONG + - name: url.path + type: STRING + - name: url.query + type: STRING + - name: url.scheme + type: STRING + - name: user_agent.original + type: STRING - name: spring-webmvc-6.0 + description: | + This instrumentation enables optional Controller and View (INTERNAL) spans for Spring WebMVC 6.0+. source_path: instrumentation/spring/spring-webmvc/spring-webmvc-6.0 minimum_java_version: 17 scope: @@ -3754,6 +4412,39 @@ libraries: target_versions: javaagent: - org.springframework:spring-webmvc:[6.0.0,) + configurations: + - name: otel.instrumentation.spring-webmvc.experimental-span-attributes + description: | + Enables the capture of experimental span attributes `spring-webmvc-view-name` and `spring-webmvc.view.type`. + type: boolean + default: false + - name: otel.instrumentation.common.experimental.controller-telemetry.enabled + description: Enables the creation of experimental controller (INTERNAL) spans. + type: boolean + default: false + - name: otel.instrumentation.common.experimental.view-telemetry.enabled + description: Enables the creation of experimental view (INTERNAL) spans. + type: boolean + default: false + telemetry: + - when: default + spans: + - span_kind: INTERNAL + attributes: + - name: code.function + type: STRING + - name: code.namespace + type: STRING + - when: otel.instrumentation.spring-webmvc.experimental-span-attributes=true + spans: + - span_kind: INTERNAL + attributes: + - name: code.function + type: STRING + - name: code.namespace + type: STRING + - name: spring-webmvc.view.type + type: STRING - name: spring-ws-2.0 disabled_by_default: true source_path: instrumentation/spring/spring-ws-2.0 diff --git a/instrumentation-docs/collect.sh b/instrumentation-docs/collect.sh index ad614060dd..ba3ad6f04b 100755 --- a/instrumentation-docs/collect.sh +++ b/instrumentation-docs/collect.sh @@ -90,6 +90,31 @@ readonly INSTRUMENTATIONS=( "apache-dubbo-2.7:javaagent:testDubbo" "finagle-http-23.11:javaagent:test" "finatra-2.9:javaagent:test" + "spring:spring-batch-3.0:javaagent:test" + "spring:spring-data:spring-data-1.8:javaagent:test" + "spring:spring-integration-4.1:javaagent:test" + "spring:spring-integration-4.1:javaagent:testWithRabbitInstrumentation" + "spring:spring-integration-4.1:javaagent:testWithProducerInstrumentation" + "spring:spring-jms:spring-jms-2.0:javaagent:test" + "spring:spring-kafka-2.7:javaagent:test" + "spring:spring-kafka-2.7:javaagent:testNoReceiveTelemetry" + "spring:spring-pulsar-1.0:javaagent:test" + "spring:spring-rabbit-1.0:javaagent:test" + "spring:spring-rmi-4.0:javaagent:test" + "spring:spring-scheduling-3.1:javaagent:test" + "spring:spring-scheduling-3.1:javaagent:testExperimental" + "spring:spring-web:spring-web-3.1:library:test" + "spring:spring-web:spring-web-6.0:javaagent:test" + "spring:spring-webflux:spring-webflux-5.0:javaagent:test" + "spring:spring-webflux:spring-webflux-5.3:library:test" + "spring:spring-webmvc:spring-webmvc-3.1:javaagent:test" + "spring:spring-webmvc:spring-webmvc-3.1:javaagent:testExperimental" + "spring:spring-webmvc:spring-webmvc-5.3:library:test" + "spring:spring-webmvc:spring-webmvc-6.0:javaagent:test" + "spring:spring-webmvc:spring-webmvc-3.1:javaagent:testExperimental" + "spring:spring-webmvc:spring-webmvc-6.0:javaagent:test" + "spring:spring-webmvc:spring-webmvc-6.0:javaagent:testExperimental" + "openai:openai-java-1.1:javaagent:test" ) readonly COLIMA_INSTRUMENTATIONS=( @@ -221,7 +246,7 @@ run_gradle_tasks() { ./gradlew "${tasks[@]}" \ -PcollectMetadata=true \ - --rerun-tasks --continue + --rerun-tasks --continue --no-parallel } # Cleans any stray .telemetry directories left in the repo. diff --git a/instrumentation-docs/readme.md b/instrumentation-docs/readme.md index c4d76f7706..0dd695cbcf 100644 --- a/instrumentation-docs/readme.md +++ b/instrumentation-docs/readme.md @@ -28,7 +28,7 @@ In order to collect spans, add the `collectSpans` property (along with `collectM ```kotlin tasks { test { - systemProperty("collectMetadata", collectMetadata) + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") systemProperty("collectSpans", true) } } diff --git a/instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/InstrumentationAnalyzer.java b/instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/InstrumentationAnalyzer.java index 38cee23f1b..ad393200fd 100644 --- a/instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/InstrumentationAnalyzer.java +++ b/instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/InstrumentationAnalyzer.java @@ -6,6 +6,7 @@ package io.opentelemetry.instrumentation.docs; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.exc.MismatchedInputException; import com.fasterxml.jackson.databind.exc.ValueInstantiationException; import io.opentelemetry.instrumentation.docs.internal.InstrumentationMetaData; import io.opentelemetry.instrumentation.docs.internal.InstrumentationModule; @@ -76,7 +77,7 @@ class InstrumentationAnalyzer { } try { return YamlHelper.metaDataParser(metadataFile); - } catch (ValueInstantiationException e) { + } catch (ValueInstantiationException | MismatchedInputException e) { logger.severe("Error parsing metadata file for " + module.getInstrumentationName()); throw e; } diff --git a/instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/parsers/SpanParser.java b/instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/parsers/SpanParser.java index 02f8a8d636..cd4b3fd713 100644 --- a/instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/parsers/SpanParser.java +++ b/instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/parsers/SpanParser.java @@ -24,7 +24,8 @@ import java.util.Set; public class SpanParser { // We want to ignore test related attributes - private static final List EXCLUDED_ATTRIBUTES = List.of("x-test-", "test-baggage-"); + private static final List EXCLUDED_ATTRIBUTES = + List.of("x-test-", "test-baggage-", "test_message"); /** * Pull spans from the `.telemetry` directory, filter them by scope, and set them in the module. diff --git a/instrumentation/aws-sdk/aws-sdk-1.11/metadata.yaml b/instrumentation/aws-sdk/aws-sdk-1.11/metadata.yaml index 05882d6022..eb5b641b5f 100644 --- a/instrumentation/aws-sdk/aws-sdk-1.11/metadata.yaml +++ b/instrumentation/aws-sdk/aws-sdk-1.11/metadata.yaml @@ -4,7 +4,9 @@ configurations: type: boolean default: false - name: otel.instrumentation.messaging.experimental.receive-telemetry.enabled - description: Enables experimental receive telemetry for AWS SDK instrumentation. + description: > + Enables experimental receive telemetry, which will cause consumers to start a new trace, with + only a span link connecting it to the producer trace. type: boolean default: false - name: otel.instrumentation.messaging.experimental.capture-headers diff --git a/instrumentation/aws-sdk/aws-sdk-2.2/metadata.yaml b/instrumentation/aws-sdk/aws-sdk-2.2/metadata.yaml index 732d5818dd..6c5b84fb78 100644 --- a/instrumentation/aws-sdk/aws-sdk-2.2/metadata.yaml +++ b/instrumentation/aws-sdk/aws-sdk-2.2/metadata.yaml @@ -1,6 +1,8 @@ configurations: - name: otel.instrumentation.messaging.experimental.receive-telemetry.enabled - description: Enables experimental receive telemetry for AWS SDK instrumentation. + description: > + Enables experimental receive telemetry, which will cause consumers to start a new trace, with + only a span link connecting it to the producer trace. type: boolean default: false - name: otel.instrumentation.messaging.experimental.capture-headers diff --git a/instrumentation/dropwizard/dropwizard-views-0.7/metadata.yaml b/instrumentation/dropwizard/dropwizard-views-0.7/metadata.yaml index 96cd260f93..af390acec7 100644 --- a/instrumentation/dropwizard/dropwizard-views-0.7/metadata.yaml +++ b/instrumentation/dropwizard/dropwizard-views-0.7/metadata.yaml @@ -1,9 +1,9 @@ configurations: - name: otel.instrumentation.common.experimental.view-telemetry.enabled - description: Enables experimental view telemetry. + description: Enables the creation of experimental view (INTERNAL) spans. type: boolean default: false - name: otel.instrumentation.common.experimental.controller-telemetry.enabled - description: Enables experimental controller telemetry. + description: Enables the creation of experimental controller (INTERNAL) spans. type: boolean default: false diff --git a/instrumentation/kafka/kafka-clients/kafka-clients-0.11/metadata.yaml b/instrumentation/kafka/kafka-clients/kafka-clients-0.11/metadata.yaml index 53601136d8..84e85395ac 100644 --- a/instrumentation/kafka/kafka-clients/kafka-clients-0.11/metadata.yaml +++ b/instrumentation/kafka/kafka-clients/kafka-clients-0.11/metadata.yaml @@ -15,6 +15,8 @@ configurations: type: list default: '' - name: otel.instrumentation.messaging.experimental.receive-telemetry.enabled - description: Enables experimental receive telemetry for Kafka instrumentation. + description: > + Enables experimental receive telemetry, which will cause consumers to start a new trace, with + only a span link connecting it to the producer trace. type: boolean default: false diff --git a/instrumentation/openai/openai-java-1.1/javaagent/build.gradle.kts b/instrumentation/openai/openai-java-1.1/javaagent/build.gradle.kts index aad02ee8eb..455a3456f0 100644 --- a/instrumentation/openai/openai-java-1.1/javaagent/build.gradle.kts +++ b/instrumentation/openai/openai-java-1.1/javaagent/build.gradle.kts @@ -25,6 +25,9 @@ tasks { withType().configureEach { systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) // TODO run tests both with and without genai message capture + systemProperty("otel.instrumentation.genai.capture-message-content", "true") + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") + systemProperty("collectSpans", true) } } diff --git a/instrumentation/openai/openai-java-1.1/metadata.yaml b/instrumentation/openai/openai-java-1.1/metadata.yaml new file mode 100644 index 0000000000..f1f6cc9dcd --- /dev/null +++ b/instrumentation/openai/openai-java-1.1/metadata.yaml @@ -0,0 +1,9 @@ +description: This instrumentation enables Gen AI client spans and metrics for OpenAI Java SDK 1.1+. +configurations: + - name: otel.instrumentation.genai.capture-message-content + type: boolean + default: false + description: > + Enables including the full content of user and assistant messages in emitted log events. + Note that full content can have data privacy and size concerns, and care should be taken when + enabling this. diff --git a/instrumentation/spring/README.md b/instrumentation/spring/README.md index 7e6d9cbff6..09ccc44545 100644 --- a/instrumentation/spring/README.md +++ b/instrumentation/spring/README.md @@ -17,3 +17,5 @@ This package streamlines the manual instrumentation process of OpenTelemetry for | `otel.instrumentation.spring-scheduling.experimental-span-attributes` | Boolean | `false` | Enable the capture of experimental span attributes for Spring Scheduling version 3.1. | | `otel.instrumentation.spring-webflux.experimental-span-attributes` | Boolean | `false` | Enable the capture of experimental span attributes for Spring WebFlux version 5.0. | | `otel.instrumentation.spring-webmvc.experimental-span-attributes` | Boolean | `false` | Enable the capture of experimental span attributes for Spring Web MVC version 3.1. | +| `otel.instrumentation.messaging.experimental.receive-telemetry.enabled` | Boolean | `false` | Enables experimental receive telemetry, which will cause consumers to start a new trace, with only a span link connecting it to the producer trace. | +| `otel.instrumentation.kafka.experimental-span-attributes` | Boolean | `false` | Enable the capture of experimental span attributes for Spring Kafka version 2.7. | diff --git a/instrumentation/spring/spring-batch-3.0/javaagent/build.gradle.kts b/instrumentation/spring/spring-batch-3.0/javaagent/build.gradle.kts index 47bda33c03..e1fbf70e69 100644 --- a/instrumentation/spring/spring-batch-3.0/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-batch-3.0/javaagent/build.gradle.kts @@ -48,6 +48,10 @@ tasks { excludeTestsMatching("*ItemLevelSpanTest") excludeTestsMatching("*CustomSpanEventTest") } + + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") + systemProperty("collectSpans", true) + systemProperty("metaDataConfig", "otel.instrumentation.spring-batch.experimental-span-attributes=true") } check { diff --git a/instrumentation/spring/spring-batch-3.0/metadata.yaml b/instrumentation/spring/spring-batch-3.0/metadata.yaml index 1aee203e71..ee9d034992 100644 --- a/instrumentation/spring/spring-batch-3.0/metadata.yaml +++ b/instrumentation/spring/spring-batch-3.0/metadata.yaml @@ -1 +1,15 @@ disabled_by_default: true +description: This instrumentation enables INTERNAL spans for jobs run by the Spring Batch framework. +configurations: + - name: otel.instrumentation.spring-batch.experimental-span-attributes + type: boolean + description: Adds the experimental attribute `job.system` to spans. + default: false + - name: otel.instrumentation.spring-batch.experimental.chunk.new-trace + type: boolean + description: When enabled, a new root span will be created for each chunk processing. Please note that this may lead to a high number of spans being created. + default: false + - name: otel.instrumentation.spring-batch.item.enabled + type: boolean + description: When enabled, spans will be created for each item processed. Please note that this may lead to a high number of spans being created. + default: false diff --git a/instrumentation/spring/spring-boot-actuator-autoconfigure-2.0/metadata.yaml b/instrumentation/spring/spring-boot-actuator-autoconfigure-2.0/metadata.yaml index 1aee203e71..d0985f49b0 100644 --- a/instrumentation/spring/spring-boot-actuator-autoconfigure-2.0/metadata.yaml +++ b/instrumentation/spring/spring-boot-actuator-autoconfigure-2.0/metadata.yaml @@ -1 +1,4 @@ disabled_by_default: true +description: > + This instrumentation configures the OpenTelemetry Micrometer bridge to receive metrics from + Spring Boot Actuator. It does not produce telemetry on its own. diff --git a/instrumentation/spring/spring-boot-autoconfigure/README.md b/instrumentation/spring/spring-boot-autoconfigure/README.md index 85b9ea1dbe..b96b77c069 100644 --- a/instrumentation/spring/spring-boot-autoconfigure/README.md +++ b/instrumentation/spring/spring-boot-autoconfigure/README.md @@ -3,8 +3,7 @@ Auto-configures OpenTelemetry instrumentation for [spring-web](../spring-web/spring-web-3.1/library) , [spring-webmvc](../spring-webmvc/spring-webmvc-5.3/library), and [spring-webflux](../spring-webflux/spring-webflux-5.3/library). Leverages Spring Aspect Oriented -Programming, -dependency injection, and bean post-processing to trace spring applications. To include all features -listed below use the [opentelemetry-spring-boot-starter](../starters/spring-boot-starter/README.md). +Programming, dependency injection, and bean post-processing to trace spring applications. To include +all features listed below use the [opentelemetry-spring-boot-starter](https://opentelemetry.io/docs/zero-code/java/spring-boot-starter/). Documentation for OpenTelemetry Spring Auto-Configuration can be found [here](https://opentelemetry.io/docs/zero-code/java/spring-boot-starter/out-of-the-box-instrumentation/). diff --git a/instrumentation/spring/spring-boot-autoconfigure/metadata.yaml b/instrumentation/spring/spring-boot-autoconfigure/metadata.yaml new file mode 100644 index 0000000000..5a9cc7af0f --- /dev/null +++ b/instrumentation/spring/spring-boot-autoconfigure/metadata.yaml @@ -0,0 +1,4 @@ +description: > + This instrumentation auto-configures OpenTelemetry instrumentation for spring-web, spring-webmvc, + and spring-webflux to instrument Spring Boot applications. It does not produce telemetry on its + own. This instrumentation is mostly used as part of the Spring Boot starter. diff --git a/instrumentation/spring/spring-boot-resources/metadata.yaml b/instrumentation/spring/spring-boot-resources/metadata.yaml new file mode 100644 index 0000000000..daab5c47f1 --- /dev/null +++ b/instrumentation/spring/spring-boot-resources/metadata.yaml @@ -0,0 +1,14 @@ +description: > + This instrumentation automatically detects the `service.name` and `service.version` for Spring + Boot applications and sets them as resource attributes. + + It uses the following strategies (first successful wins): + - Check for the SPRING_APPLICATION_NAME environment variable + - Check for spring.application.name system property + - Check for application.properties file on the classpath + - Check for application.properties in the current working dir + - Check for application.yml on the classpath + - Check for application.yml in the current working dir + - Check for --spring.application.name program argument (not jvm arg) via ProcessHandle + - Check for --spring.application.name program argument via sun.java.command system property + diff --git a/instrumentation/spring/spring-cloud-aws-3.0/metadata.yaml b/instrumentation/spring/spring-cloud-aws-3.0/metadata.yaml new file mode 100644 index 0000000000..e7ea9fa156 --- /dev/null +++ b/instrumentation/spring/spring-cloud-aws-3.0/metadata.yaml @@ -0,0 +1,4 @@ +description: > + This instrumentation enhances tracing for Spring Cloud AWS. It augments the existing AWS SDK + instrumentation by providing higher-level tracing for SQS operations, capturing details specific + to Spring Cloud AWS SQS usage and linking them to the underlying AWS SDK traces. diff --git a/instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-2.0/metadata.yaml b/instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-2.0/metadata.yaml new file mode 100644 index 0000000000..49a2076927 --- /dev/null +++ b/instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-2.0/metadata.yaml @@ -0,0 +1,11 @@ +description: > + This instrumentation enhances tracing for Spring Cloud Gateway. It does not generate new telemetry + on its own, but rather enriches existing traces produced by other instrumentations like Netty and + Spring WebFlux with Spring Cloud Gateway-specific attributes. +configurations: + - name: otel.instrumentation.spring-cloud-gateway.experimental-span-attributes + type: boolean + default: false + description: > + Enables experimental `spring-cloud-gateway.route` attributes (e.g., + `spring-cloud-gateway.route.id`, `spring-cloud-gateway.route.uri`, etc.) on spans. diff --git a/instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-2.2/metadata.yaml b/instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-2.2/metadata.yaml new file mode 100644 index 0000000000..3dd1f70808 --- /dev/null +++ b/instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-2.2/metadata.yaml @@ -0,0 +1,11 @@ +description: > + This instrumentation enhances tracing for Spring Cloud Gateway. It does not generate new telemetry + on its own, but rather enriches existing traces produced by other instrumentations like Netty and + Spring WebFlux with Spring Cloud Gateway-specific attributes. +configurations: + - name: otel.instrumentation.spring-cloud-gateway.experimental-span-attributes + type: boolean + default: false + description: > + Enables experimental `spring-cloud-gateway.route` attributes (e.g., + `spring-cloud-gateway.route.id`, `spring-cloud-gateway.route.uri`, etc.) on spans. diff --git a/instrumentation/spring/spring-core-2.0/javaagent/build.gradle.kts b/instrumentation/spring/spring-core-2.0/javaagent/build.gradle.kts index e012ab37e1..400f444d49 100644 --- a/instrumentation/spring/spring-core-2.0/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-core-2.0/javaagent/build.gradle.kts @@ -26,3 +26,10 @@ if (findProperty("testLatestDeps") as Boolean) { minJavaVersionSupported.set(JavaVersion.VERSION_17) } } + +tasks { + test { + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") + systemProperty("collectSpans", true) + } +} diff --git a/instrumentation/spring/spring-core-2.0/metadata.yaml b/instrumentation/spring/spring-core-2.0/metadata.yaml new file mode 100644 index 0000000000..9203a45df4 --- /dev/null +++ b/instrumentation/spring/spring-core-2.0/metadata.yaml @@ -0,0 +1,5 @@ +description: > + This instrumentation ensures proper context propagation for asynchronous operations + within Spring Core. It modifies how tasks are submitted and executed to ensure that + spans created by other instrumentations are correctly linked across thread boundaries, + rather than generating any new telemetry itself. diff --git a/instrumentation/spring/spring-data/spring-data-1.8/javaagent/build.gradle.kts b/instrumentation/spring/spring-data/spring-data-1.8/javaagent/build.gradle.kts index 6222c25ee9..315ce73380 100644 --- a/instrumentation/spring/spring-data/spring-data-1.8/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-data/spring-data-1.8/javaagent/build.gradle.kts @@ -51,10 +51,14 @@ tasks { jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED") jvmArgs("-XX:+IgnoreUnrecognizedVMOptions") jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true") + + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") + systemProperty("collectSpans", true) } val testStableSemconv by registering(Test::class) { jvmArgs("-Dotel.semconv-stability.opt-in=database") + systemProperty("metaDataConfig", "otel.semconv-stability.opt-in=database") } check { diff --git a/instrumentation/spring/spring-data/spring-data-1.8/metadata.yaml b/instrumentation/spring/spring-data/spring-data-1.8/metadata.yaml new file mode 100644 index 0000000000..9d4014d548 --- /dev/null +++ b/instrumentation/spring/spring-data/spring-data-1.8/metadata.yaml @@ -0,0 +1,4 @@ +description: > + This instrumentation enhances tracing for Spring Data operations. It works in conjunction + with other instrumentations, such as JDBC, to provide additional context and details + for database interactions initiated through Spring Data. diff --git a/instrumentation/spring/spring-integration-4.1/javaagent/build.gradle.kts b/instrumentation/spring/spring-integration-4.1/javaagent/build.gradle.kts index aba0ea05a7..33c848261c 100644 --- a/instrumentation/spring/spring-integration-4.1/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-integration-4.1/javaagent/build.gradle.kts @@ -48,6 +48,7 @@ tasks { include("**/SpringIntegrationAndRabbitTest.*") jvmArgs("-Dotel.instrumentation.rabbitmq.enabled=true") jvmArgs("-Dotel.instrumentation.spring-rabbit.enabled=true") + systemProperty("metaDataConfig", "otel.instrumentation.spring-rabbit.enabled=true") } val testWithProducerInstrumentation by registering(Test::class) { @@ -58,6 +59,7 @@ tasks { jvmArgs("-Dotel.instrumentation.rabbitmq.enabled=false") jvmArgs("-Dotel.instrumentation.spring-rabbit.enabled=false") jvmArgs("-Dotel.instrumentation.spring-integration.producer.enabled=true") + systemProperty("metaDataConfig", "otel.instrumentation.spring-integration.producer.enabled=true") } test { @@ -77,6 +79,9 @@ tasks { withType().configureEach { systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) + + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") + systemProperty("collectSpans", true) } } diff --git a/instrumentation/spring/spring-integration-4.1/metadata.yaml b/instrumentation/spring/spring-integration-4.1/metadata.yaml new file mode 100644 index 0000000000..1e2e86e878 --- /dev/null +++ b/instrumentation/spring/spring-integration-4.1/metadata.yaml @@ -0,0 +1,18 @@ +description: This instrumentation enables PRODUCER and CONSUMER spans for Spring Integration. +configurations: + - name: otel.instrumentation.spring-integration.producer.enabled + type: boolean + description: > + Create producer spans when messages are sent to an output channel. Enable when you're using + a messaging library that doesn't have its own instrumentation for generating producer spans. + Note that the detection of output channels only works for Spring Cloud Stream `DirectWithAttributesChannel`. + default: false + - name: otel.instrumentation.spring-integration.global-channel-interceptor-patterns + type: list + description: An array of Spring channel name patterns that will be intercepted. + default: "*" + - name: otel.instrumentation.messaging.experimental.capture-headers + type: list + description: Allows configuring headers to capture as span attributes. + default: '' + diff --git a/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/build.gradle.kts b/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/build.gradle.kts index 5b74d91f8f..692c143880 100644 --- a/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-jms/spring-jms-2.0/javaagent/build.gradle.kts @@ -61,6 +61,8 @@ configurations { tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") + systemProperty("collectSpans", true) } // this does not apply to testReceiveSpansDisabled test { diff --git a/instrumentation/spring/spring-jms/spring-jms-2.0/metadata.yaml b/instrumentation/spring/spring-jms/spring-jms-2.0/metadata.yaml new file mode 100644 index 0000000000..a589b17881 --- /dev/null +++ b/instrumentation/spring/spring-jms/spring-jms-2.0/metadata.yaml @@ -0,0 +1,12 @@ +description: This instrumentation enables the generation of CONSUMER spans for Spring JMS. +configurations: + - name: otel.instrumentation.messaging.experimental.receive-telemetry.enabled + description: > + Enables experimental receive telemetry, which will cause consumers to start a new trace, with + only a span link connecting it to the producer trace. + type: boolean + default: false + - name: otel.instrumentation.messaging.experimental.capture-headers + description: A comma-separated list of header names to capture as span attributes. + type: list + default: '' diff --git a/instrumentation/spring/spring-jms/spring-jms-6.0/javaagent/build.gradle.kts b/instrumentation/spring/spring-jms/spring-jms-6.0/javaagent/build.gradle.kts index a6d71b1279..772bc31510 100644 --- a/instrumentation/spring/spring-jms/spring-jms-6.0/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-jms/spring-jms-6.0/javaagent/build.gradle.kts @@ -37,6 +37,8 @@ otelJava { tasks { withType().configureEach { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") + systemProperty("collectSpans", true) } val testReceiveSpansDisabled by registering(Test::class) { diff --git a/instrumentation/spring/spring-jms/spring-jms-6.0/metadata.yaml b/instrumentation/spring/spring-jms/spring-jms-6.0/metadata.yaml new file mode 100644 index 0000000000..a589b17881 --- /dev/null +++ b/instrumentation/spring/spring-jms/spring-jms-6.0/metadata.yaml @@ -0,0 +1,12 @@ +description: This instrumentation enables the generation of CONSUMER spans for Spring JMS. +configurations: + - name: otel.instrumentation.messaging.experimental.receive-telemetry.enabled + description: > + Enables experimental receive telemetry, which will cause consumers to start a new trace, with + only a span link connecting it to the producer trace. + type: boolean + default: false + - name: otel.instrumentation.messaging.experimental.capture-headers + description: A comma-separated list of header names to capture as span attributes. + type: list + default: '' diff --git a/instrumentation/spring/spring-kafka-2.7/javaagent/build.gradle.kts b/instrumentation/spring/spring-kafka-2.7/javaagent/build.gradle.kts index 9e4134b2a0..005cf9b0cc 100644 --- a/instrumentation/spring/spring-kafka-2.7/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-kafka-2.7/javaagent/build.gradle.kts @@ -32,6 +32,7 @@ dependencies { } val latestDepTest = findProperty("testLatestDeps") as Boolean +val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false" testing { suites { @@ -54,6 +55,9 @@ testing { jvmArgs("-Dotel.instrumentation.kafka.experimental-span-attributes=false") jvmArgs("-Dotel.instrumentation.messaging.experimental.receive-telemetry.enabled=false") + + systemProperty("collectMetadata", collectMetadata) + systemProperty("collectSpans", true) } } } @@ -68,6 +72,10 @@ tasks { systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) jvmArgs("-Dotel.instrumentation.kafka.experimental-span-attributes=true") jvmArgs("-Dotel.instrumentation.messaging.experimental.receive-telemetry.enabled=true") + + systemProperty("metaDataConfig", "otel.instrumentation.kafka.experimental-span-attributes=true") + systemProperty("collectMetadata", collectMetadata) + systemProperty("collectSpans", true) } check { diff --git a/instrumentation/spring/spring-kafka-2.7/metadata.yaml b/instrumentation/spring/spring-kafka-2.7/metadata.yaml new file mode 100644 index 0000000000..a5ad7b76bd --- /dev/null +++ b/instrumentation/spring/spring-kafka-2.7/metadata.yaml @@ -0,0 +1,16 @@ +description: This instrumentation enables CONSUMER spans for Spring Kafka listeners. +configurations: + - name: otel.instrumentation.messaging.experimental.receive-telemetry.enabled + description: > + Enables experimental receive telemetry, which will cause consumers to start a new trace, with + only a span link connecting it to the producer trace. + type: boolean + default: false + - name: otel.instrumentation.messaging.experimental.capture-headers + description: A comma-separated list of header names to capture as span attributes. + type: list + default: '' + - name: otel.instrumentation.kafka.experimental-span-attributes + description: Enables capturing experimental span attribute `kafka.record.queue_time_ms` + type: boolean + default: false diff --git a/instrumentation/spring/spring-pulsar-1.0/javaagent/build.gradle.kts b/instrumentation/spring/spring-pulsar-1.0/javaagent/build.gradle.kts index 9364d6f73d..58e691ec90 100644 --- a/instrumentation/spring/spring-pulsar-1.0/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-pulsar-1.0/javaagent/build.gradle.kts @@ -25,6 +25,7 @@ dependencies { } val latestDepTest = findProperty("testLatestDeps") as Boolean +val collectMetadata = findProperty("collectMetadata")?.toString() ?: "false" testing { suites { @@ -61,8 +62,11 @@ tasks { test { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) - jvmArgs("-Dotel.instrumentation.pulsar.experimental-span-attributes=true") + jvmArgs("-Dotel.instrumentation.pulsar.experimental-span-attributes=false") jvmArgs("-Dotel.instrumentation.messaging.experimental.receive-telemetry.enabled=true") + + systemProperty("collectMetadata", collectMetadata) + systemProperty("collectSpans", true) } check { diff --git a/instrumentation/spring/spring-pulsar-1.0/metadata.yaml b/instrumentation/spring/spring-pulsar-1.0/metadata.yaml new file mode 100644 index 0000000000..284ded7953 --- /dev/null +++ b/instrumentation/spring/spring-pulsar-1.0/metadata.yaml @@ -0,0 +1,17 @@ +description: This instrumentation enables CONSUMER spans for Spring Pulsar listeners. +configurations: + - name: otel.instrumentation.messaging.experimental.receive-telemetry.enabled + description: > + Enables experimental receive telemetry, which will cause consumers to start a new trace, with + only a span link connecting it to the producer trace. + type: boolean + default: false + - name: otel.instrumentation.messaging.experimental.capture-headers + description: A comma-separated list of header names to capture as span attributes. + type: list + default: '' + - name: otel.instrumentation.pulsar.experimental-span-attributes + description: > + Enables capturing experimental span attribute `messaging.pulsar.message.type` on PRODUCER spans. + type: boolean + default: false diff --git a/instrumentation/spring/spring-pulsar-1.0/testing/src/main/java/io/opentelemetry/instrumentation/spring/pulsar/v1_0/AbstractSpringPulsarTest.java b/instrumentation/spring/spring-pulsar-1.0/testing/src/main/java/io/opentelemetry/instrumentation/spring/pulsar/v1_0/AbstractSpringPulsarTest.java index 336a722fa0..2829c3ffeb 100644 --- a/instrumentation/spring/spring-pulsar-1.0/testing/src/main/java/io/opentelemetry/instrumentation/spring/pulsar/v1_0/AbstractSpringPulsarTest.java +++ b/instrumentation/spring/spring-pulsar-1.0/testing/src/main/java/io/opentelemetry/instrumentation/spring/pulsar/v1_0/AbstractSpringPulsarTest.java @@ -51,6 +51,8 @@ public abstract class AbstractSpringPulsarTest { @RegisterExtension protected static final InstrumentationExtension testing = AgentInstrumentationExtension.create(); + static final String EXPERIMENTAL_FLAG = + "otel.instrumentation.pulsar.experimental-span-attributes"; static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse("apachepulsar/pulsar:4.0.2"); static PulsarContainer pulsarContainer; @@ -121,7 +123,14 @@ public abstract class AbstractSpringPulsarTest { satisfies(MESSAGING_MESSAGE_ID, AbstractStringAssert::isNotEmpty), equalTo(SERVER_ADDRESS, brokerHost), equalTo(SERVER_PORT, brokerPort), - equalTo(MESSAGE_TYPE, "normal")); + equalTo(MESSAGE_TYPE, experimental("normal"))); + } + + protected static String experimental(String value) { + if (!Boolean.getBoolean(EXPERIMENTAL_FLAG)) { + return null; + } + return value; } protected List processAttributes() { diff --git a/instrumentation/spring/spring-rabbit-1.0/javaagent/build.gradle.kts b/instrumentation/spring/spring-rabbit-1.0/javaagent/build.gradle.kts index d3a8bcfee2..664b1804af 100644 --- a/instrumentation/spring/spring-rabbit-1.0/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-rabbit-1.0/javaagent/build.gradle.kts @@ -26,6 +26,8 @@ dependencies { tasks { test { usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service) + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") + systemProperty("collectSpans", true) } } diff --git a/instrumentation/spring/spring-rabbit-1.0/metadata.yaml b/instrumentation/spring/spring-rabbit-1.0/metadata.yaml new file mode 100644 index 0000000000..d2f998d11b --- /dev/null +++ b/instrumentation/spring/spring-rabbit-1.0/metadata.yaml @@ -0,0 +1,6 @@ +description: This instrumentation enables CONSUMER spans for Spring RabbitMQ listeners. +configurations: + - name: otel.instrumentation.messaging.experimental.capture-headers + description: A comma-separated list of header names to capture as span attributes. + type: list + default: '' diff --git a/instrumentation/spring/spring-rmi-4.0/javaagent/build.gradle.kts b/instrumentation/spring/spring-rmi-4.0/javaagent/build.gradle.kts index 0ad0491813..b4e41d6531 100644 --- a/instrumentation/spring/spring-rmi-4.0/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-rmi-4.0/javaagent/build.gradle.kts @@ -35,6 +35,8 @@ otelJava { tasks.withType().configureEach { jvmArgs("-Djava.rmi.server.hostname=127.0.0.1") + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") + systemProperty("collectSpans", true) } configurations.testRuntimeClasspath { diff --git a/instrumentation/spring/spring-rmi-4.0/metadata.yaml b/instrumentation/spring/spring-rmi-4.0/metadata.yaml new file mode 100644 index 0000000000..9c6f21ea24 --- /dev/null +++ b/instrumentation/spring/spring-rmi-4.0/metadata.yaml @@ -0,0 +1 @@ +description: This instrumentation enables CLIENT and SERVER spans for Spring RMI applications. diff --git a/instrumentation/spring/spring-scheduling-3.1/javaagent/build.gradle.kts b/instrumentation/spring/spring-scheduling-3.1/javaagent/build.gradle.kts index 06df6d1fb2..d121a4b56e 100644 --- a/instrumentation/spring/spring-scheduling-3.1/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-scheduling-3.1/javaagent/build.gradle.kts @@ -20,13 +20,20 @@ dependencies { testLibrary("org.springframework:spring-context:3.2.3.RELEASE") } -tasks.withType().configureEach { - // TODO run tests both with and without experimental span attributes - jvmArgs("-Dotel.instrumentation.spring-scheduling.experimental-span-attributes=true") +tasks { + withType().configureEach { + // required on jdk17 + jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED") + jvmArgs("-XX:+IgnoreUnrecognizedVMOptions") - // required on jdk17 - jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED") - jvmArgs("-XX:+IgnoreUnrecognizedVMOptions") + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") + systemProperty("collectSpans", true) + } + + val testExperimental by registering(Test::class) { + jvmArgs("-Dotel.instrumentation.spring-scheduling.experimental-span-attributes=true") + systemProperty("metaDataConfig", "otel.instrumentation.spring-scheduling.experimental-span-attributes=true") + } } val latestDepTest = findProperty("testLatestDeps") as Boolean diff --git a/instrumentation/spring/spring-scheduling-3.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/scheduling/v3_1/SpringSchedulingTest.java b/instrumentation/spring/spring-scheduling-3.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/scheduling/v3_1/SpringSchedulingTest.java index f6a01be908..89a0f436ce 100644 --- a/instrumentation/spring/spring-scheduling-3.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/scheduling/v3_1/SpringSchedulingTest.java +++ b/instrumentation/spring/spring-scheduling-3.1/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/spring/scheduling/v3_1/SpringSchedulingTest.java @@ -39,6 +39,9 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext class SpringSchedulingTest { + private static final String EXPERIMENTAL_FLAG = + "otel.instrumentation.spring-scheduling.experimental-span-attributes"; + @RegisterExtension private static final InstrumentationExtension testing = AgentInstrumentationExtension.create(); @@ -54,6 +57,9 @@ class SpringSchedulingTest { } } + private static final String JOB_SYSTEM = + Boolean.getBoolean(EXPERIMENTAL_FLAG) ? "spring_scheduling" : null; + @Test void scheduleCronExpressionTest() throws InterruptedException { try (AnnotationConfigApplicationContext context = @@ -62,7 +68,7 @@ class SpringSchedulingTest { task.blockUntilExecute(); List assertions = codeFunctionAssertions(TriggerTask.class, "run"); - assertions.add(equalTo(AttributeKey.stringKey("job.system"), "spring_scheduling")); + assertions.add(equalTo(AttributeKey.stringKey("job.system"), JOB_SYSTEM)); assertThat(task).isNotNull(); testing.waitAndAssertTraces( @@ -83,7 +89,7 @@ class SpringSchedulingTest { task.blockUntilExecute(); List assertions = codeFunctionAssertions(IntervalTask.class, "run"); - assertions.add(equalTo(AttributeKey.stringKey("job.system"), "spring_scheduling")); + assertions.add(equalTo(AttributeKey.stringKey("job.system"), JOB_SYSTEM)); assertThat(task).isNotNull(); testing.waitAndAssertTraces( @@ -105,7 +111,7 @@ class SpringSchedulingTest { List assertions = codeFunctionPrefixAssertions(LambdaTaskConfigurer.class.getName() + "$$Lambda", "run"); - assertions.add(equalTo(AttributeKey.stringKey("job.system"), "spring_scheduling")); + assertions.add(equalTo(AttributeKey.stringKey("job.system"), JOB_SYSTEM)); assertThat(configurer).isNotNull(); testing.waitAndAssertTraces( @@ -127,7 +133,7 @@ class SpringSchedulingTest { List assertions = codeFunctionAssertions(EnhancedClassTaskConfig.class, "run"); - assertions.add(equalTo(AttributeKey.stringKey("job.system"), "spring_scheduling")); + assertions.add(equalTo(AttributeKey.stringKey("job.system"), JOB_SYSTEM)); assertThat(latch).isNotNull(); testing.waitAndAssertTraces( @@ -148,7 +154,7 @@ class SpringSchedulingTest { task.blockUntilExecute(); List assertions = codeFunctionAssertions(TaskWithError.class, "run"); - assertions.add(equalTo(AttributeKey.stringKey("job.system"), "spring_scheduling")); + assertions.add(equalTo(AttributeKey.stringKey("job.system"), JOB_SYSTEM)); assertThat(task).isNotNull(); testing.waitAndAssertTraces( diff --git a/instrumentation/spring/spring-scheduling-3.1/metadata.yaml b/instrumentation/spring/spring-scheduling-3.1/metadata.yaml new file mode 100644 index 0000000000..d246e78144 --- /dev/null +++ b/instrumentation/spring/spring-scheduling-3.1/metadata.yaml @@ -0,0 +1,6 @@ +description: This instrumentation enables tracing for Spring Scheduling tasks. +configurations: + - name: otel.instrumentation.spring-scheduling.experimental-span-attributes + description: Adds the experimental span attribute `job.system` with the value `spring_scheduling`. + type: boolean + default: false diff --git a/instrumentation/spring/spring-security-config-6.0/library/build.gradle.kts b/instrumentation/spring/spring-security-config-6.0/library/build.gradle.kts index 368eb02725..e4ee6cb557 100644 --- a/instrumentation/spring/spring-security-config-6.0/library/build.gradle.kts +++ b/instrumentation/spring/spring-security-config-6.0/library/build.gradle.kts @@ -18,3 +18,9 @@ dependencies { otelJava { minJavaVersionSupported.set(JavaVersion.VERSION_17) } + +tasks.test { + systemProperty("metaDataConfig", "otel.instrumentation.common.enduser.id.enabled=true,otel.instrumentation.common.enduser.role.enabled=true,otel.instrumentation.common.enduser.scope.enabled=true") + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") + systemProperty("collectSpans", true) +} diff --git a/instrumentation/spring/spring-security-config-6.0/metadata.yaml b/instrumentation/spring/spring-security-config-6.0/metadata.yaml new file mode 100644 index 0000000000..a009f50b52 --- /dev/null +++ b/instrumentation/spring/spring-security-config-6.0/metadata.yaml @@ -0,0 +1,26 @@ +description: > + This instrumentation does not emit any telemetry on its own. Instead, it captures enduser + attributes, and is only enabled when at least one of the `enduser` configurations is enabled. + + NOTE: The `enduser` attributes have been deprecated and will be removed in 3.0+ of the java agent. +configurations: + - name: otel.instrumentation.common.enduser.id.enabled + description: Enables capturing the enduser.id attribute. + type: boolean + default: false + - name: otel.instrumentation.common.enduser.role.enabled + description: Enables capturing the enduser.role attribute. + type: boolean + default: false + - name: otel.instrumentation.common.enduser.scope.enabled + description: Enables capturing the enduser.scope attribute. + type: boolean + default: false + - name: otel.instrumentation.spring-security.enduser.role.granted-authority-prefix + description: Prefix of granted authorities identifying roles to capture in the `enduser.role` semantic attribute. + type: String + default: "ROLE_" + - name: otel.instrumentation.spring-security.scope.role.granted-authority-prefix + description: Prefix of granted authorities identifying scopes to capture in the `enduser.scopes` semantic attribute. + type: String + default: "SCOPE_" diff --git a/instrumentation/spring/spring-web/spring-web-3.1/library/build.gradle.kts b/instrumentation/spring/spring-web/spring-web-3.1/library/build.gradle.kts index f852b2dccb..adb16fab93 100644 --- a/instrumentation/spring/spring-web/spring-web-3.1/library/build.gradle.kts +++ b/instrumentation/spring/spring-web/spring-web-3.1/library/build.gradle.kts @@ -19,3 +19,10 @@ if (latestDepTest) { minJavaVersionSupported.set(JavaVersion.VERSION_17) } } + +tasks { + test { + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") + systemProperty("collectSpans", true) + } +} diff --git a/instrumentation/spring/spring-web/spring-web-3.1/metadata.yaml b/instrumentation/spring/spring-web/spring-web-3.1/metadata.yaml new file mode 100644 index 0000000000..969b249906 --- /dev/null +++ b/instrumentation/spring/spring-web/spring-web-3.1/metadata.yaml @@ -0,0 +1,4 @@ +description: > + This instrumentation provides a library integration that enables capturing HTTP client spans and + metrics for Spring's RestTemplate. The agent integration enriches HTTP server spans and metrics + with route information. diff --git a/instrumentation/spring/spring-web/spring-web-6.0/metadata.yaml b/instrumentation/spring/spring-web/spring-web-6.0/metadata.yaml new file mode 100644 index 0000000000..4b044e2b1f --- /dev/null +++ b/instrumentation/spring/spring-web/spring-web-6.0/metadata.yaml @@ -0,0 +1 @@ +description: This instrumentation enriches HTTP server spans and metrics with route information. diff --git a/instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/build.gradle.kts b/instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/build.gradle.kts index 77bd0dad31..6885a644e7 100644 --- a/instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-webflux/spring-webflux-5.0/javaagent/build.gradle.kts @@ -61,18 +61,20 @@ dependencies { testLibrary("org.springframework.boot:spring-boot-starter-reactor-netty:2.0.0.RELEASE") } +val latestDepTest = findProperty("testLatestDeps") as Boolean + tasks.withType().configureEach { // required on jdk17 jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED") jvmArgs("-XX:+IgnoreUnrecognizedVMOptions") jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true") - systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) + systemProperty("metaDataConfig", "otel.instrumentation.common.experimental.controller-telemetry.enabled") + systemProperty("testLatestDeps", latestDepTest) systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") + systemProperty("collectSpans", true) } -val latestDepTest = findProperty("testLatestDeps") as Boolean - if (latestDepTest) { // spring 6 requires java 17 otelJava { diff --git a/instrumentation/spring/spring-webflux/spring-webflux-5.0/metadata.yaml b/instrumentation/spring/spring-webflux/spring-webflux-5.0/metadata.yaml new file mode 100644 index 0000000000..630264ea79 --- /dev/null +++ b/instrumentation/spring/spring-webflux/spring-webflux-5.0/metadata.yaml @@ -0,0 +1,8 @@ +description: > + This instrumentation enables HTTP client spans and metrics for Spring WebFlux 5.0. It also + optionally enables experimental controller (INTERNAL) spans. +configurations: + - name: otel.instrumentation.common.experimental.controller-telemetry.enabled + description: Enables the creation of experimental controller (INTERNAL) spans. + type: boolean + default: false diff --git a/instrumentation/spring/spring-webflux/spring-webflux-5.3/library/build.gradle.kts b/instrumentation/spring/spring-webflux/spring-webflux-5.3/library/build.gradle.kts index 1df4b62e19..79dd2fa4d6 100644 --- a/instrumentation/spring/spring-webflux/spring-webflux-5.3/library/build.gradle.kts +++ b/instrumentation/spring/spring-webflux/spring-webflux-5.3/library/build.gradle.kts @@ -33,3 +33,10 @@ if (!latestDepTest) { } } } + +tasks { + test { + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") + systemProperty("collectSpans", true) + } +} diff --git a/instrumentation/spring/spring-webflux/spring-webflux-5.3/metadata.yaml b/instrumentation/spring/spring-webflux/spring-webflux-5.3/metadata.yaml new file mode 100644 index 0000000000..4879f014a1 --- /dev/null +++ b/instrumentation/spring/spring-webflux/spring-webflux-5.3/metadata.yaml @@ -0,0 +1,3 @@ +description: > + This instrumentation provides a library integration for the Spring WebFlux WebClient and Webflux + server versions 5.3+ that enables HTTP client and server spans and metrics. diff --git a/instrumentation/spring/spring-webmvc/spring-webmvc-3.1/javaagent/build.gradle.kts b/instrumentation/spring/spring-webmvc/spring-webmvc-3.1/javaagent/build.gradle.kts index 165c8b343c..66fb89da2d 100644 --- a/instrumentation/spring/spring-webmvc/spring-webmvc-3.1/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-webmvc/spring-webmvc-3.1/javaagent/build.gradle.kts @@ -43,16 +43,29 @@ dependencies { latestDepTestLibrary("org.springframework.boot:spring-boot-starter-security:2.+") // see spring-webmvc-6.0 module } -tasks.withType().configureEach { - systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) +tasks { + withType().configureEach { + systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) - // TODO run tests both with and without experimental span attributes - jvmArgs("-Dotel.instrumentation.spring-webmvc.experimental-span-attributes=true") - // required on jdk17 - jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED") - jvmArgs("-XX:+IgnoreUnrecognizedVMOptions") - jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true") - jvmArgs("-Dotel.instrumentation.common.experimental.view-telemetry.enabled=true") + // required on jdk17 + jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED") + jvmArgs("-XX:+IgnoreUnrecognizedVMOptions") + + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") + systemProperty("collectSpans", true) + + jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true") + jvmArgs("-Dotel.instrumentation.common.experimental.view-telemetry.enabled=true") + } + + val testExperimental by registering(Test::class) { + systemProperty("metaDataConfig", "otel.instrumentation.spring-webmvc.experimental-span-attributes=true") + jvmArgs("-Dotel.instrumentation.spring-webmvc.experimental-span-attributes=true") + } + + check { + dependsOn(testExperimental) + } } configurations.testRuntimeClasspath { diff --git a/instrumentation/spring/spring-webmvc/spring-webmvc-3.1/metadata.yaml b/instrumentation/spring/spring-webmvc/spring-webmvc-3.1/metadata.yaml new file mode 100644 index 0000000000..44d7d559e3 --- /dev/null +++ b/instrumentation/spring/spring-webmvc/spring-webmvc-3.1/metadata.yaml @@ -0,0 +1,17 @@ +description: > + This instrumentation enables optional Controller and View (INTERNAL) spans for Spring WebMVC 3.1+. +configurations: + - name: otel.instrumentation.spring-webmvc.experimental-span-attributes + type: boolean + default: false + description: > + Enables the capture of experimental span attributes `spring-webmvc-view-name` and + `spring-webmvc.view.type`. + - name: otel.instrumentation.common.experimental.controller-telemetry.enabled + description: Enables the creation of experimental controller (INTERNAL) spans. + type: boolean + default: false + - name: otel.instrumentation.common.experimental.view-telemetry.enabled + description: Enables the creation of experimental view (INTERNAL) spans. + type: boolean + default: false diff --git a/instrumentation/spring/spring-webmvc/spring-webmvc-5.3/library/build.gradle.kts b/instrumentation/spring/spring-webmvc/spring-webmvc-5.3/library/build.gradle.kts index be39fee5a4..6ab8b90a33 100644 --- a/instrumentation/spring/spring-webmvc/spring-webmvc-5.3/library/build.gradle.kts +++ b/instrumentation/spring/spring-webmvc/spring-webmvc-5.3/library/build.gradle.kts @@ -22,3 +22,10 @@ configurations.testRuntimeClasspath { force("org.slf4j:slf4j-api:1.7.36") } } + +tasks { + test { + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") + systemProperty("collectSpans", true) + } +} diff --git a/instrumentation/spring/spring-webmvc/spring-webmvc-5.3/metadata.yaml b/instrumentation/spring/spring-webmvc/spring-webmvc-5.3/metadata.yaml new file mode 100644 index 0000000000..4beb4df459 --- /dev/null +++ b/instrumentation/spring/spring-webmvc/spring-webmvc-5.3/metadata.yaml @@ -0,0 +1,4 @@ +description: > + This instrumentation provides a library integration for Spring WebMVC controllers, that enables + the creation of HTTP server spans and metrics for requests processed by the Spring servlet + container. diff --git a/instrumentation/spring/spring-webmvc/spring-webmvc-6.0/javaagent/build.gradle.kts b/instrumentation/spring/spring-webmvc/spring-webmvc-6.0/javaagent/build.gradle.kts index 312b38583a..d5a9a3c814 100644 --- a/instrumentation/spring/spring-webmvc/spring-webmvc-6.0/javaagent/build.gradle.kts +++ b/instrumentation/spring/spring-webmvc/spring-webmvc-6.0/javaagent/build.gradle.kts @@ -44,14 +44,26 @@ otelJava { minJavaVersionSupported.set(JavaVersion.VERSION_17) } -tasks.withType().configureEach { - // TODO run tests both with and without experimental span attributes - jvmArgs("-Dotel.instrumentation.spring-webmvc.experimental-span-attributes=true") - // required on jdk17 - jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED") - jvmArgs("-XX:+IgnoreUnrecognizedVMOptions") - jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true") - jvmArgs("-Dotel.instrumentation.common.experimental.view-telemetry.enabled=true") +tasks { + withType().configureEach { + // required on jdk17 + jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED") + jvmArgs("-XX:+IgnoreUnrecognizedVMOptions") + jvmArgs("-Dotel.instrumentation.common.experimental.controller-telemetry.enabled=true") + jvmArgs("-Dotel.instrumentation.common.experimental.view-telemetry.enabled=true") - systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) + systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false") + systemProperty("collectSpans", true) + + systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean) + } + + val testExperimental by registering(Test::class) { + systemProperty("metaDataConfig", "otel.instrumentation.spring-webmvc.experimental-span-attributes=true") + jvmArgs("-Dotel.instrumentation.spring-webmvc.experimental-span-attributes=true") + } + + check { + dependsOn(testExperimental) + } } diff --git a/instrumentation/spring/spring-webmvc/spring-webmvc-6.0/metadata.yaml b/instrumentation/spring/spring-webmvc/spring-webmvc-6.0/metadata.yaml new file mode 100644 index 0000000000..a38d74b6f0 --- /dev/null +++ b/instrumentation/spring/spring-webmvc/spring-webmvc-6.0/metadata.yaml @@ -0,0 +1,17 @@ +description: > + This instrumentation enables optional Controller and View (INTERNAL) spans for Spring WebMVC 6.0+. +configurations: + - name: otel.instrumentation.spring-webmvc.experimental-span-attributes + type: boolean + default: false + description: > + Enables the capture of experimental span attributes `spring-webmvc-view-name` and + `spring-webmvc.view.type`. + - name: otel.instrumentation.common.experimental.controller-telemetry.enabled + description: Enables the creation of experimental controller (INTERNAL) spans. + type: boolean + default: false + - name: otel.instrumentation.common.experimental.view-telemetry.enabled + description: Enables the creation of experimental view (INTERNAL) spans. + type: boolean + default: false diff --git a/instrumentation/spring/spring-webmvc/spring-webmvc-common/testing/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/boot/AbstractSpringBootBasedTest.java b/instrumentation/spring/spring-webmvc/spring-webmvc-common/testing/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/boot/AbstractSpringBootBasedTest.java index 10c2f4cc62..f4ec82ce41 100644 --- a/instrumentation/spring/spring-webmvc/spring-webmvc-common/testing/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/boot/AbstractSpringBootBasedTest.java +++ b/instrumentation/spring/spring-webmvc/spring-webmvc-common/testing/src/main/java/io/opentelemetry/instrumentation/spring/webmvc/boot/AbstractSpringBootBasedTest.java @@ -51,6 +51,9 @@ import org.springframework.web.servlet.view.RedirectView; public abstract class AbstractSpringBootBasedTest extends AbstractHttpServerTest { + private static final String EXPERIMENTAL_SPAN_CONFIG = + "otel.instrumentation.spring-webmvc.experimental-span-attributes"; + protected abstract ConfigurableApplicationContext context(); protected abstract Class securityConfigClass(); @@ -177,7 +180,8 @@ public abstract class AbstractSpringBootBasedTest .hasKind(SpanKind.INTERNAL) .hasAttributesSatisfyingExactly( equalTo( - AttributeKey.stringKey("spring-webmvc.view.type"), RedirectView.class.getName())); + AttributeKey.stringKey("spring-webmvc.view.type"), + experimental(RedirectView.class.getName()))); return span; } @@ -208,6 +212,13 @@ public abstract class AbstractSpringBootBasedTest return span; } + private static String experimental(String value) { + if (!Boolean.getBoolean(EXPERIMENTAL_SPAN_CONFIG)) { + return null; + } + return value; + } + private static String getHandlerSpanName(ServerEndpoint endpoint) { if (QUERY_PARAM.equals(endpoint)) { return "TestController.queryParam";