darkness-2nd opened a new issue, #12481: URL: https://github.com/apache/skywalking/issues/12481
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no similar issues. ### Apache SkyWalking Component Java Agent (apache/skywalking-java) ### What happened I make a demo consumer use spring annotation KafkaListener, and make a REST API to do send kafka message by KafkaTemplate ,but when I make a breakpoint at org.apache.kafka.clients.consumer.KafkaConsumer#poll(long, boolean) before call method "pollAndFetchs", and then I make 5 http request in browser, after 1 miniutes, I resume the breakpoint, the kafka agent may mix up some messages and make those mixed message to another trace. the test code is as follows `@GetMapping("/spring/kafka")` `public String testSpringKafka() {` ` String traceId = TraceContext.traceId();` ` kafkaTemplate.send("TOPIC_DEDUCT_MONEY", "key", "msg");` ` return "OK";` `}` `@KafkaListener(` ` topics = {"TOPIC_DEDUCT_MONEY"},` ` groupId = "study-account"` `)` `public void deductStorage(ConsumerRecord<String, String> consumerRecord) {` ` String value = consumerRecord.value();` ` System.out.printf("deduct money,msg:%s%n", value);` `}` I expect that the 5 messages can be the child span of its own http request, but there are 2 messages were belonged to a request that didn't send it. The traces "3480b2ffc8594b1ab8749fc2af82ef74.82.17219730707690001" and "3480b2ffc8594b1ab8749fc2af82ef74.84.17219730707740001" don't have consume span, but another 3 http requests have its child consume span.   And look at the dashboard, there are only 3 consume segments, What's even more amazing is that the Consume span "3480b2ffc8594b1ab8749fc2af82ef74.83.17219730707690001" has 2 traceIds in its detail info, and those traces are belongs to ""3480b2ffc8594b1ab8749fc2af82ef74.82.17219730707690001" and "3480b2ffc8594b1ab8749fc2af82ef74.84.17219730707740001", which are missing in the dashboard.  ### What you expected to happen I hope these two missing consume spans can be displayed on the dashboard and in the parent http request span to which they belong ### How to reproduce `@GetMapping("/spring/kafka")` `public String testSpringKafka() {` ` String traceId = TraceContext.traceId();` ` kafkaTemplate.send("TOPIC_DEDUCT_MONEY", "key", "msg");` ` return "OK";` `}` `@KafkaListener(` ` topics = {"TOPIC_DEDUCT_MONEY"},` ` groupId = "study-account"` `)` `public void deductStorage(ConsumerRecord<String, String> consumerRecord) {` ` String value = consumerRecord.value();` ` System.out.printf("deduct money,msg:%s%n", value);` `}` In kafka 2.0.x ~ 3.6.x, make a breakpoint at org.apache.kafka.clients.consumer.KafkaConsumer#poll(long, boolean). In kafka 3.7.x, make a breakpoint at org.apache.kafka.clients.consumer.KafkaConsumer#poll(long) and org.apache.kafka.clients.consumer.KafkaConsumer#poll(java.time.Duration). And then call more than 5 http requests, then wait about 1 minutes, resume the breakpoint, then access the dashboard. ### Anything else _No response_ ### Are you willing to submit a pull request to fix on your own? - [X] Yes I am willing to submit a pull request on my own! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
