Skip to content

Commit 81e92ff

Browse files
committed
Merge branch 'main' into remove-unneeded-flags
2 parents e9c34bd + 6a9203c commit 81e92ff

File tree

67 files changed

+2100
-1128
lines changed

Some content is hidden

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

67 files changed

+2100
-1128
lines changed

.github/workflows/auto-license-report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
java-version-file: .java-version
2929

3030
- name: Set up gradle
31-
uses: gradle/actions/setup-gradle@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.1
31+
uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
3232
with:
3333
cache-read-only: true
3434

.github/workflows/auto-spotless.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
java-version-file: .java-version
2929

3030
- name: Set up gradle
31-
uses: gradle/actions/setup-gradle@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.1
31+
uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # v4.4.0
3232
with:
3333
cache-read-only: true
3434

.github/workflows/auto-update-pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
pull-requests: write
1919
steps:
2020
- name: Download patch
21-
uses: actions/[email protected]
21+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
2222
with:
2323
run-id: ${{ github.event.workflow_run.id }}
2424
path: ${{ runner.temp }}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ dependencies {
161161
compileOnly("com.google.errorprone:error_prone_annotations")
162162

163163
codenarc("org.codenarc:CodeNarc:3.6.0")
164-
codenarc(platform("org.codehaus.groovy:groovy-bom:3.0.24"))
164+
codenarc(platform("org.codehaus.groovy:groovy-bom:3.0.25"))
165165

166166
modules {
167167
// checkstyle uses the very old google-collections which causes Java 9 module conflict with

dependencyManagement/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ val otelContribVersion = "1.46.0-alpha"
1010
val otelSdkAlphaVersion = otelSdkVersion.replaceFirst("(-SNAPSHOT)?$".toRegex(), "-alpha$1")
1111

1212
// Need both BOM and groovy jars
13-
val groovyVersion = "4.0.26"
13+
val groovyVersion = "4.0.27"
1414

1515
// We don't force libraries we instrument to new versions since we compile and test against specific
1616
// old baseline versions but we do try to force those libraries' transitive dependencies to new

instrumentation/apache-httpclient/apache-httpclient-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v2_0/ApacheHttpClientInstrumentation.java

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import io.opentelemetry.context.Scope;
1919
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
2020
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
21+
import javax.annotation.Nullable;
2122
import net.bytebuddy.asm.Advice;
2223
import net.bytebuddy.description.type.TypeDescription;
2324
import net.bytebuddy.matcher.ElementMatcher;
@@ -47,32 +48,46 @@ public void transform(TypeTransformer transformer) {
4748
@SuppressWarnings("unused")
4849
public static class ExecuteMethodAdvice {
4950

50-
@Advice.OnMethodEnter(suppress = Throwable.class)
51-
public static void methodEnter(
52-
@Advice.Argument(1) HttpMethod httpMethod,
53-
@Advice.Local("otelContext") Context context,
54-
@Advice.Local("otelScope") Scope scope) {
55-
Context parentContext = currentContext();
56-
if (!instrumenter().shouldStart(parentContext, httpMethod)) {
57-
return;
51+
public static class AdviceScope {
52+
private final Context context;
53+
private final Scope scope;
54+
private final HttpMethod httpMethod;
55+
56+
private AdviceScope(Context context, Scope scope, HttpMethod httpMethod) {
57+
this.context = context;
58+
this.scope = scope;
59+
this.httpMethod = httpMethod;
60+
}
61+
62+
@Nullable
63+
public static AdviceScope start(HttpMethod httpMethod) {
64+
Context parentContext = currentContext();
65+
if (!instrumenter().shouldStart(parentContext, httpMethod)) {
66+
return null;
67+
}
68+
Context context = instrumenter().start(parentContext, httpMethod);
69+
return new AdviceScope(context, context.makeCurrent(), httpMethod);
70+
}
71+
72+
public void end(Throwable throwable) {
73+
scope.close();
74+
instrumenter().end(context, httpMethod, httpMethod, throwable);
5875
}
76+
}
5977

60-
context = instrumenter().start(parentContext, httpMethod);
61-
scope = context.makeCurrent();
78+
@Advice.OnMethodEnter(suppress = Throwable.class)
79+
public static AdviceScope methodEnter(@Advice.Argument(1) HttpMethod httpMethod) {
80+
return AdviceScope.start(httpMethod);
6281
}
6382

6483
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
6584
public static void methodExit(
66-
@Advice.Argument(1) HttpMethod httpMethod,
67-
@Advice.Thrown Throwable throwable,
68-
@Advice.Local("otelContext") Context context,
69-
@Advice.Local("otelScope") Scope scope) {
70-
if (scope == null) {
71-
return;
72-
}
85+
@Advice.Thrown @Nullable Throwable throwable,
86+
@Advice.Enter @Nullable AdviceScope adviceScope) {
7387

74-
scope.close();
75-
instrumenter().end(context, httpMethod, httpMethod, throwable);
88+
if (adviceScope != null) {
89+
adviceScope.end(throwable);
90+
}
7691
}
7792
}
7893
}

instrumentation/apache-httpclient/apache-httpclient-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v2_0/ApacheHttpClientInstrumentationModule.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
import com.google.auto.service.AutoService;
1111
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
1212
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
13+
import io.opentelemetry.javaagent.extension.instrumentation.internal.ExperimentalInstrumentationModule;
1314
import java.util.List;
1415

1516
@AutoService(InstrumentationModule.class)
16-
public class ApacheHttpClientInstrumentationModule extends InstrumentationModule {
17+
public class ApacheHttpClientInstrumentationModule extends InstrumentationModule
18+
implements ExperimentalInstrumentationModule {
1719

1820
public ApacheHttpClientInstrumentationModule() {
1921
super("apache-httpclient", "apache-httpclient-2.0");
@@ -23,4 +25,9 @@ public ApacheHttpClientInstrumentationModule() {
2325
public List<TypeInstrumentation> typeInstrumentations() {
2426
return singletonList(new ApacheHttpClientInstrumentation());
2527
}
28+
29+
@Override
30+
public boolean isIndyReady() {
31+
return true;
32+
}
2633
}

instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientHelper.java

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)