Skip to content

Add telemetry instrumentation for optimizer#3978

Merged
aponcedeleonch merged 1 commit intomainfrom
add-optimizer-metrics
Mar 3, 2026
Merged

Add telemetry instrumentation for optimizer#3978
aponcedeleonch merged 1 commit intomainfrom
add-optimizer-metrics

Conversation

@aponcedeleonch
Copy link
Member

Summary

  • Wrap the optimizer factory with a telemetry decorator (telemetryOptimizer) that records OTel metrics and traces for FindTool and CallTool operations
  • Metrics include request/error counters, duration histograms, result-set size, and token-savings percentages
  • The decorator is applied in Server.Start when a TelemetryProvider is configured
  • Add comprehensive table-driven unit tests covering success, error, and not-found scenarios

Test plan

  • Unit tests pass (go test ./pkg/vmcp/server/... -count=1)
  • go vet clean
  • gofmt clean
  • Deploy with OTel stack and verify metrics appear in Prometheus/Grafana

🤖 Generated with Claude Code

@github-actions github-actions bot added the size/M Medium PR: 300-599 lines changed label Mar 3, 2026
@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

❌ Patch coverage is 78.62595% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.45%. Comparing base (d0102a2) to head (1e1ec2d).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pkg/vmcp/server/telemetry.go 83.73% 10 Missing and 10 partials ⚠️
pkg/vmcp/server/server.go 0.00% 7 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3978      +/-   ##
==========================================
- Coverage   68.47%   68.45%   -0.02%     
==========================================
  Files         437      437              
  Lines       44419    44550     +131     
==========================================
+ Hits        30417    30498      +81     
- Misses      11636    11673      +37     
- Partials     2366     2379      +13     

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

Wrap the optimizer factory with metrics and tracing so that every
FindTool and CallTool invocation records request counts, error counts,
duration histograms, result-set sizes, and token-savings percentages.
The decorator is applied when a TelemetryProvider is configured.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@aponcedeleonch aponcedeleonch force-pushed the add-optimizer-metrics branch from 1be5d75 to 1e1ec2d Compare March 3, 2026 15:01
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Mar 3, 2026
@aponcedeleonch
Copy link
Member Author

@jerm-dro will merge this. If you have any comment feel free to leave it and I will address it in a future PR

@aponcedeleonch aponcedeleonch merged commit b3f98b5 into main Mar 3, 2026
56 of 58 checks passed
@aponcedeleonch aponcedeleonch deleted the add-optimizer-metrics branch March 3, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Medium PR: 300-599 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants