Skip to content

Add optional name field to SpanRefinement#1403

Open
Copilot wants to merge 5 commits intomainfrom
copilot/allow-spanrefinement-override-name-note
Open

Add optional name field to SpanRefinement#1403
Copilot wants to merge 5 commits intomainfrom
copilot/allow-spanrefinement-override-name-note

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 3, 2026

SpanRefinement cannot override the name structure from its base span, preventing provider-specific span name formats (e.g., GenAI conventions that explicitly allow individual systems to specify different span name formats).

Changes

  • crates/weaver_semconv/src/v2/span.rs: Add name: Option<SpanName> to SpanRefinement, with serde skip-if-none. Added tests for parsing with and without the field.
  • schemas/semconv-syntax.v2.md: Document the new optional name property in span_refinements definition.
  • schemas/semconv.schema.v2.json: Regenerated JSON schema to include the new optional name field.

Usage

span_refinements:
  - id: gen_ai.inference.client
    ref: gen_ai.client
    name:
      note: "{gen_ai.operation.name} {gen_ai.request.model}"
    brief: GenAI inference client span
    attributes:
      - ref: gen_ai.operation.name
        requirement_level: required

Resolution: if the refinement sets name, the entire name structure replaces the base span's name; otherwise, the base span's name is inherited. The resolved schema and forge crates already propagate name through their flattened Span struct, so no changes needed there.

Allow SpanRefinement to specify an optional `name: SpanName` field
that overrides the `name.note` from the referenced base span.
This enables provider-specific span name formats as described in
conventions like GenAI.

Agent-Logs-Url: https://github.com/open-telemetry/weaver/sessions/ad40e493-8bd6-4a7a-824f-22b6ac4a00bb

Co-authored-by: lmolkova <2347409+lmolkova@users.noreply.github.com>
Copilot AI changed the title [WIP] Add SpanRefinement to override name.note in definition Add optional name field to SpanRefinement May 3, 2026
Copilot AI requested a review from lmolkova May 3, 2026 18:46
@lmolkova
Copy link
Copy Markdown
Member

lmolkova commented May 3, 2026

@copilot go fix ci errors

@codecov
Copy link
Copy Markdown

codecov Bot commented May 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.4%. Comparing base (69132ef) to head (6a6978c).

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #1403     +/-   ##
=======================================
- Coverage   82.4%   82.4%   -0.1%     
=======================================
  Files        120     120             
  Lines      10092   10092             
=======================================
- Hits        8320    8319      -1     
- Misses      1772    1773      +1     

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 3, 2026

@copilot go fix ci errors

Fixed in afaf1d3 — two issues: a rustfmt formatting nit in the test file, and the schemas/semconv.schema.v2.json needed regeneration to include the new optional name field on SpanRefinement.

Comment thread schemas/semconv-syntax.v2.md Outdated
Copilot AI requested a review from lmolkova May 3, 2026 19:18
@lmolkova lmolkova marked this pull request as ready for review May 3, 2026 19:18
@lmolkova lmolkova requested a review from a team as a code owner May 3, 2026 19:18
Comment thread schemas/semconv.schema.v2.json Outdated
Copilot AI requested a review from lmolkova May 3, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow SpanRefinement to override name.note in definition/2

2 participants