Skip to content

PR for batch mgmt #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion opentracing-spring-rabbitmq-it/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-rabbitmq-parent</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2-BATCH</version>
</parent>

<artifactId>opentracing-spring-rabbitmq-it</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion opentracing-spring-rabbitmq-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-rabbitmq-parent</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2-BATCH</version>
</parent>

<artifactId>opentracing-spring-rabbitmq-starter</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion opentracing-spring-rabbitmq/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-rabbitmq-parent</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2-BATCH</version>
</parent>

<artifactId>opentracing-spring-rabbitmq</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.springframework.aop.AfterAdvice;
import org.springframework.aop.BeforeAdvice;

import java.util.List;
/**
* @author Gilles Robert
*/
Expand All @@ -35,9 +36,22 @@ public class RabbitMqReceiveTracingInterceptor implements MethodInterceptor, Aft
private final Tracer tracer;
private final RabbitMqSpanDecorator spanDecorator;


/**
* OpenTracing original class doesnt handle batch messaging
* code is from https://github.com/openzipkin/brave/blob/master/instrumentation/spring-rabbit/src/main/java/brave/spring/rabbit/TracingRabbitListenerAdvice.java
*/

@Override
public Object invoke(MethodInvocation methodInvocation) throws Throwable {
Message message = (Message) methodInvocation.getArguments()[1];

Message message = null;
if (methodInvocation.getArguments()[1] instanceof List) {
message = ((List<? extends Message>) methodInvocation.getArguments()[1]).get(0);
} else {
message = (Message) methodInvocation.getArguments()[1];
}

MessageProperties messageProperties = message.getMessageProperties();

Optional<Scope> child = RabbitMqTracingUtils.buildReceiveSpan(messageProperties, tracer);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<groupId>io.opentracing.contrib</groupId>
<artifactId>opentracing-spring-rabbitmq-parent</artifactId>
<version>3.0.2-SNAPSHOT</version>
<version>3.0.2-BATCH</version>
<packaging>pom</packaging>

<name>${project.groupId}:${project.artifactId}</name>
Expand Down