Skip to content

Restore VirtualMCPServer inline telemetry fallback for Prometheus metrics - #6469

Open
lorenzozanee wants to merge 1 commit into
stacklok:mainfrom
lorenzozanee:fix/virtualmcp-inline-telemetry-metrics-6276
Open

Restore VirtualMCPServer inline telemetry fallback for Prometheus metrics#6469
lorenzozanee wants to merge 1 commit into
stacklok:mainfrom
lorenzozanee:fix/virtualmcp-inline-telemetry-metrics-6276

Conversation

@lorenzozanee

Copy link
Copy Markdown
Contributor

Summary

VirtualMCPServer inline spec.config.telemetry was accepted by the API but ignored by the operator after #4819, so the rendered vmcp ConfigMap had no telemetry block. The vmcp process never registered GET /metrics, and Prometheus scrapes hit the MCP catch-all handler returning 406 Not Acceptable: Client must accept text/event-stream.

  • Restore deprecated inline fallback in normalizeTelemetry when TelemetryConfigRef is unset (ref still wins when both are set)
  • Log V(1) deprecation warning config.telemetry is deprecated; migrate to spec.telemetryConfigRef
  • Update tests: TestConverter_InlineTelemetry asserts inline is applied, TestConverter_TelemetryConfigRefWins asserts ref precedence

Fixes #6276

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

  • Unit tests (task test)
  • E2E tests (task test-e2e)
  • Linting (task lint-fix)
  • Manual testing (describe below)

go test ./cmd/thv-operator/pkg/vmcpconfig/... - all pass including new TestConverter_InlineTelemetry and TestConverter_TelemetryConfigRefWins.

API Compatibility

  • This PR does not break the v1beta1 API, OR the api-break-allowed label is applied and the migration guidance is described above.

No CRD change; restores previously documented inline path as deprecated fallback until removed.

Does this introduce a user-facing change?

Yes - Prometheus ServiceMonitors scraping VirtualMCPServer /metrics with enablePrometheusMetricsPath: true now succeed (HTTP 200) instead of MCP 406, without requiring migration to MCPTelemetryConfig. Users on the new path are unaffected.

@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.02%. Comparing base (0fb54d4) to head (020f722).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6469      +/-   ##
==========================================
- Coverage   78.02%   78.02%   -0.01%     
==========================================
  Files         767      767              
  Lines       74273    74279       +6     
==========================================
- Hits        57955    57953       -2     
- Misses      16313    16321       +8     
  Partials        5        5              

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

VirtualMCPServer with only spec.config.telemetry was silently
ignored after stacklok#4819, leaving the vmcp ConfigMap without a telemetry
block. Without /metrics registered the transport falls through to
the MCP handler and returns 406. Restore the deprecated inline
fallback when TelemetryConfigRef is unset (ref wins), log a
migration warning, and keep Prometheus metrics reachable.

Signed-off-by: lorenzozanee <wyz0707@proton.me>
@lorenzozanee
lorenzozanee force-pushed the fix/virtualmcp-inline-telemetry-metrics-6276 branch from 73a00ca to 020f722 Compare August 31, 2026 00:34
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.

bug(operator): VirtualMCPServer inline config.telemetry silently ignored; GET /metrics returns MCP 406

1 participant