-
Notifications
You must be signed in to change notification settings - Fork 44
feat: Add mcp-session-id header to HTTP request trace attributes #421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
✅ Docs preview readyThe preview is ready to be viewed. View the preview File Changes 0 new, 5 changed, 0 removed
Build ID: e958578b4f8d6bcab5e0eba2 URL: https://www.apollographql.com/docs/deploy-preview/e958578b4f8d6bcab5e0eba2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @swcollard, for taking care of this nice-to-have that we discussed!
raw_operation = "Graphql operation text and metadata used for Tool generation" | ||
client_name = "The client name that initializes with the MCP Server" | ||
client_version = "The client version that initializes with the MCP Server" | ||
session_id = "The value of the Mcp-Session-Id header in the HTTP request" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the mcp-session-id header is present on both request and response, can we add trace attributes for both, so we can correlate end-to-end?
73e404c
to
65b6ba9
Compare
if let Some(session_id) = response | ||
.headers() | ||
.get("mcp-session-id") | ||
.and_then(|v| v.to_str().ok()) | ||
{ | ||
span.record("session_id", tracing::field::display(session_id)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You made it! 😄
This PR includes the value of the Mcp-Session-Id HTTP header as an attribute of the trace for HTTP requests to the MCP Server