Skip to content
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

Allow JMS listener instrumentation [SPR-14683] #19247

Closed
spring-projects-issues opened this issue Sep 9, 2016 · 6 comments
Closed

Allow JMS listener instrumentation [SPR-14683] #19247

spring-projects-issues opened this issue Sep 9, 2016 · 6 comments
Labels
in: messaging Issues in messaging modules (jms, messaging) status: superseded An issue that has been superseded by another type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

Marcin Grzejszczak opened SPR-14683 and commented

In Spring Cloud Sleuth we would want to give the users a possibility to instrument all @JmsListener annotated methods in order to propagate tracing information. In the Issue Garry mentions that

It's not currently possible to customize the adapter.

Or, a tweak in JmsListenerAnnotationBeanPostProcessor to wrap the listener in a proxy or similar.

Can we give the possibility of adding listeners / proxies / whatever to instrument the listeners?

For all incoming messages from JMS we would like to be able to do some pre processing and post processing (let's assume that the message arrived from a destination "foo").

class SomeMagicalClassThatWillHelpUsSolveThisProblem {

    private final  SpanExtractor<Message> messagingSpanExtractor;
    private final Tracer tracer;

// constructor

    public void magicalMethod(Message message, String destination, ProceedingPointcut pointcut) {
        // we need to extract tracing information from a message and inject it into a span
        Span parentSpan = messagingSpanExtractor.joinTrace(message);
        Span continuedSpan = tracer.continueSpan(span);
        tracer.addTag("method", pointcut.giveMeTheNameOfTheMethodThatWillProcessTheMessage());
        tracer.addTag("class", pointcut.giveMeTheNameOfTheClassThatWillProcessTheMessage());
        try {
            // let the normal method execution take place
            pointcut.proceed(...);
        } finally {
            // once the message has been processed we need to close the span
            tracer.close(span);
        }
    }

}

Reference URL: spring-cloud/spring-cloud-sleuth#151 (comment)

2 votes, 9 watchers

@spring-projects-issues
Copy link
Collaborator Author

Grenville Wilson commented

I'm a user directly affected by this problem, since it prevents Spring Sleuth spans from propagating across JMS connections. I can confirm that this would resolve the issue I've been having with @JmsListener annotated methods not picking up spans in the headers of JMS messages.

@spring-projects-issues
Copy link
Collaborator Author

Ales Justin commented

For OT I've just added such integration, which should imho handle any payload:

@spring-projects-issues
Copy link
Collaborator Author

Stéphane Nicoll commented

Ales Justin this is very interesting. Can you extract the API that would make this possible without a full replacement as you're doing now? I can see a much more elegant solution if we change how the registry creates endpoints.

Thoughts?

@spring-projects-issues
Copy link
Collaborator Author

Ales Justin commented

Stéphane Nicoll yeah, was just thinking about this yday -- to provide a PR, but it was already 2am. :-)
Will do it today, it should be simple, as all we need to do is to have abstraction over MethodJmsListenerEndpoint::createMessageListenerInstance().

@spring-projects-issues
Copy link
Collaborator Author

Jon Schneider commented

We'll need the same feature for Micrometer. See this related issue.

@snicoll
Copy link
Member

snicoll commented Apr 17, 2023

Superseded by #30335

@snicoll snicoll closed this as not planned Won't fix, can't repro, duplicate, stale Apr 17, 2023
@snicoll snicoll removed this from the 6.x Backlog milestone Apr 17, 2023
@snicoll snicoll added the status: superseded An issue that has been superseded by another label Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: messaging Issues in messaging modules (jms, messaging) status: superseded An issue that has been superseded by another type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants