Skip to content

Commit 4d63ab1

Browse files
committed
Merge branch 'main' into grpc-req-res-size
2 parents e1ec0f3 + 6fc2783 commit 4d63ab1

File tree

63 files changed

+537
-193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+537
-193
lines changed

conventions/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ dependencies {
5858
implementation("com.google.guava:guava:33.4.8-jre")
5959
implementation("com.gradleup.shadow:shadow-gradle-plugin:9.1.0")
6060
implementation("org.apache.httpcomponents:httpclient:4.5.14")
61-
implementation("com.gradle.develocity:com.gradle.develocity.gradle.plugin:4.1.1")
61+
implementation("com.gradle.develocity:com.gradle.develocity.gradle.plugin:4.2")
6262
implementation("org.owasp:dependency-check-gradle:12.1.3")
6363
implementation("ru.vyarus:gradle-animalsniffer-plugin:2.0.1")
6464
implementation("org.spdx:spdx-gradle-plugin:0.9.0")

conventions/src/main/kotlin/otel.nullaway-conventions.gradle.kts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,19 @@ nullaway {
1818

1919
tasks {
2020
withType<JavaCompile>().configureEach {
21-
if (!name.contains("test", ignoreCase = true)) {
21+
if (name.contains("test", ignoreCase = true)) {
22+
options.errorprone.nullaway {
23+
enabled = false
24+
}
25+
} else {
2226
options.errorprone.nullaway {
2327
severity.set(CheckSeverity.ERROR)
2428
}
2529
}
30+
options.errorprone.nullaway {
31+
customInitializerAnnotations.add("org.openjdk.jmh.annotations.Setup")
32+
excludedFieldAnnotations.add("org.mockito.Mock")
33+
excludedFieldAnnotations.add("org.mockito.InjectMocks")
34+
}
2635
}
2736
}

dependencyManagement/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ val DEPENDENCIES = listOf(
8989
"com.github.stefanbirkner:system-lambda:1.2.1",
9090
"com.github.stefanbirkner:system-rules:1.19.0",
9191
"uk.org.webcompere:system-stubs-jupiter:2.0.3",
92-
"com.uber.nullaway:nullaway:0.12.9",
92+
"com.uber.nullaway:nullaway:0.12.10",
9393
"commons-beanutils:commons-beanutils:1.11.0",
9494
"commons-cli:commons-cli:1.10.0",
9595
"commons-codec:commons-codec:1.19.0",
@@ -107,6 +107,7 @@ val DEPENDENCIES = listOf(
107107
"io.opentelemetry.contrib:opentelemetry-gcp-resources:${otelContribVersion}",
108108
"io.opentelemetry.contrib:opentelemetry-cloudfoundry-resources:${otelContribVersion}",
109109
"io.opentelemetry.contrib:opentelemetry-baggage-processor:${otelContribVersion}",
110+
"io.opentelemetry.contrib:opentelemetry-samplers:${otelContribVersion}",
110111
"io.opentelemetry.proto:opentelemetry-proto:1.8.0-alpha",
111112
"io.opentelemetry:opentelemetry-extension-annotations:1.18.0", // deprecated, no longer part of bom
112113
"org.assertj:assertj-core:3.27.4",

docs/contributing/documenting-instrumentation.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ Example:
8484

8585
```yaml
8686
description: "This instrumentation enables..."
87+
semantic_conventions:
88+
- HTTP_CLIENT_SPANS
89+
- DATABASE_CLIENT_SPANS
90+
- JVM_RUNTIME_METRICS
8791
disabled_by_default: true
8892
classification: library
8993
library_link: https://github.com/...
@@ -128,6 +132,32 @@ Some notes when writing descriptions:
128132
* It is not usually necessary to include specific library or framework version numbers in the
129133
description, unless that context is significant in some way.
130134

135+
136+
### Semantic Conventions
137+
138+
If the instrumentation adheres to one or more specific semantic conventions, include a
139+
`semantic_conventions` field with a list of the relevant semantic convention categories.
140+
141+
List of possible options:
142+
143+
* [HTTP_CLIENT_SPANS](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md#http-client)
144+
* [HTTP_CLIENT_METRICS](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-metrics.md#http-client)
145+
* [HTTP_SERVER_SPANS](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md#http-server)
146+
* [HTTP_SERVER_METRICS](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-metrics.md#http-server)
147+
* [RPC_CLIENT_SPANS](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/rpc/rpc-spans.md#client-attributes)
148+
* [RPC_CLIENT_METRICS](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/rpc/rpc-metrics.md#rpc-client)
149+
* [RPC_SERVER_SPANS](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/rpc/rpc-spans.md#server-attributes)
150+
* [RPC_SERVER_METRICS](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/rpc/rpc-metrics.md#rpc-server)
151+
* [MESSAGING_SPANS](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/messaging/messaging-spans.md)
152+
* [DATABASE_CLIENT_SPANS](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/database/database-spans.md)
153+
* [DATABASE_CLIENT_METRICS](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/database/database-metrics.md)
154+
* [DATABASE_POOL_METRICS](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/database/database-metrics.md)
155+
* [JVM_RUNTIME_METRICS](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/runtime/jvm-metrics.md)
156+
* [GRAPHQL_SERVER_SPANS](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/graphql/graphql-spans.md)
157+
* [FAAS_SERVER_SPANS](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/faas/faas-spans.md)
158+
* [GENAI_CLIENT_SPANS](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/gen-ai/gen-ai-spans.md)
159+
* [GENAI_CLIENT_METRICS](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/gen-ai/gen-ai-metrics.md#generative-ai-client-metrics)
160+
131161
### Library Link
132162

133163
For library instrumentations, include a `library_link` field with a URL to the library or framework's
@@ -190,8 +220,22 @@ within 24 hours.
190220

191221
## opentelemetry.io
192222

193-
All of our instrumentation modules are listed on the opentelemetry.io website in the context of how
194-
to [suppress specific instrumentation](https://opentelemetry.io/docs/zero-code/java/agent/disable/#suppressing-specific-agent-instrumentation).
223+
All of our instrumentation modules are listed on the opentelemetry.io website in two places:
224+
225+
### Supported Libraries
226+
227+
The [Supported Libraries](https://opentelemetry.io/docs/zero-code/java/agent/supported-libraries/)
228+
page lists all the library instrumentations that are included in the OpenTelemetry Java agent. It
229+
mostly mirrors the information from the [supported libraries](../supported-libraries.md) page in
230+
this repo, and should be updated when adding or removing library instrumentations.
231+
232+
This page may be automatically generated in the future, but for now it is manually maintained.
233+
234+
### Suppressing Instrumentation
235+
236+
The [Suppressing instrumentation](https://opentelemetry.io/docs/zero-code/java/agent/disable/#suppressing-specific-agent-instrumentation)
237+
page lists the instrumentations in the context of the keys needed for using
238+
the `otel.instrumentation.[name].enabled` configuration.
195239

196240
All new instrumentations should be added to this list. There is a
197241
[Github action](../../.github/workflows/documentation-disable-list-audit.yml) that runs nightly to check

docs/instrumentation-list.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ libraries:
1010
display_name: ActiveJ
1111
description: This instrumentation enables HTTP server spans and HTTP server metrics
1212
for the ActiveJ HTTP server.
13+
semantic_conventions:
14+
- HTTP_SERVER_SPANS
15+
- HTTP_SERVER_METRICS
1316
library_link: https://activej.io/
1417
source_path: instrumentation/activej-http-6.0
1518
minimum_java_version: 17
@@ -92,6 +95,11 @@ libraries:
9295
display_name: Akka HTTP
9396
description: |
9497
This instrumentation enables HTTP client spans and metrics for the Akka HTTP client, and HTTP server spans and metrics for the Akka HTTP server.
98+
semantic_conventions:
99+
- HTTP_CLIENT_SPANS
100+
- HTTP_CLIENT_METRICS
101+
- HTTP_SERVER_SPANS
102+
- HTTP_SERVER_METRICS
95103
library_link: https://doc.akka.io/docs/akka-http/current/index.html
96104
source_path: instrumentation/akka/akka-http-10.0
97105
scope:
@@ -181,6 +189,8 @@ libraries:
181189
- name: alibaba-druid-1.0
182190
description: |
183191
The Alibaba Druid instrumentation generates database connection pool metrics for druid data sources.
192+
semantic_conventions:
193+
- DATABASE_POOL_METRICS
184194
library_link: https://github.com/alibaba/druid
185195
source_path: instrumentation/alibaba-druid-1.0
186196
scope:
@@ -274,9 +284,12 @@ libraries:
274284
type: STRING
275285
apache:
276286
- name: apache-dbcp-2.0
287+
display_name: Apache DBCP
277288
description: |
278289
This instrumentation enables database connection pools metrics for Apache DBCP.
279290
The instrumentation uses `MBeanRegistration` methods for lifecycle detection, therefore it only activates if the `BasicDataSource` is registered to an `MBeanServer`. If using Spring Boot, this happens automatically as all Spring beans that support JMX registration are automatically registered by default.
291+
semantic_conventions:
292+
- DATABASE_POOL_METRICS
280293
library_link: https://commons.apache.org/proper/commons-dbcp/
281294
source_path: instrumentation/apache-dbcp-2.0
282295
scope:
@@ -354,10 +367,14 @@ libraries:
354367
- name: db.client.connection.pool.name
355368
type: STRING
356369
- name: apache-dubbo-2.7
370+
display_name: Apache Dubbo
357371
description: The Apache Dubbo instrumentation provides RPC client spans and RPC
358372
server spans for Apache Dubbo RPC calls. Each call produces a span named after
359373
the Dubbo method, enriched with standard RPC attributes (system, service, method),
360374
network attributes, and error details if an exception occurs.
375+
semantic_conventions:
376+
- RPC_CLIENT_SPANS
377+
- RPC_SERVER_SPANS
361378
library_link: https://github.com/apache/dubbo/
362379
source_path: instrumentation/apache-dubbo-2.7
363380
scope:
@@ -399,8 +416,12 @@ libraries:
399416
- name: rpc.system
400417
type: STRING
401418
- name: apache-httpasyncclient-4.1
419+
display_name: Apache HttpAsyncClient
402420
description: This instrumentation enables HTTP client spans and HTTP client metrics
403421
for the Apache HttpAsyncClient.
422+
semantic_conventions:
423+
- HTTP_CLIENT_SPANS
424+
- HTTP_CLIENT_METRICS
404425
library_link: https://hc.apache.org/index.html
405426
source_path: instrumentation/apache-httpasyncclient-4.1
406427
scope:
@@ -446,8 +467,12 @@ libraries:
446467
- name: url.full
447468
type: STRING
448469
- name: apache-httpclient-2.0
470+
display_name: Apache HttpClient
449471
description: This instrumentation enables HTTP client spans and HTTP client metrics
450472
for versions 2 and 3 of the Apache HttpClient.
473+
semantic_conventions:
474+
- HTTP_CLIENT_SPANS
475+
- HTTP_CLIENT_METRICS
451476
library_link: https://hc.apache.org/index.html
452477
source_path: instrumentation/apache-httpclient/apache-httpclient-2.0
453478
scope:
@@ -491,8 +516,12 @@ libraries:
491516
- name: url.full
492517
type: STRING
493518
- name: apache-httpclient-4.0
519+
display_name: Apache HttpClient
494520
description: This instrumentation enables HTTP client spans and HTTP client metrics
495521
for version 4 of the Apache HttpClient.
522+
semantic_conventions:
523+
- HTTP_CLIENT_SPANS
524+
- HTTP_CLIENT_METRICS
496525
library_link: https://hc.apache.org/index.html
497526
source_path: instrumentation/apache-httpclient/apache-httpclient-4.0
498527
scope:
@@ -539,8 +568,12 @@ libraries:
539568
- name: url.full
540569
type: STRING
541570
- name: apache-httpclient-4.3
571+
display_name: Apache HttpClient
542572
description: This instrumentation provides a library integration that enables
543573
HTTP client spans and HTTP client metrics for the Apache HttpClient.
574+
semantic_conventions:
575+
- HTTP_CLIENT_SPANS
576+
- HTTP_CLIENT_METRICS
544577
library_link: https://hc.apache.org/index.html
545578
source_path: instrumentation/apache-httpclient/apache-httpclient-4.3
546579
scope:
@@ -588,8 +621,12 @@ libraries:
588621
- name: url.full
589622
type: STRING
590623
- name: apache-httpclient-5.0
624+
display_name: Apache HttpClient
591625
description: This instrumentation enables HTTP client spans and HTTP client metrics
592626
for version 5 of the Apache HttpClient.
627+
semantic_conventions:
628+
- HTTP_CLIENT_SPANS
629+
- HTTP_CLIENT_METRICS
593630
library_link: https://hc.apache.org/index.html
594631
source_path: instrumentation/apache-httpclient/apache-httpclient-5.0
595632
scope:
@@ -635,8 +672,12 @@ libraries:
635672
- name: url.full
636673
type: STRING
637674
- name: apache-httpclient-5.2
675+
display_name: Apache HttpClient
638676
description: This instrumentation provides a library integration that enables
639677
HTTP client spans and HTTP client metrics for the Apache HttpClient.
678+
semantic_conventions:
679+
- HTTP_CLIENT_SPANS
680+
- HTTP_CLIENT_METRICS
640681
library_link: https://hc.apache.org/index.html
641682
source_path: instrumentation/apache-httpclient/apache-httpclient-5.2
642683
scope:

instrumentation-api/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ plugins {
77
id("otel.japicmp-conventions")
88
id("otel.publish-conventions")
99
id("otel.jmh-conventions")
10+
id("otel.nullaway-conventions")
1011
}
1112

1213
group = "io.opentelemetry.instrumentation"

instrumentation-api/src/jmh/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBenchmark.java

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@
3333
@State(Scope.Thread)
3434
public class InstrumenterBenchmark {
3535

36-
private static final Instrumenter<Void, Void> INSTRUMENTER =
37-
Instrumenter.<Void, Void>builder(
36+
private static final Object REQUEST = new Object();
37+
38+
private static final Instrumenter<Object, Void> INSTRUMENTER =
39+
Instrumenter.<Object, Void>builder(
3840
OpenTelemetry.noop(),
3941
"benchmark",
4042
HttpSpanNameExtractor.create(ConstantHttpAttributesGetter.INSTANCE))
@@ -44,75 +46,76 @@ public class InstrumenterBenchmark {
4446

4547
@Benchmark
4648
public Context start() {
47-
return INSTRUMENTER.start(Context.root(), null);
49+
return INSTRUMENTER.start(Context.root(), REQUEST);
4850
}
4951

5052
@Benchmark
5153
public Context startEnd() {
52-
Context context = INSTRUMENTER.start(Context.root(), null);
53-
INSTRUMENTER.end(context, null, null, null);
54+
Context context = INSTRUMENTER.start(Context.root(), REQUEST);
55+
INSTRUMENTER.end(context, REQUEST, null, null);
5456
return context;
5557
}
5658

57-
enum ConstantHttpAttributesGetter implements HttpClientAttributesGetter<Void, Void> {
59+
enum ConstantHttpAttributesGetter implements HttpClientAttributesGetter<Object, Void> {
5860
INSTANCE;
5961

6062
private static final InetSocketAddress PEER_ADDRESS =
6163
InetSocketAddress.createUnresolved("localhost", 8080);
6264

6365
@Override
64-
public String getUrlFull(Void unused) {
66+
public String getUrlFull(Object unused) {
6567
return "https://opentelemetry.io/benchmark";
6668
}
6769

6870
@Override
69-
public String getHttpRequestMethod(Void unused) {
71+
public String getHttpRequestMethod(Object unused) {
7072
return "GET";
7173
}
7274

7375
@Override
74-
public List<String> getHttpRequestHeader(Void unused, String name) {
76+
public List<String> getHttpRequestHeader(Object unused, String name) {
7577
if (name.equalsIgnoreCase("user-agent")) {
7678
return Collections.singletonList("OpenTelemetryBot");
7779
}
7880
return Collections.emptyList();
7981
}
8082

8183
@Override
82-
public Integer getHttpResponseStatusCode(Void unused, Void unused2, @Nullable Throwable error) {
84+
public Integer getHttpResponseStatusCode(
85+
Object unused, Void unused2, @Nullable Throwable error) {
8386
return 200;
8487
}
8588

8689
@Override
87-
public List<String> getHttpResponseHeader(Void unused, Void unused2, String name) {
90+
public List<String> getHttpResponseHeader(Object unused, Void unused2, String name) {
8891
return Collections.emptyList();
8992
}
9093

9194
@Override
92-
public String getNetworkProtocolName(Void unused, @Nullable Void unused2) {
95+
public String getNetworkProtocolName(Object unused, @Nullable Void unused2) {
9396
return "http";
9497
}
9598

9699
@Override
97-
public String getNetworkProtocolVersion(Void unused, @Nullable Void unused2) {
100+
public String getNetworkProtocolVersion(Object unused, @Nullable Void unused2) {
98101
return "2.0";
99102
}
100103

101104
@Nullable
102105
@Override
103-
public String getServerAddress(Void request) {
106+
public String getServerAddress(Object request) {
104107
return null;
105108
}
106109

107110
@Nullable
108111
@Override
109-
public Integer getServerPort(Void request) {
112+
public Integer getServerPort(Object request) {
110113
return null;
111114
}
112115

113116
@Override
114117
public InetSocketAddress getNetworkPeerInetSocketAddress(
115-
Void request, @Nullable Void response) {
118+
Object request, @Nullable Void response) {
116119
return PEER_ADDRESS;
117120
}
118121
}

0 commit comments

Comments
 (0)