Skip to content

Conversation

swcollard
Copy link
Contributor

@swcollard swcollard commented Oct 6, 2025

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

Screenshot 2025-10-06 at 11 29 44 AM

@swcollard swcollard requested a review from a team as a code owner October 6, 2025 20:41
@apollo-librarian
Copy link

apollo-librarian bot commented Oct 6, 2025

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

0 new, 5 changed, 0 removed
* (developer-tools)/apollo-mcp-server/(latest)/best-practices.mdx
* (developer-tools)/apollo-mcp-server/(latest)/deploy.mdx
* (developer-tools)/apollo-mcp-server/(latest)/index.mdx
* (developer-tools)/apollo-mcp-server/(latest)/limitations.mdx
* (developer-tools)/apollo-mcp-server/(latest)/_sidebar.yaml

Build ID: e958578b4f8d6bcab5e0eba2
Build Logs: View logs

URL: https://www.apollographql.com/docs/deploy-preview/e958578b4f8d6bcab5e0eba2

Copy link
Contributor

@DaleSeo DaleSeo left a 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"
Copy link
Contributor

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?

@swcollard swcollard requested a review from DaleSeo October 8, 2025 13:58
Comment on lines +237 to +243
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));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You made it! 😄

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.

2 participants