GitHub user AsperforMias edited a discussion: Observability field mappings at develop@9af40a2b
For #3720, I checked how RPC metrics, OpenTelemetry spans, logs and metadata represent the same fields at [`develop@9af40a2b`](https://github.com/apache/dubbo-go/commit/9af40a2b835b5176be453b5f3936b1fc53a7ead4). The source and test links below refer to that revision. Update, 2026-10-16: #3743 has since added Path-fallback and metric-interface regression tests, and #3744 has added dynamic logger tests. Both merged on September 20. #3763 proposes additional logger assertions. These changes are separate from the revision audited here. ## RPC metrics and spans | Field | RPC metrics | OpenTelemetry | | --- | --- | --- | | Application | `application_name` from URL `application` | Resource `service.name` from `Application.Name` | | Application version | `application_version` from URL `app.version` | Resource `service.version` from `Application.Version` | | Interface | `interface` = `url.Service()` | `rpc.service` = `url.Service()` | | Method | `method` = `invocation.MethodName()` | `rpc.method` = `invocation.MethodName()` | | Group | `group` = `url.Group()` | `dubbo.group`, when non-empty | | Service version | `version` from the URL | `dubbo.version`, when non-empty | | Calling side | `dubbo_provider_*` / `dubbo_consumer_*` metric names | SERVER / CLIENT span kind | | Protocol | No RPC label | No RPC attribute | | RPC system | No corresponding label | `rpc.system=apache_dubbo` | | Instance | `ip` and `hostname` | No host/IP field in these spans or their configured resource | See [RPC labels][rpc-labels], [metric families][rpc-families], [span attributes][rpc-trace], and [resource configuration][resource]. The resource also sets `service.namespace` from the application organization through [instance initialization][init]. The OTel span name is `ActualMethodName()`, while `rpc.method` uses `MethodName()`. They can differ for generic `$invoke` calls. The [legacy OpenTracing filter][opentracing] uses `ServiceKey() + "#" + MethodName()` for its span name. [`URL.ServiceKey()`][url] remains the composite registration/routing key, `group/interface:version`. It omits version `0.0.0`; the metric `version` and trace `dubbo.version` retain the raw value. Neither metric `interface` nor OTel `rpc.service` uses the composite key at this revision. RPC failures increment both the total-failed counter and a category-specific counter. The [classifier][classifier] maps Triple/gRPC codes as follows: | Code | Counter category | | --- | --- | | `CodeDeadlineExceeded` | timeout | | `CodeResourceExhausted` | limit | | `CodeUnavailable`, `CodePermissionDenied` | service unavailable | | `CodeBizError` | business failure | | Other errors, including Dubbo-protocol errors | unknown | Network and codec error types are declared but not produced. There is no `error_type` label; [`TagErrorCode`][metric-constants] is defined but unused. The [collector][rpc-collector] chooses the counter family. The OTel filter sets the span status and uses `err.Error()` as its description; it does not call `RecordError` on this path. Existing tests: [labels][rpc-label-tests], [classification][classifier-tests], [span attributes][rpc-trace-tests], and [metrics filter][metrics-filter-tests]. Metrics and tracing filters are appended when their respective settings are enabled ([client][client], [server][server]); they are absent from the [default filter lists][defaults]. ## Logs `logger.trace-integration.enabled` [defaults to false][logger-config]. When enabled, the [Zap factory][zap-factory] or [Logrus factory][logrus-factory] selects the context-aware adapter. A `Ctx*` call with a valid span context adds `trace_id`, `span_id` and `trace_flags`, using [the context extractor][trace-extractor]. An ordinary logging call does not add them, and an invalid or missing span context leaves them absent. The [Zap][zap-context] and [Logrus][logrus-context] adapters do not automatically add service, method, group, version or error-classification fields. `CtxError*` can record the error on a recording span when `record-error-to-span` is enabled. The [AccessLog filter][access-log] has a different format. `buildAccessLogData` copies `interface` (falling back to `path`), `method`, `version`, `group`, `timestamp`, `local-addr` and `remote-addr` from attachments. It derives `types` and `arguments` from `invocation.Arguments()`. The fixed formatter renders those fields only. Adding `trace_id`, `span_id` or `traceparent` to attachments does not put them in the access log. Existing tests: [Zap context logs][zap-tests], [Logrus context logs][logrus-tests], and [trace extraction][trace-extractor-tests]. ## Metadata In [the metadata catalog][metadata-info], `MetadataInfo.App` holds the application name. `ServiceInfo` contains `name`, `group`, `version`, `protocol`, `port`, `path` and `params`. Method names live under the `methods` parameter. Service/match keys are computed from the service identity and protocol; application version is not a separate `ServiceInfo` field. The [mapping metric handlers][metadata-collector] use [application-level tags][metric-levels] plus `interface` and `group` from event attachments. A non-empty attachment `application` overrides `application_name`; otherwise the application-level name is retained. These mapping metrics have no `method` or service-version label. Register/remove operations count success using `Succ`. Get/listen use `Succ && !Partial`, so a partial success increments the failed counter. Each operation also increments its total counter and records RT. Other metadata metrics use their own dimensions: store-provider uses `interface`; fetch adds `provider_app`, `result`, `source` and `storage_type`; cache adds `provider_app` and uses hit/miss counter names. See [metric definitions][metadata-metrics] and [handler tests][metadata-tests]. Catalog tests are in [metadata_info_test.go][metadata-info-tests]. ## Compatibility and follow-ups The existing metric names and labels are used by queries, so changes need coordination through #3337. Application versions, service versions and instance labels multiply series; trace/span IDs, revisions, payloads, full URLs and error messages should stay out of default metric labels. `rpc.service` already matches metric `interface` through `url.Service()`. Code that previously parsed a composite key from `rpc.service` needs the separate group/version fields. `URL.ServiceKey()` must retain its registration and routing meaning. The following differences remain useful to discuss with the existing owners: | Difference | Code | Related work / owner | Example to check | | --- | --- | --- | --- | | Dubbo, network and codec failures fall into unknown | [RPC classifier][classifier] | #3337 — Saramanda9988 | Pass a Dubbo-protocol error and inspect `*_unknown_failed_total` | | RPC protocol is absent from metrics and spans | [Labels][rpc-labels], [OTel filter][rpc-trace] | #3337 — Saramanda9988; #3338 — jiaming2li / Oxidaner | Compare a Triple call and a Dubbo call | | Generic-call span name and `rpc.method` can differ | [OTel filter][rpc-trace], [invocation][invocation] | #3338 — jiaming2li / Oxidaner | Compare `$invoke` with its actual method name | | Context logs lack service/method fields | [Zap][zap-context], [Logrus][logrus-context] | #3562 coordination; no implementation owner recorded | Inspect a context log from a normal RPC | | Access logs omit trace IDs even when attached | [AccessLog][access-log] | No implementation owner recorded | Add IDs to attachments and inspect the rendered log | #3551 proposes different span names and additional attributes. Those proposals are not behavior observed at this pin. Logger regression coverage is tracked by #3721: #3744 has merged, with further assertions in #3763. ## Verification Reran the nine cited packages on 2026-10-16 with Go 1.25.0 on darwin/arm64; all passed: ```sh GOTOOLCHAIN=go1.25.0 go test -mod=readonly -count=1 \ ./metrics/rpc ./filter/otel/trace ./filter/metrics \ ./logger ./logger/core/zap ./logger/core/logrus \ ./filter/accesslog ./metadata/info ./metrics/metadata ``` Validation here covers the listed Go packages. The AccessLog and metadata corrections were also checked against the builder, formatter and handlers linked above. [rpc-labels]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/metrics/rpc/util.go [rpc-families]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/metrics/rpc/metric_set.go [rpc-trace]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/filter/otel/trace/filter.go [resource]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/otel/trace/exporter.go [init]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/instance_options_init.go [opentracing]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/filter/tracing/filter.go [url]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/common/url.go [classifier]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/metrics/rpc/error_classifier.go [rpc-collector]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/metrics/rpc/collector.go [rpc-label-tests]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/metrics/rpc/util_test.go [classifier-tests]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/metrics/rpc/error_classifier_test.go [rpc-trace-tests]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/filter/otel/trace/filter_test.go [metrics-filter-tests]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/filter/metrics/filter_test.go [client]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/client/action.go [server]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/server/action.go [defaults]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/common/constant/default.go [logger-config]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/global/logger_config.go [zap-factory]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/logger/core/zap/zap.go [logrus-factory]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/logger/core/logrus/logrus.go [trace-extractor]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/logger/trace_extractor.go [zap-context]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/logger/core/zap/ctx_logger.go [logrus-context]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/logger/core/logrus/ctx_logger.go [access-log]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/filter/accesslog/filter.go [zap-tests]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/logger/core/zap/ctx_logger_test.go [logrus-tests]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/logger/core/logrus/ctx_logger_test.go [trace-extractor-tests]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/logger/trace_extractor_test.go [metadata-info]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/metadata/info/metadata_info.go [metadata-collector]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/metrics/metadata/collector.go [metric-levels]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/metrics/common.go [metadata-metrics]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/metrics/metadata/metric_set.go [metadata-tests]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/metrics/metadata/collector_test.go [metadata-info-tests]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/metadata/info/metadata_info_test.go [invocation]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/protocol/invocation/rpcinvocation.go [metric-constants]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/common/constant/metric.go GitHub link: https://github.com/apache/dubbo-go/discussions/3766 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
