dagehuifei opened a new issue, #1216:
URL: https://github.com/apache/rocketmq-clients/issues/1216

   ### Programming Language of the Client
   
   Go
   
   ### Is Your Feature Request Related to a Problem?
   
   The Go client (v5) of rocketmq-clients has implemented the core logic of 
Metrics and Tracing in the source code (metric.go / trace.go / telemetry.go), 
but these features are not exposed to external users:
   - No public API (e.g., WithMetric() / WithTracing()) to enable 
Metrics/Tracing
   - No configuration items (e.g., EnableTelemetry) to control the switch
   - Users cannot use the built-in OpenTelemetry integration and have to 
manually wrap metrics/tracing logic, which increases development costs and is 
inconsistent with the official implementation.
   
   In production environments, we need native support for Metrics (e.g., 
send/consume duration, lag count) and Tracing (e.g., traceId propagation) to 
monitor RocketMQ client status, but the current unexposed implementation makes 
it impossible to use these capabilities directly.
   
   ### Describe the Solution You'd Like
   
   1. Expose the built-in Metrics/Tracing capabilities through public APIs:
      - Add `WithMetric()` and `WithTracing()` ClientOption to enable 
Metrics/Tracing when creating Producer/Consumer
      - Or add `EnableTelemetry` field in `rocketmq.Config` to control the 
global switch
   
   2. Keep the Metrics/Tracing implementation consistent with the existing 
source code:
      - Retain the official metric names (e.g., 
rocketmq.producer.send.duration, rocketmq.consumer.lag)
      - Maintain compatibility with OpenTelemetry (OTLP)
      - Ensure traceId propagation between Producer and Consumer
   
   3. Add documentation for using Metrics/Tracing in the official README, 
including:
      - How to enable the feature
      - List of built-in metrics
      - How to integrate with Prometheus/Jaeger
   
   ### Describe Alternatives You've Considered
   
   Currently, we have to manually wrap the Metrics/Tracing logic by:
   - Replicating the metric names and logic from the official metric.go
   - Manually creating OpenTelemetry spans/metrics for Send/Consume operations
   - This approach is redundant (duplicating official code) and error-prone 
(inconsistent metric definitions).
   
   We also considered forking the repository and exposing the APIs ourselves, 
but this increases maintenance costs and is not conducive to upgrading to 
future official versions.
   
   ### Additional Context
   
   [Feature] Expose built-in Metrics and Tracing capabilities for Go client (v5)


-- 
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]

Reply via email to