Skip to content

Commit e1f60cd

Browse files
committed
Merge branch 'main' of github.com:open-telemetry/opentelemetry-java-instrumentation into yaml-jmx-metrics-test
2 parents d081c29 + 4ce03e4 commit e1f60cd

File tree

43 files changed

+409
-426
lines changed

Some content is hidden

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

43 files changed

+409
-426
lines changed

.github/renovate.json5

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@
7878
'com.gradleup.shadow{/,}**',
7979
],
8080
},
81+
{
82+
groupName: 'guava packages',
83+
matchPackageNames: [
84+
'com.google.guava{/,}**',
85+
],
86+
},
8187
{
8288
groupName: 'jackson packages',
8389
matchPackageNames: [

conventions/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ dependencies {
5555

5656
// When updating, update above in plugins too
5757
implementation("com.diffplug.spotless:spotless-plugin-gradle:7.0.2")
58-
implementation("com.google.guava:guava:33.4.5-jre")
58+
implementation("com.google.guava:guava:33.4.6-jre")
5959
implementation("gradle.plugin.com.google.protobuf:protobuf-gradle-plugin:0.8.18")
6060
implementation("com.gradleup.shadow:shadow-gradle-plugin:8.3.6")
6161
implementation("org.apache.httpcomponents:httpclient:4.5.14")

dependencyManagement/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ val DEPENDENCY_BOMS = listOf(
2929

3030
"com.fasterxml.jackson:jackson-bom:2.18.3",
3131
"com.squareup.okio:okio-bom:3.10.2", // see https://github.com/open-telemetry/opentelemetry-java/issues/5637
32-
"com.google.guava:guava-bom:33.4.0-jre",
32+
"com.google.guava:guava-bom:33.4.6-jre",
3333
"org.apache.groovy:groovy-bom:${groovyVersion}",
3434
"io.opentelemetry:opentelemetry-bom:${otelSdkVersion}",
3535
"io.opentelemetry:opentelemetry-bom-alpha:${otelSdkAlphaVersion}",

docs/contributing/style-guideline.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,7 @@ All parameters and fields which can be `null` should be annotated with `@Nullabl
108108
(specifically `javax.annotation.Nullable`, which is included by the
109109
`otel.java-conventions` gradle plugin as a `compileOnly` dependency).
110110

111-
There is no need to use `@NonNull`, as this is the default, which should be declared in a
112-
`package-info.java` file on the root package of each module, e.g.
113-
114-
```java
115-
@DefaultQualifier(
116-
value = NonNull.class,
117-
locations = {TypeUseLocation.FIELD, TypeUseLocation.PARAMETER, TypeUseLocation.RETURN})
118-
package io.opentelemetry.instrumentation.api;
119-
120-
import org.checkerframework.checker.nullness.qual.NonNull;
121-
import org.checkerframework.framework.qual.DefaultQualifier;
122-
```
111+
There is no need to use `@NonNull`, as this is the default.
123112

124113
Public APIs should still defensively check for `null` parameters, even if the parameter is not
125114
annotated with `@Nullable`. Internal APIs do not need to defensively check for `null` parameters.

examples/distro/smoke-tests/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
dependencies {
66
testImplementation("org.testcontainers:testcontainers:1.20.6")
77
testImplementation("com.fasterxml.jackson.core:jackson-databind:2.18.3")
8-
testImplementation("com.google.protobuf:protobuf-java-util:4.30.1")
8+
testImplementation("com.google.protobuf:protobuf-java-util:4.30.2")
99
testImplementation("com.squareup.okhttp3:okhttp:4.12.0")
1010
testImplementation("io.opentelemetry.proto:opentelemetry-proto:1.5.0-alpha")
1111
testImplementation("io.opentelemetry:opentelemetry-api")

examples/extension/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ dependencies {
9999
//All dependencies below are only for tests
100100
testImplementation("org.testcontainers:testcontainers:1.20.6")
101101
testImplementation("com.fasterxml.jackson.core:jackson-databind:2.18.3")
102-
testImplementation("com.google.protobuf:protobuf-java-util:4.30.1")
102+
testImplementation("com.google.protobuf:protobuf-java-util:4.30.2")
103103
testImplementation("com.squareup.okhttp3:okhttp:4.12.0")
104104
testImplementation("io.opentelemetry:opentelemetry-api")
105105
testImplementation("io.opentelemetry.proto:opentelemetry-proto:1.5.0-alpha")

gradle-plugins/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ val byteBuddyVersion = "1.17.4"
2929
val aetherVersion = "1.1.0"
3030

3131
dependencies {
32-
implementation("com.google.guava:guava:33.4.5-jre")
32+
implementation("com.google.guava:guava:33.4.6-jre")
3333
// we need to use byte buddy variant that does not shade asm
3434
implementation("net.bytebuddy:byte-buddy-gradle-plugin:${byteBuddyVersion}") {
3535
exclude(group = "net.bytebuddy", module = "byte-buddy")

instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/Instrumenter.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ private Context doStart(Context parentContext, REQUEST request, @Nullable Instan
190190
context = contextCustomizer.onStart(context, request, attributes);
191191
}
192192

193-
boolean localRoot = LocalRootSpan.isLocalRoot(context);
193+
boolean localRoot = LocalRootSpan.isLocalRoot(parentContext);
194+
boolean hasLocalRoot = LocalRootSpan.fromContextOrNull(context) != null;
194195

195196
spanBuilder.setAllAttributes(attributes);
196197
Span span = spanBuilder.setParent(context).startSpan();
@@ -216,9 +217,9 @@ private Context doStart(Context parentContext, REQUEST request, @Nullable Instan
216217

217218
if (localRoot) {
218219
context = LocalRootSpan.store(context, span);
219-
if (spanKind == SpanKind.SERVER) {
220-
HttpRouteState.updateSpan(context, span);
221-
}
220+
}
221+
if (!hasLocalRoot && spanKind == SpanKind.SERVER) {
222+
HttpRouteState.updateSpan(context, span);
222223
}
223224

224225
return spanSuppressor.storeInContext(context, spanKind, span);

instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/internal/HttpRouteState.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static HttpRouteState fromContextOrNull(Context context) {
2727

2828
public static void updateSpan(Context context, Span span) {
2929
HttpRouteState state = fromContextOrNull(context);
30-
if (state != null) {
30+
if (state != null && state.span == null) {
3131
state.span = span;
3232
}
3333
}

instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/semconv/http/HttpServerRouteTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void setUp() {
4444
}
4545

4646
@Test
47-
void noLocalRootSpan() {
47+
void nonInstrumenerParentLocalRootSpan() {
4848
Span parentSpan =
4949
testing.getOpenTelemetry().getTracer("test").spanBuilder("parent").startSpan();
5050
parentSpan.end();
@@ -56,10 +56,11 @@ void noLocalRootSpan() {
5656

5757
instrumenter.end(context, "test", null, null);
5858

59-
assertNull(HttpServerRoute.get(context));
59+
assertEquals("/get/:id", HttpServerRoute.get(context));
6060
assertThat(testing.getSpans())
6161
.satisfiesExactly(
62-
span -> assertThat(span).hasName("parent"), span -> assertThat(span).hasName("test"));
62+
span -> assertThat(span).hasName("parent"),
63+
span -> assertThat(span).hasName("HTTP /get/:id"));
6364
}
6465

6566
@Test

0 commit comments

Comments
 (0)