dodjdnh opened a new pull request, #3724: URL: https://github.com/apache/dubbo-go/pull/3724
## Change Description This PR aligns the `rpc.service` attribute of Dubbo Go RPC Traces with the `interface` Label of RPC Metrics, enabling upper-layer systems such as Dubbo Admin to query Metrics from Traces using the same interface identifier. The core contract is: ```text Trace rpc.service == Metric interface ``` ## Problem Background Dubbo Go currently uses `url.Service()` for the `interface` Label in RPC Metrics: ```go constant.TagInterface: url.Service() ``` However, Server and Client RPC Spans use `url.ServiceKey()` for `rpc.service`: ```go semconv.RPCService(invoker.GetURL().ServiceKey()) ``` When a service is configured with group or version, the two signals produce different values. For example: ```text Metric interface = org.apache.dubbo.samples.OrderService Trace rpc.service = gray/org.apache.dubbo.samples.OrderService:1.0.0 ``` `ServiceKey()` represents a composite service key containing group, interface, and version, and is suitable for service registration, routing, and unique identification. However, `rpc.service` here needs to represent the pure fully qualified interface name so that it remains consistent with the existing Metric `interface` field. ## Changes Change the value source of `rpc.service` in the Server and Client Trace Filters from: ```go invoker.GetURL().ServiceKey() ``` to: ```go invoker.GetURL().Service() ``` After this change, even when group/version is configured, the interface identifier remains consistent: ```text rpc.service = org.apache.dubbo.samples.OrderService interface = org.apache.dubbo.samples.OrderService ``` Directly reusing `url.Service()` also preserves the existing interface parameter and Path fallback logic, without duplicating `ServiceKey()` parsing in the Trace Filter. ## Use Case When Dubbo Admin queries aggregated Metrics around the time of a Dubbo RPC Span, it can directly use the following mapping: ```text service.name → application_name rpc.service → interface rpc.method → method SpanKind → provider / consumer metric family ``` This PR only stabilizes the `rpc.service → interface` field semantics and does not introduce any Dubbo Admin or Grafana page logic into Dubbo Go. ## Compatibility and Impact - Does not modify the behavior of the public `URL.ServiceKey()`. - Does not affect service registration, routing, or unique service identification. - Does not modify existing Metric names or Labels. - Does not modify Span names. - Does not add `dubbo.group`, `dubbo.version`, or other Span attributes. - `rpc.system`, `rpc.method`, and SpanKind remain unchanged. This change modifies the value of the `rpc.service` attribute when group/version is configured. This is an intentional semantic correction to keep it consistent with Dubbo Java and the interface field of Dubbo Go Metrics. ## Tests The following tests are added or updated: - [ ] The Server / Provider Span uses the pure fully qualified interface name for `rpc.service`. - [ ] The Client / Consumer Span uses the pure fully qualified interface name for `rpc.service`. - [ ] When group/version is configured, `rpc.service` does not contain group/version. - [ ] `rpc.service` and Metric `interface` use consistent semantics. - [ ] `rpc.system=apache_dubbo`, `rpc.method`, and SpanKind behavior remain unchanged. - [ ] Related Go unit tests pass. - [ ] `git diff --check` passes. ## Out of Scope - Span name standardization. - Separate `dubbo.group`, `dubbo.version`, or other attributes. - Metric → Trace / Exemplar. - Log and Trace correlation. - Dubbo Admin, Grafana, or Dashboard changes. ## Related Issues - Related to [apache/dubbo-go#3562](https://github.com/apache/dubbo-go/issues/3562) - References [apache/dubbo-go#3551](https://github.com/apache/dubbo-go/pull/3551) - Expected contract on the Dubbo Admin side: `Trace rpc.service == Metric interface` -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
