diff --git a/instrumentation/spring/spring-integration-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/integration/ApplicationContextInstrumentation.java b/instrumentation/spring/spring-integration-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/integration/ApplicationContextInstrumentation.java index 0e8553d9c8db..8b3fc3cde277 100644 --- a/instrumentation/spring/spring-integration-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/integration/ApplicationContextInstrumentation.java +++ b/instrumentation/spring/spring-integration-4.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/integration/ApplicationContextInstrumentation.java @@ -56,6 +56,11 @@ public static void onEnter(@Advice.Argument(0) ConfigurableListableBeanFactory b genericBeanDefinition(GlobalChannelInterceptorWrapper.class) .addConstructorArgValue(SpringIntegrationSingletons.interceptor()) .addPropertyValue("patterns", SpringIntegrationSingletons.patterns()) + // it is important for the tracing interceptor to run first for CONSUMER spans so + // that they capture the whole operation and also so that users can write their own + // interceptors to enrich the CONSUMER span (similar to writing a servlet filter to + // enrich the SERVER span) + .addPropertyValue("order", Integer.MIN_VALUE) .getBeanDefinition(); ((BeanDefinitionRegistry) beanFactory)