GitHub user AsperforMias edited a discussion: Dubbo-Go 可观测字段梳理
For #3720. This audit uses [`develop@9af40a2b`](https://github.com/apache/dubbo-go/commit/9af40a2b835b5176be453b5f3936b1fc53a7ead4); the source and test links use the same revision. Metric `interface` and OTel `rpc.service` both use `URL.Service()`. The main differences are in generic-call method names, error fields and log correlation. ## RPC fields | Field | Metrics | OTel | | --- | --- | --- | | 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` = `MethodName()` | `rpc.method` = `MethodName()`; span name = `ActualMethodName()` | | Group / service version | URL `group` / `version` | `dubbo.group` / `dubbo.version`, when non-empty | | Calling side | `dubbo_provider_*` / `dubbo_consumer_*` names | SERVER / CLIENT span kind | | Protocol | Absent | Absent; `rpc.system` is `apache_dubbo` | | Instance | `ip`, `hostname` | No host/IP field in these spans or their configured resource | Sources: [RPC labels][labels], [metric families][families], [OTel filter][otel], [resource setup][resource], [application configuration][init]. Tests: [labels][label-tests], [span attributes][span-tests]. RPC failures use separate timeout, limit, unavailable, business and unknown counter families, with no `error_type` label. The [classifier][classifier] handles Triple/gRPC codes; Dubbo-protocol errors fall into unknown. Network and codec categories are declared but not produced. The [collector][collector] updates the counters. The OTel filter records an error status and `err.Error()` as its description, without calling `RecordError` on that path. ## Logs [Trace integration][log-config] defaults to false. With the context-aware [Zap][zap] or [Logrus][logrus] adapter, a `Ctx*` call adds `trace_id`, `span_id` and `trace_flags` from a valid span context. Ordinary calls and contexts without a valid span omit those fields. Service, method, protocol, side and error category are not added automatically. `CtxError*` can record errors on a recording span when configured. See [the extractor][extractor], [Zap tests][zap-tests] and [Logrus tests][logrus-tests]. [AccessLog][accesslog] copies a fixed set of attachments: interface (with path fallback), method, version, group, timestamp, `local-addr` and `remote-addr`. It derives `types` and `arguments` from `invocation.Arguments()`. Its builder and formatter ignore `trace_id`, `span_id` and `traceparent`, even when those keys are attached. ## Metadata The [catalog][catalog] stores the application in `MetadataInfo.App`. `ServiceInfo` contains name, group, service version, protocol, port, path and params; method names are in the `methods` parameter. It has no calling-side or error-category field. [Mapping metrics][mapping] use [application tags][levels] plus `interface` and `group` from attachments. A non-empty attachment `application` overrides `application_name`; otherwise the application-level value is retained. There is no method or service-version label. Register/remove use `Succ` to count success. Get/listen use `Succ && !Partial`, so partial success increments the failed counter. Each operation also records its total count and RT. Fetch adds `provider_app`, `result`, `source` and `storage_type`; cache adds `provider_app` with hit/miss counters. See [definitions][metadata-metrics] and [tests][metadata-tests]. ## Compatibility and follow-ups Keep existing metric names/labels and the registration/routing meaning of [`ServiceKey()`][url]. That key has the form `group/interface:version` and omits version `0.0.0`; the telemetry version fields retain the raw value. Trace/span IDs, revisions, URLs, payloads and error messages should stay out of default metric labels. | Difference | Code | Related work / owner | Check | | --- | --- | --- | --- | | Error fields differ across signals | [Classifier][classifier], [OTel][otel], [log adapters][zap] | #3337 — Saramanda9988; #3338 — jiaming2li / Oxidaner | Compare wrapped Triple and Dubbo errors across counters, spans and logs | | Generic-call span name can differ from `rpc.method` | [OTel][otel], [invocation][invocation] | #3338 — jiaming2li / Oxidaner | Compare `$invoke` with its actual method name | | AccessLog has no trace correlation | [Builder and formatter][accesslog] | No implementation owner recorded | Attach trace IDs and inspect the emitted log | #3551 proposes span-name and attribute changes; those are not present at this pin. Update, 2026-10-16: #3743 and #3744 merged after the audited revision, adding Path-fallback and dynamic logger regression tests. #3763 proposes further logger assertions. ## Verification The nine packages below passed on 2026-10-16 with Go 1.25.0 / darwin/arm64. The audit branch changes documentation only; its runtime/test code remains at the audited revision. ```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 ``` [labels]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/metrics/rpc/util.go [families]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/metrics/rpc/metric_set.go [otel]: 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 [label-tests]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/metrics/rpc/util_test.go [span-tests]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/filter/otel/trace/filter_test.go [classifier]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/metrics/rpc/error_classifier.go [collector]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/metrics/rpc/collector.go [log-config]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/global/logger_config.go [zap]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/logger/core/zap/ctx_logger.go [logrus]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/logger/core/logrus/ctx_logger.go [extractor]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/logger/trace_extractor.go [accesslog]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/filter/accesslog/filter.go [catalog]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/metadata/info/metadata_info.go [mapping]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/metrics/metadata/collector.go [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 [url]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/common/url.go [invocation]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/protocol/invocation/rpcinvocation.go [init]: https://github.com/apache/dubbo-go/blob/9af40a2b835b5176be453b5f3936b1fc53a7ead4/instance_options_init.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 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]
