Skip to content

Commit 01a1afe

Browse files
jaydelucalaurit
andauthored
Add more metadata descriptions, configs, and fix NPE in jdbc (#13854)
Co-authored-by: Lauri Tulmin <[email protected]>
1 parent 6a79a65 commit 01a1afe

File tree

13 files changed

+116
-5
lines changed

13 files changed

+116
-5
lines changed

docs/instrumentation-list.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ libraries:
6262
target_versions:
6363
javaagent:
6464
- org.apache.shenyu:shenyu-web:[2.4.0,)
65+
configurations:
66+
- name: otel.instrumentation.apache-shenyu.experimental-span-attributes
67+
description: Enables experimental span attributes for Apache Shenyu instrumentation.
68+
type: boolean
69+
default: false
6570
- name: apache-httpclient-2.0
6671
source_path: instrumentation/apache-httpclient/apache-httpclient-2.0
6772
scope:
@@ -92,12 +97,22 @@ libraries:
9297
- io.dropwizard:dropwizard-client:(,3.0.0)
9398
- org.apache.httpcomponents:httpclient:[4.0,)
9499
- name: apache-dubbo-2.7
100+
description: The Apache Dubbo instrumentation provides client and server spans
101+
for Apache Dubbo RPC calls. Each call produces a span named after the Dubbo
102+
method, enriched with standard RPC attributes (system, service, method), network
103+
attributes, and error details if an exception occurs.
95104
source_path: instrumentation/apache-dubbo-2.7
96105
scope:
97106
name: io.opentelemetry.apache-dubbo-2.7
98107
target_versions:
99108
javaagent:
100109
- org.apache.dubbo:dubbo:[2.7,)
110+
configurations:
111+
- name: otel.instrumentation.common.peer-service-mapping
112+
description: Used to specify a mapping from host names or IP addresses to peer
113+
services.
114+
type: map
115+
default: ''
101116
- name: apache-httpclient-5.2
102117
source_path: instrumentation/apache-httpclient/apache-httpclient-5.2
103118
scope:
@@ -166,6 +181,8 @@ libraries:
166181
- io.avaje:avaje-jex:[3.0,)
167182
aws:
168183
- name: aws-lambda-events-2.2
184+
description: |
185+
Provides full instrumentation of the Lambda library, including standard and custom event types, from `aws-lambda-java-events` 2.2+.
169186
source_path: instrumentation/aws-lambda/aws-lambda-events-2.2
170187
scope:
171188
name: io.opentelemetry.aws-lambda-events-2.2
@@ -175,7 +192,14 @@ libraries:
175192
library:
176193
- com.amazonaws:aws-lambda-java-events:2.2.1
177194
- com.amazonaws:aws-lambda-java-core:1.0.0
195+
configurations:
196+
- name: otel.instrumentation.aws-lambda.flush-timeout
197+
description: Flush timeout in milliseconds.
198+
type: int
199+
default: 10000
178200
- name: aws-lambda-core-1.0
201+
description: |
202+
Provides lightweight instrumentation of the Lambda core library, supporting all versions. Use this package if you only use `RequestStreamHandler` or know you don't use any event classes from `aws-lambda-java-events`. This also includes when you are using `aws-serverless-java-container` to run e.g., a Spring Boot application on Lambda.
179203
source_path: instrumentation/aws-lambda/aws-lambda-core-1.0
180204
scope:
181205
name: io.opentelemetry.aws-lambda-core-1.0
@@ -184,6 +208,11 @@ libraries:
184208
- com.amazonaws:aws-lambda-java-core:[1.0.0,)
185209
library:
186210
- com.amazonaws:aws-lambda-java-core:1.0.0
211+
configurations:
212+
- name: otel.instrumentation.aws-lambda.flush-timeout
213+
description: Flush timeout in milliseconds.
214+
type: int
215+
default: 10000
187216
- name: aws-sdk-1.11
188217
source_path: instrumentation/aws-sdk/aws-sdk-1.11
189218
scope:
@@ -195,6 +224,19 @@ libraries:
195224
library:
196225
- com.amazonaws:aws-java-sdk-sqs:[1.11.106,1.12.583)
197226
- com.amazonaws:aws-java-sdk-core:1.11.0
227+
configurations:
228+
- name: otel.instrumentation.aws-sdk.experimental-span-attributes
229+
description: Enables experimental span attributes for AWS SDK instrumentation.
230+
type: boolean
231+
default: false
232+
- name: otel.instrumentation.messaging.experimental.receive-telemetry.enabled
233+
description: Enables experimental receive telemetry for AWS SDK instrumentation.
234+
type: boolean
235+
default: false
236+
- name: otel.instrumentation.messaging.experimental.capture-headers
237+
description: Allows configuring headers to capture as span attributes.
238+
type: list
239+
default: ''
198240
- name: aws-sdk-2.2
199241
source_path: instrumentation/aws-sdk/aws-sdk-2.2
200242
scope:
@@ -779,11 +821,21 @@ libraries:
779821
description: Enables statement sanitization for database queries.
780822
type: boolean
781823
default: true
824+
- name: otel.instrumentation.jdbc.experimental.transaction.enabled
825+
description: Enables experimental instrumentation to create spans for COMMIT
826+
and ROLLBACK operations.
827+
type: boolean
828+
default: false
782829
- name: otel.instrumentation.common.peer-service-mapping
783830
description: Used to specify a mapping from host names or IP addresses to peer
784831
services.
785832
type: map
786833
default: ''
834+
- name: otel.instrumentation.jdbc.capture-query-parameters
835+
description: |
836+
Sets whether the query parameters should be captured as span attributes named <code>db.query.parameter.&lt;key&gt;</code>. Enabling this option disables the statement sanitization.<p>WARNING: captured query parameters may contain sensitive information such as passwords, personally identifiable information or protected health info.
837+
type: boolean
838+
default: false
787839
- name: otel.instrumentation.jdbc-datasource.enabled
788840
description: Enables instrumentation of JDBC datasource connections.
789841
type: boolean

instrumentation-docs/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies {
1818
}
1919

2020
tasks {
21-
val generateDocs by registering(JavaExec::class) {
21+
val runAnalysis by registering(JavaExec::class) {
2222
dependsOn(classes)
2323

2424
mainClass.set("io.opentelemetry.instrumentation.docs.DocGeneratorApplication")

instrumentation-docs/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Runs analysis on instrumentation modules in order to generate documentation.
44

55
## How to use
66

7-
Run the doc generator:
7+
Run the analysis to update the instrumentation-list.yaml:
88

9-
`./gradlew :instrumentation-docs:generateDocs`
9+
`./gradlew :instrumentation-docs:runAnalysis`
1010

1111
## Instrumentation Hierarchy
1212

instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/InstrumentationAnalyzer.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import static io.opentelemetry.instrumentation.docs.parsers.GradleParser.parseGradleFile;
99

1010
import com.fasterxml.jackson.core.JsonProcessingException;
11+
import com.fasterxml.jackson.databind.exc.ValueInstantiationException;
1112
import io.opentelemetry.instrumentation.docs.internal.DependencyInfo;
1213
import io.opentelemetry.instrumentation.docs.internal.InstrumentationModule;
1314
import io.opentelemetry.instrumentation.docs.internal.InstrumentationType;
@@ -20,9 +21,12 @@
2021
import java.util.List;
2122
import java.util.Map;
2223
import java.util.Set;
24+
import java.util.logging.Logger;
2325

2426
class InstrumentationAnalyzer {
2527

28+
private static final Logger logger = Logger.getLogger(InstrumentationAnalyzer.class.getName());
29+
2630
private final FileManager fileManager;
2731

2832
InstrumentationAnalyzer(FileManager fileManager) {
@@ -73,7 +77,12 @@ List<InstrumentationModule> analyze() throws JsonProcessingException {
7377

7478
String metadataFile = fileManager.getMetaDataFile(module.getSrcPath());
7579
if (metadataFile != null) {
76-
module.setMetadata(YamlHelper.metaDataParser(metadataFile));
80+
try {
81+
module.setMetadata(YamlHelper.metaDataParser(metadataFile));
82+
} catch (ValueInstantiationException e) {
83+
logger.severe("Error parsing metadata file for " + module.getInstrumentationName());
84+
throw e;
85+
}
7786
}
7887
}
7988
return modules;

instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/internal/ConfigurationType.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
public enum ConfigurationType {
1717
BOOLEAN("boolean"),
1818
STRING("string"),
19+
INT("int"),
1920
MAP("map"),
2021
LIST("list");
2122

instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/utils/YamlHelper.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ private static Map<String, Object> baseProperties(InstrumentationModule module)
153153
conf.put("type", configuration.type().toString());
154154
if (configuration.type().equals(ConfigurationType.BOOLEAN)) {
155155
conf.put("default", Boolean.parseBoolean(configuration.defaultValue()));
156+
} else if (configuration.type().equals(ConfigurationType.INT)) {
157+
conf.put("default", Integer.parseInt(configuration.defaultValue()));
156158
} else {
157159
conf.put("default", configuration.defaultValue());
158160
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
description: The Apache Dubbo instrumentation provides client and server spans for Apache Dubbo
2+
RPC calls. Each call produces a span named after the Dubbo method, enriched with standard RPC
3+
attributes (system, service, method), network attributes, and error details if an exception
4+
occurs.
5+
configurations:
6+
- name: otel.instrumentation.common.peer-service-mapping
7+
description: Used to specify a mapping from host names or IP addresses to peer services.
8+
type: map
9+
default: ''
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
configurations:
2+
- name: otel.instrumentation.apache-shenyu.experimental-span-attributes
3+
description: Enables experimental span attributes for Apache Shenyu instrumentation.
4+
type: boolean
5+
default: false

instrumentation/armeria/armeria-1.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/armeria/v1_3/ServerDecorator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ServerDecorator extends SimpleDecoratingHttpService {
2828

2929
@Override
3030
public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exception {
31-
// If there is no server span fall back to armeria liberary instrumentation. Server span is
31+
// If there is no server span fall back to armeria library instrumentation. Server span is
3232
// usually created by netty instrumentation, it can be missing when netty instrumentation is
3333
// disabled or when http2 is used (netty instrumentation does not support http2).
3434
if (!LocalRootSpan.current().getSpanContext().isValid()) {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
description: >
2+
Provides lightweight instrumentation of the Lambda core library, supporting all versions. Use this
3+
package if you only use `RequestStreamHandler` or know you don't use any event classes from
4+
`aws-lambda-java-events`. This also includes when you are using `aws-serverless-java-container` to
5+
run e.g., a Spring Boot application on Lambda.
6+
configurations:
7+
- name: otel.instrumentation.aws-lambda.flush-timeout
8+
type: int
9+
default: 10000
10+
description: Flush timeout in milliseconds.

0 commit comments

Comments
 (0)