Skip to content

Add UseLegacyAttributes flag to telemetry config - #3729

Merged
ChrisJBurns merged 5 commits into
mainfrom
otel/add-use-legacy-attributes-flag
Feb 10, 2026
Merged

ChrisJBurns merged 5 commits into
mainfrom
otel/add-use-legacy-attributes-flag

Conversation

@ChrisJBurns

@ChrisJBurns ChrisJBurns commented Feb 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a new UseLegacyAttributes boolean field to the telemetry Config struct, defaulting to true for backward compatibility with existing dashboards and alerts
  • Plumbs the flag through CLI (--otel-use-legacy-attributes), config file (use-legacy-attributes), operator CRD types (OpenTelemetryConfig.useLegacyAttributes), operator spectoconfig (reads from CR spec), runner config builder
  • CRDs updated: VirtualMCPServer, MCPServer, MCPRemoteProxy — all include useLegacyAttributes with default: true
  • The flag is not yet consumed by the telemetry middleware; a follow-up PR will add the conditional attribute emission logic

Context

This is the first PR in a series to support the MCP OTEL semantic conventions migration. The flag provides the plumbing so that a subsequent PR can conditionally emit legacy attribute names alongside the new standard names. The default will change to false in a future release, and the flag will eventually be removed.

Test plan

  • Unit tests for getTelemetryFromFlags updated to cover UseLegacyAttributes plumbing (CLI precedence, config fallback, default behavior)
  • Runner config builder tests updated with new parameter
  • Spectoconfig tests updated with UseLegacyAttributes assertion and new test case for reading from CR spec
  • CRD manifests regenerated for VirtualMCPServer, MCPServer, and MCPRemoteProxy
  • go build ./... compiles cleanly
  • task lint passes with 0 issues
  • All affected package tests pass

🤖 Generated with Claude Code

Add a new UseLegacyAttributes boolean field to the telemetry Config
struct, defaulting to true for backward compatibility. This flag will
control whether legacy (pre-MCP OTEL semconv) attribute names are
emitted alongside the new standard names. The default will change to
false in a future release.

Plumbs the flag through:
- CLI (--otel-use-legacy-attributes)
- Config file (use-legacy-attributes)
- Operator spectoconfig
- Runner config builder
- VirtualMCPServer CRD (useLegacyAttributes, default: true)

The flag is not yet consumed by the telemetry middleware; a follow-up
PR will add the conditional attribute emission logic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added the size/XS Extra small PR: < 100 lines changed label Feb 9, 2026
Add a new UseLegacyAttributes boolean field to the telemetry Config
struct, defaulting to true for backward compatibility. This flag will
control whether legacy (pre-MCP OTEL semconv) attribute names are
emitted alongside the new standard names. The default will change to
false in a future release.

Plumbs the flag through:
- CLI (--otel-use-legacy-attributes)
- Config file (use-legacy-attributes)
- Operator CRD types (OpenTelemetryConfig.useLegacyAttributes)
- Operator spectoconfig (reads from CR spec)
- Runner config builder
- VirtualMCPServer/MCPServer/MCPRemoteProxy CRDs (default: true)

The flag is not yet consumed by the telemetry middleware; a follow-up
PR will add the conditional attribute emission logic.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added size/S Small PR: 100-299 lines changed and removed size/XS Extra small PR: < 100 lines changed labels Feb 9, 2026
Signed-off-by: Chris Burns <29541485+ChrisJBurns@users.noreply.github.com>
@github-actions github-actions Bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Feb 9, 2026
@codecov

codecov Bot commented Feb 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.35%. Comparing base (468c29f) to head (e76e459).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3729   +/-   ##
=======================================
  Coverage   66.35%   66.35%           
=======================================
  Files         427      427           
  Lines       41794    41800    +6     
=======================================
+ Hits        27731    27737    +6     
  Misses      11953    11953           
  Partials     2110     2110           

☔ 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.

Go's omitempty on a bool treats false as the zero value and silently
drops it during JSON/YAML serialization. This meant that explicitly
setting useLegacyAttributes: false in config or CRD would be lost on
round-trip, reverting to the default true.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Feb 9, 2026
Comment thread cmd/thv/app/run_flags.go
@ChrisJBurns
ChrisJBurns merged commit cf2c338 into main Feb 10, 2026
21 checks passed
@ChrisJBurns
ChrisJBurns deleted the otel/add-use-legacy-attributes-flag branch February 10, 2026 14:17
@github-actions github-actions Bot added size/S Small PR: 100-299 lines changed and removed size/S Small PR: 100-299 lines changed labels Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR: 100-299 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants