apache / apache/rocketmq-clients

[Feature] 接入 OpenTelemetry 链路追踪,方便消息跟踪

Open
#703 5 comments 2 reactions 0 assignees View on GitHub
C# no stale type/new feature
Dominant language
Java
Stars
505
Forks
313
Avg merge
11h 28m
Merged PRs (30d)
6

Description

### Programming Language of the Client

C#

### Is Your Feature Request Related to a Problem?

C# 客户端无法对消息进行追踪

### Describe the Solution You'd Like

通过向 DiagnosticListener 写入相关事件,为消息加入相关的追踪数据。

### Describe Alternatives You've Considered

=== SDK 修改开始 ===
1. 定义一个名称为 ```Org.Apache.Rocketmq``` 的 DiagnosticListener。
2. 在 ClientManager 发送消息时,向 DiagnosticSource 中写入 ```SendMessage``` 事件,载荷为当次发送的所有消息的数组。
3. 在 ClientManager 接收消息时,向 DiagnosticSource 中写入 ```ReceiveMessage``` 事件,载荷为当次接收的所有消息的数组。
=== SDK 修改完毕 ===

=== OpenTelemetry 实现开始 ===
4. 此时可在外部对通过 DiagnosticListener 订阅名称为 ```Org.Apache.Rocketmq``` 的事件。
5. 在 SendMessage 事件中,依次遍历载荷中的消息,判断消息的 ```SystemProperties.TraceContext``` 是否包含相关数据。
5.1 包含跟踪数据,不做任何处理,放行即可。
5.2 不包含跟踪数据,写入跟踪信息,并上报。
6. 在 ReceiveMessage 事件中,依次遍历载荷中的消息,判断消息的 ```SystemProperties.TraceContext``` 是否包含相关数据。
6.1 不包含跟踪数据,不做任何处理,放行即可。
6.2 包含跟踪数据,读取跟踪信息,并上报。
=== OpenTelemetry 实现完毕 ===

### Additional Context

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the C# ClientManager send and receive paths and the SystemProperties.TraceContext definition. Review how DiagnosticListener and DiagnosticSource are currently used, then verify that SendMessage and ReceiveMessage events can carry message arrays and expose the stated trace-context behavior; completion should include coverage for both event paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.