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

[Feature] add RocketMq consumer mq.topic tag #8223

Closed
3 tasks done
zhyyu opened this issue Dec 1, 2021 · 17 comments · Fixed by apache/skywalking-java#369
Closed
3 tasks done

[Feature] add RocketMq consumer mq.topic tag #8223

zhyyu opened this issue Dec 1, 2021 · 17 comments · Fixed by apache/skywalking-java#369
Assignees
Labels
feature New feature java Java agent related plugin Plugin for agent or collector. Be used to extend the capabilities of default implementor.
Milestone

Comments

@zhyyu
Copy link
Contributor

zhyyu commented Dec 1, 2021

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Description

RocketMQ consumer segment don't contain mq.topic tag, so the UI trace page can not search consumer segment when input mq.topic=TopicTest tag. I want to change RocketMQ agent, add mq.topic tag into consumer segment.

Use case

I checked the agent code and found consumer interceptor AbstractMessageConsumeInterceptor

@Override
    public final void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
        Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
        List<MessageExt> msgs = (List<MessageExt>) allArguments[0];

        ContextCarrier contextCarrier = getContextCarrierFromMessage(msgs.get(0));
        AbstractSpan span = ContextManager.createEntrySpan(CONSUMER_OPERATION_NAME_PREFIX + msgs.get(0)
                                                                                                .getTopic() + "/Consumer", contextCarrier);

        span.setComponent(ComponentsDefine.ROCKET_MQ_CONSUMER);
        SpanLayer.asMQ(span);
        for (int i = 1; i < msgs.size(); i++) {
            ContextManager.extract(getContextCarrierFromMessage(msgs.get(i)));
        }

    }

I add one line Tags.MQ_TOPIC.set(span, msgs.get(0).getTopic()); after span created. I tested it on my local machine, it worked.

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@zhyyu zhyyu added the feature New feature label Dec 1, 2021
@wu-sheng
Copy link
Member

wu-sheng commented Dec 1, 2021

We are not accepting more RocketMQ plugin codes, unless plugin test is added with it.

@wu-sheng wu-sheng added TBD To be decided later, need more discussion or input. java Java agent related plugin Plugin for agent or collector. Be used to extend the capabilities of default implementor. labels Dec 1, 2021
@wu-sheng
Copy link
Member

wu-sheng commented Dec 1, 2021

This plugin can't be verified automatically currently, so, you need to follow plugin test document to add tests for supported versions. Then we could continue on new feature.

@zhyyu
Copy link
Contributor Author

zhyyu commented Dec 1, 2021

Can you tell me where is the "plugin test document" ? I read java-agent doc and not find it.

@wu-sheng
Copy link
Member

wu-sheng commented Dec 8, 2021

@zhyyu Any update about this?

@zhyyu
Copy link
Contributor Author

zhyyu commented Dec 9, 2021

@zhyyu Any update about this?

my mac m1 can not run the bash ./test/plugin/run.sh -f ${scenario_name}

bash ./test/plugin/run.sh -f ${scenario_name}

[INFO] SkyWalking Tomcat Runner Image ..................... FAILURE [  0.559 s]
[INFO] SkyWalking JVM Runner Image ........................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  18.494 s
[INFO] Finished at: 2021-12-09T10:09:36+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.33.0:build (build) on project tomcat-container: Execution build of goal io.fabric8:docker-maven-plugin:0.33.0:build failed: An API incompatibility was encountered while executing io.fabric8:docker-maven-plugin:0.33.0:build: java.lang.UnsatisfiedLinkError: could not load FFI provider jnr.ffi.provider.jffi.Provider
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>io.fabric8:docker-maven-plugin:0.33.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy


find fabric8io/docker-maven-plugin#1257 docker-maven-plugin conflict with m1 ship. So I am blocked now...

@wu-sheng
Copy link
Member

wu-sheng commented Dec 9, 2021

OK, I don't have a M1 chip for now. Could you try it on any Linux? I think it should work.

@zhyyu
Copy link
Contributor Author

zhyyu commented Dec 13, 2021

OK, I don't have a M1 chip for now. Could you try it on any Linux? I think it should work.

I have a x86 windows. I think I can run the script on virtual box on that windows. But it will take some times...

@wu-sheng
Copy link
Member

I can see fabric8io/docker-maven-plugin has 0.38.0 released recently, could someone try it? If you have a M1?

@zhyyu
Copy link
Contributor Author

zhyyu commented Mar 31, 2022

I can see fabric8io/docker-maven-plugin has 0.38.0 released recently, could someone try it? If you have a M1?

I will try it recently.

@zhyyu
Copy link
Contributor Author

zhyyu commented May 5, 2022

fabric8io/docker-maven-plugin 0.38.1 worked, but still error

[ERROR] Failed to execute goal org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1:compile (grpc-build) on project mock-collector: Unable to resolve artifact: Missing:
[ERROR] ----------
[ERROR] 1) com.google.protobuf:protoc:exe:osx-aarch_64:3.3.0

I add -Dos.detected.classifier=osx-x86_64 but still don't work.

./test/plugin/run.sh: line 187:  9289 Killed: 9               ${mvnw} --batch-mode -f ${home}/pom.xml -DskipTests -Dos.detected.classifier=osx-x86_64 -Dbase_image_java=${base_image_java} -Dbase_image_tomcat=${base_image_tomcat} -Dcontainer_image_version=${container_image_version} clean package

@lujiajing1126
Copy link
Contributor

lujiajing1126 commented May 5, 2022

fabric8io/docker-maven-plugin 0.38.1 worked, but still error

[ERROR] Failed to execute goal org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1:compile (grpc-build) on project mock-collector: Unable to resolve artifact: Missing:
[ERROR] ----------
[ERROR] 1) com.google.protobuf:protoc:exe:osx-aarch_64:3.3.0

I add -Dos.detected.classifier=osx-x86_64 but still don't work.

./test/plugin/run.sh: line 187:  9289 Killed: 9               ${mvnw} --batch-mode -f ${home}/pom.xml -DskipTests -Dos.detected.classifier=osx-x86_64 -Dbase_image_java=${base_image_java} -Dbase_image_tomcat=${base_image_tomcat} -Dcontainer_image_version=${container_image_version} clean package

I've checked the issue in Skywalking-java repo. You have to update the protoc which may be hardcoded in many test cases now.

protobuf for Apple Silicon have been supported from 3.17.3, see the comment and related PR there #8522 (comment)

Also, on M1 models, I was using Ecplise/Temurin distribution which can be used to build the project since it is built for x86_64.

@zhyyu
Copy link
Contributor Author

zhyyu commented Oct 18, 2022

Can configuration.yml dependencies support command command, the official rocketmq docker image have to to use this comand like below

https://github.com/apache/rocketmq-docker

version: '2'
services:
  namesrv:
    image: apache/rocketmq:4.5.0
    ...
    command: sh mqnamesrv
  broker:
    image: apache/rocketmq:4.5.0
    ...
    command: sh mqbroker -n namesrv:9876 -c ../conf/broker.conf
    depends_on:
      - namesrv

Right now it don't support command command

Caused by: org.yaml.snakeyaml.error.YAMLException: Unable to find property 'command' on class: org.apache.skywalking.plugin.test.helper.vo.DependencyComponent
        at org.yaml.snakeyaml.introspector.PropertyUtils.getProperty(PropertyUtils.java:158)
        at org.yaml.snakeyaml.introspector.PropertyUtils.getProperty(PropertyUtils.java:148)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.getProperty(Constructor.java:287)
        at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:208)
        ... 20 more

@wu-sheng
Copy link
Member

You could add this through a pull request I think. The docker configuration is just generated through the codes inside test folder.

@zhyyu
Copy link
Contributor Author

zhyyu commented Oct 19, 2022

You could add this through a pull request I think. The docker configuration is just generated through the codes inside test folder.

Ok, I am trying work on it.

@wu-sheng
Copy link
Member

As you are going to follow this, @zhyyu Notice there is an enhancement at the backend to provide MQ relative analysis from spans.
Please check this #9855 and be aware of which tags are required/recommended for the analysis.

@zhyyu
Copy link
Contributor Author

zhyyu commented Oct 28, 2022

As you are going to follow this, @zhyyu Notice there is an enhancement at the backend to provide MQ relative analysis from spans. Please check this #9855 and be aware of which tags are required/recommended for the analysis.

Yes, I am going to finish it. Right now the rocketmq-scenario is ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature java Java agent related plugin Plugin for agent or collector. Be used to extend the capabilities of default implementor.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants