Agent context storage wrapper should not override other wrappers
Resolves
MODIFY
instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/ContextStorageWrappersInstrumentation.java
instrumentation/opentelemetry-api/opentelemetry-api-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/opentelemetryapi/ContextStorageWrappersInstrumentation.java
@@ -46,7 +46,8 @@ public class ContextStorageWrappersInstrumentation implements TypeInstrumentatio
@Advice.Return(readOnly = false)
List<Function<? super ContextStorage, ? extends ContextStorage>> wrappers) {
wrappers = new ArrayList<>(wrappers);
- wrappers.add(AgentContextStorage.wrap());
+ // AgentContextStorage wrapper doesn't delegate, so needs to be the innermost wrapper
+ wrappers.add(0, AgentContextStorage.wrap());
}
}
}

Agent context storage wrapper should not override other wrappers (#7355)

Resolves
https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/7344

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>