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

New Relic's @Trace annotation above @QueueListener is not working #375

Open
harshitshah4 opened this issue Nov 30, 2021 · 2 comments
Open
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@harshitshah4
Copy link

I have added @trace annotation to Spring boot's Kafka Listener , it seems to be working over there. But its not working above @QueueListener.

What's the correct way to integrate New Relic with @QueueListener.

My current implementation looks something like this

    @Trace(metricName = "metricName", dispatcher = true)
    @QueueListener(value = "${queue.name}", sqsClient = "sqsClient")
    public void processMessage(@Payload Request request) throws Exception {
        ...
    }
@JaidenAshmore
Copy link
Owner

Interesting, what you are doing is correct and there must be a bug.

I have seen similar problems before with other annotations and I was able to get around it by making sure it worked with cglib and other proxying libraries with this utility: AnnotationUtils.

Let me do some digging and see what I can find.

@JaidenAshmore JaidenAshmore self-assigned this Dec 4, 2021
@JaidenAshmore JaidenAshmore added the bug Something isn't working label Dec 4, 2021
@JaidenAshmore
Copy link
Owner

Okay it looks like we wouldn't get automatic integration for this, e.g. you can see that newrelic has custom integration code for each integration that they want to support: https://github.com/newrelic/newrelic-java-agent/tree/main/instrumentation.

As I don't have a lot of knowledge in NewRelic and don't actively use it myself, I probably won't work on this. I am open for anyone who has a lot more new relic knowledge to submit a PR for fixing this!

For reference, we have similar tracing implementations that wrap each message being processed in a tracing span:

It looks like new relic does it a little bit different using Weave* annotations: https://github.com/newrelic/newrelic-java-agent/blob/main/instrumentation/spring-4.3.0/src/main/java/com/nr/agent/instrumentation/SpringController_Instrumentation.java#L33. Maybe we would just need to weave the core annotations like @SqsListener and that would be it? The negative of this approach is that this doesn't work if people add their own annotations for a custom message listener. Implementing a custom MessageProcessingDecorator in that sense would be more extensible but not sure how to do it with the new relic without really digging into their code.

Sorry I couldn't be more help :(

@JaidenAshmore JaidenAshmore added the help wanted Extra attention is needed label Dec 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants