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

Support tracking the message listener of spring jms #706

Closed
wants to merge 7 commits into from

Conversation

hyhyf
Copy link
Contributor

@hyhyf hyhyf commented Jul 19, 2024

  • If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes #.
  • Update the CHANGES log.

@hyhyf
Copy link
Contributor Author

hyhyf commented Jul 19, 2024

I recommited the code and successfully passed the github action job

wu-sheng
wu-sheng previously approved these changes Jul 19, 2024
docs/en/setup/service-agent/java-agent/Supported-list.md Outdated Show resolved Hide resolved
CHANGES.md Outdated Show resolved Hide resolved
@wu-sheng
Copy link
Member

Your test scenarios failed. Please test them locally, make sure they are passed and stable.

@wu-sheng
Copy link
Member

wu-sheng commented Jul 21, 2024

Why did you remove 5.0?

@hyhyf
Copy link
Contributor Author

hyhyf commented Jul 21, 2024

Why did you remove 5.0?

5.0 spring version too low lead to test scenarios failed

@wu-sheng
Copy link
Member

My question is about why. We should be clear about supported versions.
5.x should cover 5.0.

Could you check the codes and explain why?

@hyhyf
Copy link
Contributor Author

hyhyf commented Jul 21, 2024

My question is about why. We should be clear about supported versions. 5.x should cover 5.0.

Could you check the codes and explain why?

The plugin can support 5.0, but I'm still figuring out how to make it pass the test scenario

@wu-sheng
Copy link
Member

Take your time. We should cover all 5.x versions.

@wu-sheng
Copy link
Member

Any update? I am planning to cut the 9.3.0 release

hyhyf added 2 commits July 28, 2024 15:39
# Conflicts:
#	CHANGES.md
#	docs/en/setup/service-agent/java-agent/Plugin-list.md
@wu-sheng
Copy link
Member

Please resolve the conflicts.

@hyhyf hyhyf closed this Aug 5, 2024
@wu-sheng
Copy link
Member

wu-sheng commented Aug 5, 2024

What happened here?

@hyhyf
Copy link
Contributor Author

hyhyf commented Aug 5, 2024

What happened here?

I thought you didn't need this plugin.

@hyhyf hyhyf restored the hyhyf branch August 5, 2024 14:30
@hyhyf hyhyf reopened this Aug 5, 2024
@hyhyf
Copy link
Contributor Author

hyhyf commented Aug 5, 2024

What happened here?

I removed the context carrier and replaced it with context snapshot. Is that right?

@wu-sheng
Copy link
Member

wu-sheng commented Aug 5, 2024

I am waiting for your reply about why do header extra when you only create local span. This is rare from my understanding.

@hyhyf
Copy link
Contributor Author

hyhyf commented Aug 5, 2024

I am waiting for your reply about why do header extra when you only create local span. This is rare from my understanding.

I hope to trace specific execute of the active MQ consumers.

@wu-sheng
Copy link
Member

wu-sheng commented Aug 5, 2024

But it is pointless when you have another header extracring from entry span from the actual entry span.

Local span doesn't need reference of the producer.

@hyhyf
Copy link
Contributor Author

hyhyf commented Aug 5, 2024

But it is pointless when you have another header extracring from entry span from the actual entry span.

Local span doesn't need reference of the producer.

Yes, after your reminder, I realized this mistake.

I did this before because if I use context snapshot to connect to consumers, I also need to enhance the active MQ message.

So, this plugin doesn't need to do anything except create a local span?

@wu-sheng
Copy link
Member

wu-sheng commented Aug 5, 2024

If that could make the trace continues as your expectations, then yes.

@cloudgc
Copy link

cloudgc commented Aug 6, 2024

image
The jms connectionFactory is very troublesome to obtain the MQ_BROKER Tag

@cloudgc
Copy link

cloudgc commented Aug 6, 2024

Can only be used by hard coding for now , different approaches to JNDI and connectionFactory need to be considered

@wu-sheng
Copy link
Member

wu-sheng commented Aug 6, 2024

I think active MQ should be updated to put correct tag value in JMS case.

@cloudgc
Copy link

cloudgc commented Aug 6, 2024

image

I have studied the support of several major mqs for jms and how to integrate them. In most scenarios, only ActiveMQ uses JMS, so writing a general plug-in to support JMS seems a bit costly. If you need to use JMS, writing a plug-in with hard coding is the best way.

@cloudgc
Copy link

cloudgc commented Aug 6, 2024

should create plugin project
spring-jms-activemq-5.x-plugin
spring-jms-rabbitmq-5.x-plugin .... like this

@wu-sheng
Copy link
Member

wu-sheng commented Aug 6, 2024

Agree for that. Feel free to update.

@hyhyf
Copy link
Contributor Author

hyhyf commented Aug 6, 2024

should create plugin project spring-jms-activemq-5.x-plugin spring-jms-rabbitmq-5.x-plugin .... like this

Thank you for your recommend.

But i have no idea about this, do you have any plans?

@wu-sheng
Copy link
Member

wu-sheng commented Aug 6, 2024

No, Java agent nowadays is totally relying on volunteers.
I don't touch on codes, especially plugins, for years.

@hyhyf
Copy link
Contributor Author

hyhyf commented Aug 6, 2024

No, Java agent nowadays is totally relying on volunteers. I don't touch on codes, especially plugins, for years.

Yes, i know :)

I asked @cloudgc

@cloudgc
Copy link

cloudgc commented Aug 7, 2024

i write demo project

https://github.com/cloudgc/apm-spring-jms

already applied to actual company projects

If you need it urgently, you can fork from it, I will consider adding this plug-in later.

@wu-sheng
Copy link
Member

wu-sheng commented Aug 7, 2024

Close for now. Discussion could continue.
If either of you wants to add the new one, send a new pull request.

@wu-sheng wu-sheng closed this Aug 7, 2024
@hyhyf
Copy link
Contributor Author

hyhyf commented Aug 7, 2024

Close for now. Discussion could continue. If either of you wants to add the new one, send a new pull request.

Agree, thank you for your guidance. @wu-sheng

@hyhyf
Copy link
Contributor Author

hyhyf commented Aug 7, 2024

i write demo project

https://github.com/cloudgc/apm-spring-jms

already applied to actual company projects

If you need it urgently, you can fork from it, I will consider adding this plug-in later.

I have viewed your demo, and it cloud work together with the activemq-5.x-plugin to create duplicate consumer entry spans. @cloudgc

@cloudgc
Copy link

cloudgc commented Aug 7, 2024

There is indeed a problem
image
This is the call graph. I will think of a friendly way to fix it.

@wu-sheng
Copy link
Member

wu-sheng commented Aug 7, 2024

i write demo project

https://github.com/cloudgc/apm-spring-jms

already applied to actual company projects

If you need it urgently, you can fork from it, I will consider adding this plug-in later.

I have viewed your demo, and it cloud work together with the activemq-5.x-plugin to create duplicate consumer entry spans. @cloudgc

What do you mean duplicate? Does it leverage the nested entry span mechanism? Which make only the first entry span left.
Is that what you mean?

@hyhyf
Copy link
Contributor Author

hyhyf commented Aug 7, 2024

I don't think that, the demo projcet will create a new entry span link through ActiveMQ producer span, this repeats with ActiveMQ consumer.

The process of use spring JMS & third-party MQ would be like:

-> create connectionFactory(take ActiveMQ for example)
-> JMS send message
-> MQ client create message(the activemq plugin is working, create producer entry span)
-> JMS listener
-> MQ client consume message(the activemq plugin is working, create consumer entry span)
-> JMS listener execute(the activemq plugin lost trace)

@cloudgc
Copy link

cloudgc commented Aug 8, 2024

the final effect is as follows:
image
image

activemq-consumer entry was stop when over dequeue method
so there must be a new span at the same level with MQ-consumer Span

and i fix my demo : apm-spring-jms

@hyhyf
Copy link
Contributor Author

hyhyf commented Aug 8, 2024

the final effect is as follows: image image

activemq-consumer entry was stop when over dequeue method so there must be a new span at the same level with MQ-consumer Span

and i fix my demo : apm-spring-jms

I have discussed with @wu-sheng, and create two entry spans in the consumer part, which will cause the consumer traffic to be counted twice.

So far, i think the better way is to update the active MQ plugin, and generate a context snapshot when creating messages, the spring JMS plugin create a local span, if message has a context snapshot, it will be linked.

@cloudgc
Copy link

cloudgc commented Aug 8, 2024

should be , not only activemq needs to do this, other mq queues need create context snapshot , looking forward to your code changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants