Skip to content

feat(otel): standardize trace span names and semantic attributes - #3551

Draft
jiaming2li wants to merge 3 commits into
apache:mainfrom
jiaming2li:feat/otel-trace-span-attributes
Draft

feat(otel): standardize trace span names and semantic attributes#3551
jiaming2li wants to merge 3 commits into
apache:mainfrom
jiaming2li:feat/otel-trace-span-attributes

Conversation

@jiaming2li

Copy link
Copy Markdown

Enhance OpenTelemetry tracing diagnostics (Fixes #3338, scope item 1).

  • Standardized span names to dubbo.consumer <service>/<method> (client) and dubbo.provider <service>/<method> (server).
  • Enriched span attributes:
    • OTel semantic conventions where available: rpc.system=apache_dubbo, rpc.service, rpc.method, server.address, server.port.
    • Dubbo-specific info under a stable dubbo.* namespace: dubbo.side, dubbo.protocol, dubbo.group, dubbo.version.
  • Extracted shared buildSpanName / buildSpanAttributes helpers to remove the duplicated span-construction logic between the client and server filters.
  • Added tests asserting span name, span kind, and attributes for both filters using an in-memory span recorder.

jiaming2li and others added 3 commits July 26, 2026 23:21
Enhance OpenTelemetry tracing diagnostics (issue apache#3338, scope item 1).

- Standardize span names as "dubbo.consumer <service>/<method>" and
  "dubbo.provider <service>/<method>" for both client and server filters.
- Enrich span attributes, preferring OTel semantic conventions where they
  exist (rpc.system, rpc.service, rpc.method, server.address, server.port)
  and using a stable dubbo.* namespace for Dubbo-specific fields
  (dubbo.side, dubbo.protocol, dubbo.group, dubbo.version).
- Extract shared buildSpanName/buildSpanAttributes helpers to remove the
  duplicated span-construction logic between the two filters.
- Add tests asserting span name, span kind, and attributes for both sides
  using an in-memory span recorder.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Reformat imports in the trace filter/semconv per imports-formatter.
- Update TestTripleClientOTELTraceparentIsolation to look up the consumer
  spans by the standardized "dubbo.consumer <service>/<method>" name, since
  the span is no longer named after the bare method.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Satisfy the repo's imports-formatter (make check-fmt), which requires three
separate import blocks.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@codecov-commenter

codecov-commenter commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.24%. Comparing base (53d81d1) to head (5d5d43a).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3551      +/-   ##
==========================================
+ Coverage   55.23%   55.24%   +0.01%     
==========================================
  Files         462      462              
  Lines       36005    36018      +13     
==========================================
+ Hits        19886    19899      +13     
  Misses      14562    14562              
  Partials     1557     1557              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Alanxtl Alanxtl added ✏️ Feature 3.3.3 version 3.3.3 labels Jul 27, 2026
@Alanxtl

Alanxtl commented Jul 27, 2026

Copy link
Copy Markdown
Member

cool work 其实还是要以实际出发 不用完全按着issue里面说的做

Comment on lines +37 to +43
DubboSideKey = attribute.Key("dubbo.side")
// DubboProtocolKey records the Dubbo protocol in use, e.g. "dubbo", "tri".
DubboProtocolKey = attribute.Key("dubbo.protocol")
// DubboGroupKey records the Dubbo service group.
DubboGroupKey = attribute.Key("dubbo.group")
// DubboVersionKey records the Dubbo service version.
DubboVersionKey = attribute.Key("dubbo.version")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dubbo.side这些常量可以移到common/const里面

Comment on lines +46 to +51
const (
// sideConsumer / sideProvider are the values used for DubboSideKey and the
// span-name prefix ("dubbo.consumer" / "dubbo.provider").
sideConsumer = "consumer"
sideProvider = "provider"
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Enhance OpenTelemetry tracing diagnostics / 增强 OpenTelemetry Trace 诊断能力

3 participants