Skip to content

Commit 68c1a18

Browse files
committed
Merge branch 'main' of github.com:open-telemetry/opentelemetry-java-instrumentation into indy-jetty
2 parents 14c1caf + 903e55c commit 68c1a18

File tree

93 files changed

+2601
-2936
lines changed

Some content is hidden

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

93 files changed

+2601
-2936
lines changed

.github/workflows/overhead-benchmark-daily.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,15 @@ jobs:
4242
- name: Copy results back to gh-pages branch
4343
run: rsync -avv benchmark-overhead/results/ gh-pages/benchmark-overhead/results/ && rm -rf benchmark-overhead/results
4444

45+
- name: Use CLA approved bot
46+
run: .github/scripts/use-cla-approved-bot.sh
47+
4548
- name: Commit updated results
46-
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4
47-
with:
48-
add: "benchmark-overhead/results"
49-
cwd: "./gh-pages"
50-
branch: "gh-pages"
51-
message: "update test result data"
52-
author_name: otelbot
53-
author_email: [email protected]
54-
committer_name: otelbot
55-
committer_email: [email protected]
49+
working-directory: ./gh-pages
50+
run: |
51+
git add benchmark-overhead/results
52+
git commit -m "update test result data"
53+
git push
5654
5755
workflow-notification:
5856
permissions:

CONTRIBUTING.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,28 @@ See [Running the tests](./docs/contributing/running-tests.md) for more details.
1515

1616
### Snapshot builds
1717

18-
For developers testing code changes before a release is complete, there are
19-
snapshot builds of the `main` branch. They are available from
20-
the Sonatype snapshot repository at `https://central.sonatype.com/repository/maven-snapshots/`
21-
([browse](https://central.sonatype.com/service/rest/repository/browse/maven-snapshots/io/opentelemetry/)).
18+
For developers testing code changes before a release is complete, snapshot builds of the `main`
19+
branch are available from the Sonatype snapshot repository at `https://central.sonatype.com/repository/maven-snapshots/`.
20+
21+
To find the latest snapshot, check the maven metadata (replace `{LATEST_VERSION}` with the current
22+
stable release):
23+
24+
```
25+
https://central.sonatype.com/repository/maven-snapshots/io/opentelemetry/javaagent/opentelemetry-javaagent/{LATEST_VERSION}-SNAPSHOT/maven-metadata.xml
26+
```
27+
28+
Look for the `<timestamp>` and `<buildNumber>` in the XML response, then construct the download URL:
29+
30+
```
31+
https://central.sonatype.com/repository/maven-snapshots/io/opentelemetry/javaagent/opentelemetry-javaagent/{VERSION}-SNAPSHOT/opentelemetry-javaagent-{VERSION}-{TIMESTAMP}-{BUILD_NUMBER}.jar
32+
```
33+
34+
For example, if the metadata shows timestamp `20250925.160708` and build number `56` for version
35+
`2.21.0`, the snapshot JAR URL would be:
36+
37+
```
38+
https://central.sonatype.com/repository/maven-snapshots/io/opentelemetry/javaagent/opentelemetry-javaagent/2.21.0-SNAPSHOT/opentelemetry-javaagent-2.21.0-20250925.160708-56.jar
39+
```
2240

2341
### Building from source
2442

conventions/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ dependencies {
5656
// When updating, update above in plugins too
5757
implementation("com.diffplug.spotless:spotless-plugin-gradle:8.0.0")
5858
implementation("com.google.guava:guava:33.5.0-jre")
59-
implementation("com.gradleup.shadow:shadow-gradle-plugin:9.2.1")
59+
implementation("com.gradleup.shadow:shadow-gradle-plugin:9.2.2")
6060
implementation("org.apache.httpcomponents:httpclient:4.5.14")
6161
implementation("com.gradle.develocity:com.gradle.develocity.gradle.plugin:4.2")
6262
implementation("org.owasp:dependency-check-gradle:12.1.6")

docs/instrumentation-list.yaml

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,33 @@ libraries:
390390
default: ''
391391
telemetry:
392392
- when: default
393+
metrics:
394+
- name: rpc.client.duration
395+
description: The duration of an outbound RPC invocation.
396+
type: HISTOGRAM
397+
unit: ms
398+
attributes:
399+
- name: rpc.method
400+
type: STRING
401+
- name: rpc.service
402+
type: STRING
403+
- name: rpc.system
404+
type: STRING
405+
- name: server.address
406+
type: STRING
407+
- name: server.port
408+
type: LONG
409+
- name: rpc.server.duration
410+
description: The duration of an inbound RPC invocation.
411+
type: HISTOGRAM
412+
unit: ms
413+
attributes:
414+
- name: rpc.method
415+
type: STRING
416+
- name: rpc.service
417+
type: STRING
418+
- name: rpc.system
419+
type: STRING
393420
spans:
394421
- span_kind: CLIENT
395422
attributes:
@@ -6399,13 +6426,6 @@ libraries:
63996426
scope:
64006427
name: io.opentelemetry.runtime-telemetry-java8
64016428
rxjava:
6402-
- name: rxjava-1.0
6403-
source_path: instrumentation/rxjava/rxjava-1.0
6404-
scope:
6405-
name: io.opentelemetry.rxjava-1.0
6406-
target_versions:
6407-
library:
6408-
- io.reactivex:rxjava:1.0.7
64096429
- name: rxjava-2.0
64106430
source_path: instrumentation/rxjava/rxjava-2.0
64116431
scope:
@@ -7977,6 +7997,13 @@ internal:
79777997
source_path: instrumentation/internal/internal-lambda
79787998
scope:
79797999
name: io.opentelemetry.internal-lambda
8000+
- name: rxjava-1.0
8001+
source_path: instrumentation/rxjava/rxjava-1.0
8002+
scope:
8003+
name: io.opentelemetry.rxjava-1.0
8004+
target_versions:
8005+
library:
8006+
- io.reactivex:rxjava:1.0.7
79808007
- name: internal-eclipse-osgi-3.6
79818008
source_path: instrumentation/internal/internal-eclipse-osgi-3.6
79828009
scope:

examples/distro/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ buildscript {
1313
}
1414
dependencies {
1515
classpath "com.diffplug.spotless:spotless-plugin-gradle:8.0.0"
16-
classpath "com.gradleup.shadow:shadow-gradle-plugin:9.2.1"
16+
classpath "com.gradleup.shadow:shadow-gradle-plugin:9.2.2"
1717
classpath "io.opentelemetry.instrumentation:gradle-plugins:2.21.0-alpha-SNAPSHOT"
1818
}
1919
}

examples/extension/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ plugins {
1010
into a single jar.
1111
See https://imperceptiblethoughts.com/shadow/ for more details about Shadow plugin.
1212
*/
13-
id "com.gradleup.shadow" version "9.2.1"
13+
id "com.gradleup.shadow" version "9.2.2"
1414
id "com.diffplug.spotless" version "8.0.0"
1515

1616
id "io.opentelemetry.instrumentation.muzzle-generation" version "2.21.0-alpha-SNAPSHOT"

gradle-plugins/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dependencies {
4040
implementation("org.eclipse.aether:aether-transport-http:${aetherVersion}")
4141
implementation("org.apache.maven:maven-aether-provider:3.3.9")
4242

43-
implementation("com.gradleup.shadow:shadow-gradle-plugin:9.2.1")
43+
implementation("com.gradleup.shadow:shadow-gradle-plugin:9.2.2")
4444

4545
testImplementation("org.assertj:assertj-core:3.27.6")
4646

instrumentation/java-http-client/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/javahttpclient/HttpClientInstrumentation.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public static AsyncAdviceScope start(HttpRequest request) {
156156
}
157157

158158
public CompletableFuture<HttpResponse<?>> end(
159-
@Nullable Throwable throwable, @Nullable CompletableFuture<HttpResponse<?>> future) {
159+
@Nullable Throwable throwable, CompletableFuture<HttpResponse<?>> future) {
160160
if (callDepth.decrementAndGet() > 0 || scope == null) {
161161
// async end nested call
162162
return future;
@@ -167,8 +167,8 @@ public CompletableFuture<HttpResponse<?>> end(
167167
instrumenter().end(context, request, null, throwable);
168168
return future;
169169
}
170-
future = future.whenComplete(new ResponseConsumer(instrumenter(), context, request));
171-
return CompletableFutureWrapper.wrap(future, parentContext);
170+
return CompletableFutureWrapper.wrap(future, parentContext)
171+
.whenComplete(new ResponseConsumer(instrumenter(), context, request));
172172
}
173173
}
174174

@@ -182,7 +182,7 @@ public static AsyncAdviceScope methodEnter(
182182
@AssignReturned.ToReturned
183183
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
184184
public static CompletableFuture<HttpResponse<?>> methodExit(
185-
@Advice.Return @Nullable CompletableFuture<HttpResponse<?>> future,
185+
@Advice.Return CompletableFuture<HttpResponse<?>> future,
186186
@Advice.Thrown @Nullable Throwable throwable,
187187
@Advice.Enter @Nullable AsyncAdviceScope scope) {
188188
return scope == null ? future : scope.end(throwable, future);

instrumentation/java-http-client/library/src/main/java/io/opentelemetry/instrumentation/javahttpclient/internal/CompletableFutureWrapper.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@
1313
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
1414
* any time.
1515
*/
16-
public final class CompletableFutureWrapper {
16+
public final class CompletableFutureWrapper<T> extends CompletableFuture<T> {
17+
private final CompletableFuture<?> future;
1718

18-
private CompletableFutureWrapper() {}
19+
private CompletableFutureWrapper(CompletableFuture<?> future) {
20+
this.future = future;
21+
}
1922

2023
public static <T> CompletableFuture<T> wrap(CompletableFuture<T> future, Context context) {
21-
CompletableFuture<T> result = new CompletableFuture<>();
24+
CompletableFuture<T> result = new CompletableFutureWrapper<>(future);
2225
future.whenComplete(
2326
(T value, Throwable throwable) -> {
2427
try (Scope ignored = context.makeCurrent()) {
@@ -32,4 +35,16 @@ public static <T> CompletableFuture<T> wrap(CompletableFuture<T> future, Context
3235

3336
return result;
3437
}
38+
39+
@Override
40+
public <U> CompletableFuture<U> newIncompleteFuture() {
41+
return new CompletableFutureWrapper<>(future);
42+
}
43+
44+
@Override
45+
public boolean cancel(boolean mayInterruptIfRunning) {
46+
boolean result = super.cancel(mayInterruptIfRunning);
47+
future.cancel(mayInterruptIfRunning);
48+
return result;
49+
}
3550
}

instrumentation/java-http-client/library/src/main/java/io/opentelemetry/instrumentation/javahttpclient/internal/OpenTelemetryHttpClient.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,9 @@ private <T> CompletableFuture<HttpResponse<T>> traceAsync(
142142
instrumenter.end(context, request, null, t);
143143
throw t;
144144
}
145-
future = future.whenComplete(new ResponseConsumer(instrumenter, context, request));
146-
future = CompletableFutureWrapper.wrap(future, parentContext);
145+
future =
146+
CompletableFutureWrapper.wrap(future, parentContext)
147+
.whenComplete(new ResponseConsumer(instrumenter, context, request));
147148
return future;
148149
}
149150
}

0 commit comments

Comments
 (0)