Skip to content

Add client name to telemetry metrics.#137

Merged
cmrigney merged 1 commit intomainfrom
add-client-name-to-telemetry
Sep 16, 2025
Merged

Add client name to telemetry metrics.#137
cmrigney merged 1 commit intomainfrom
add-client-name-to-telemetry

Conversation

@cmrigney
Copy link
Copy Markdown
Contributor

What I did

Added the client name (e.g. claude-ai) to telemetry metrics under the attribute mcp.client.name.

Metrics Affected

  • mcp.tool.calls
  • mcp.tool.duration
  • mcp.list.tools
  • mcp.prompt.gets
  • mcp.prompt.duration
  • mcp.list.prompts
  • mcp.list.resources
  • mcp.resource.reads
  • mcp.resource.duration
  • mcp.list.resource_templates
  • mcp.resource_template.reads
  • mcp.resource_template.duration

@cmrigney cmrigney requested a review from jganoff September 12, 2025 19:55
@cmrigney cmrigney requested a review from a team as a code owner September 12, 2025 19:55
attribute.String("mcp.server.name", serverConfig.Name),
attribute.String("mcp.server.type", serverType),
attribute.String("mcp.tool.name", req.Params.Name),
attribute.String("mcp.client.name", req.Session.InitializeParams().ClientInfo.Name),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think Name is safest here. We do have Title and Version as well and are meant to be the human-readable ones for displays in UIs. Should we start logging these parameters when clients connect to the gateway so we're more accustomed to how these different clients identify themselves? I think it'd be worth logging one client connected message and showing the name, title and version of the client.

I still think the Name is the right thing to add to the event.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes I think that makes sense. Created an issue: #141

@cmrigney cmrigney merged commit f9c1980 into main Sep 16, 2025
8 checks passed
@cmrigney cmrigney deleted the add-client-name-to-telemetry branch September 16, 2025 14:19
null-runner pushed a commit to null-runner/mcp-gateway that referenced this pull request Dec 6, 2025
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.

3 participants