Skip to content

Conversation

yrobla
Copy link
Contributor

@yrobla yrobla commented Sep 19, 2025

Closes: #1898

@yrobla yrobla requested a review from Copilot September 19, 2025 10:28
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes issues with propagating server name and transport type to telemetry middleware by ensuring the computed values are used instead of the raw flag values.

  • Modifies server name computation to extract from image metadata when name flag is empty
  • Updates middleware configuration to use computed serverName and transportType parameters
  • Adds comprehensive test coverage for telemetry parameter computation logic

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
cmd/thv/app/run_flags.go Fixes telemetry middleware configuration by computing server name from image metadata and using computed values for middleware setup
cmd/thv/app/run_flags_test.go Adds test cases to validate server name extraction logic and transport type computation for telemetry middleware

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

codecov bot commented Sep 19, 2025

Codecov Report

❌ Patch coverage is 76.92308% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.94%. Comparing base (d951d8b) to head (6a6bf76).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
pkg/api/v1/workload_service.go 66.66% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1973      +/-   ##
==========================================
+ Coverage   47.93%   47.94%   +0.01%     
==========================================
  Files         233      233              
  Lines       29172    29176       +4     
==========================================
+ Hits        13983    13988       +5     
+ Misses      14162    14152      -10     
- Partials     1027     1036       +9     

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

@danbarr
Copy link
Collaborator

danbarr commented Sep 19, 2025

I built from this branch. In the prometheus metrics I'm now seeing the server as expected, but transport is still empty.

toolhive_mcp_request_duration_seconds_count{mcp_method="tools/list",method="POST",otel_scope_name="github.com/stacklok/toolhive/pkg/telemetry",otel_scope_schema_url="",otel_scope_version="",server="osv",status="success",status_code="202",transport=""} 2

In the traces, the mcp.server.name value is showing up as message instead of osv, and mcp.transport is also empty.
image

@yrobla yrobla force-pushed the issue-1898 branch 4 times, most recently from 51d6163 to 4275ea9 Compare September 29, 2025 10:14
@yrobla yrobla requested a review from Copilot September 29, 2025 10:33
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Collaborator

@danbarr danbarr left a comment

Choose a reason for hiding this comment

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

Confirmed the fix is working with my test cases.

@yrobla yrobla merged commit 8abada0 into main Sep 30, 2025
26 checks passed
@yrobla yrobla deleted the issue-1898 branch September 30, 2025 07:23
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.

Empty server and transport fields in Prometheus metrics
3 participants