Skip to content

feat!: telemetry metrics updates as per semantic convention#2566

Merged
Yuan325 merged 5 commits intogoogleapis:mainfrom
AjmeraParth132:feat-metrics-update
Mar 11, 2026
Merged

feat!: telemetry metrics updates as per semantic convention#2566
Yuan325 merged 5 commits intogoogleapis:mainfrom
AjmeraParth132:feat-metrics-update

Conversation

@AjmeraParth132
Copy link
Copy Markdown
Contributor

Description

This PR updates MCP telemetry to align with OTel semantic conventions by removing all existing transport-specific and HTTP-API metrics and introducing a unified, future-proof set. It adds

  1. mcp.server.operation.duration to capture per-method request rate, latency, and errors across all MCP transports;
  2. mcp.server.session.duration to track session lifecycles for stdio and SSE;
  3. toolbox.server.mcp.active_sessions for real-time capacity, saturation, and leak detection.
  4. toolbox.tool.operation.duration to isolate backend tool execution time from MCP/protocol overhead, enabling clearer attribution of performance bottlenecks between the MCP layer and tool runtime.

Together, these changes simplify the metrics surface while significantly improving observability and debuggability with minimal runtime overhead.

PR Checklist

  • Make sure you reviewed
    CONTRIBUTING.md
  • Make sure to open an issue as a
    bug/issue
    before writing your code! That way we can discuss the change, evaluate
    designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)
  • Make sure to add ! if this involve a breaking change

🛠️ Fixes #2222

@AjmeraParth132 AjmeraParth132 requested a review from a team as a code owner February 26, 2026 01:16
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @AjmeraParth132, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the telemetry system to align with OpenTelemetry semantic conventions, enhancing observability and debuggability. By replacing a fragmented set of metrics with a unified, future-proof collection, it provides clearer insights into the performance and behavior of MCP operations, sessions, and backend tool executions. This change simplifies metric collection while offering more granular data for identifying bottlenecks and understanding system health.

Highlights

  • New Metrics Introduced: Introduced four new OpenTelemetry semantic convention-aligned metrics: mcp.server.operation.duration for per-method request tracking, mcp.server.session.duration for session lifecycles, toolbox.server.mcp.active_sessions for real-time capacity, and toolbox.tool.operation.duration to isolate tool execution time.
  • Old Metrics Removed: Removed all existing transport-specific and HTTP-API metrics (toolbox.server.toolset.get.count, toolbox.server.tool.get.count, toolbox.server.tool.invoke.count, toolbox.server.mcp.sse.count, toolbox.server.mcp.post.count) to simplify the metrics surface.
  • Metric Attribute Propagation: Implemented a mechanism to propagate gen_ai and network-related attributes through the context for richer metric data, allowing for more detailed analysis of operations and sessions.
  • Session and Operation Duration Tracking: Added logic to track the duration of MCP sessions (stdio and SSE) and individual MCP JSON-RPC operations, including error types, providing comprehensive performance insights.
Changelog
  • internal/server/api.go
    • Removed metric import.
    • Removed old ToolsetGet, ToolGet, and ToolInvoke metric recording from API handlers.
  • internal/server/mcp.go
    • Added sessionStart timestamp and sessionErr variable to track session duration and errors.
    • Introduced mcp.server.session.duration metric recording for stdio and SSE sessions, including error types.
    • Implemented toolbox.server.mcp.active_sessions metric to track active stdio and SSE sessions.
    • Added operationStart timestamp and metricErrorType variable for processMcpMessage.
    • Introduced mcp.server.operation.duration metric recording for MCP JSON-RPC operations, including gen_ai and network attributes.
    • Integrated GenAIMetricAttrs into the context for attribute propagation to method handlers.
    • Updated error handling to set metricErrorType for mcp.server.operation.duration.
  • internal/server/mcp/v20241105/method.go
    • Imported time and metric packages.
    • Populated GenAIMetricAttrs in the context for toolsCallHandler and promptsGetHandler.
    • Added toolbox.tool.execution.duration metric recording for tool invocations, including gen_ai and network attributes.
  • internal/server/mcp/v20250326/method.go
    • Imported time and metric packages.
    • Populated GenAIMetricAttrs in the context for toolsCallHandler and promptsGetHandler.
    • Added toolbox.tool.execution.duration metric recording for tool invocations, including gen_ai and network attributes.
  • internal/server/mcp/v20250618/method.go
    • Imported time and metric packages.
    • Populated GenAIMetricAttrs in the context for toolsCallHandler and promptsGetHandler.
    • Added toolbox.tool.execution.duration metric recording for tool invocations, including gen_ai and network attributes.
  • internal/server/mcp/v20251125/method.go
    • Imported time and metric packages.
    • Populated GenAIMetricAttrs in the context for toolsCallHandler and promptsGetHandler.
    • Added toolbox.tool.execution.duration metric recording for tool invocations, including gen_ai and network attributes.
  • internal/telemetry/instrumentation.go
    • Removed old metric constants (toolsetGetCountName, toolGetCountName, toolInvokeCountName, mcpSseCountName, mcpPostCountName).
    • Defined new OTel semantic convention metric constants (mcpOperationDurationName, mcpSessionDurationName, mcpActiveSessionsName, toolExecutionDurationName).
    • Updated Instrumentation struct to use new metric types (Float64Histogram, Int64UpDownCounter).
    • Replaced creation of old Int64Counter metrics with new Float64Histogram and Int64UpDownCounter metrics.
  • internal/util/util.go
    • Added GenAIMetricAttrs struct to hold generic AI and network metric attributes.
    • Implemented WithGenAIMetricAttrs to add GenAIMetricAttrs to the context.
    • Implemented GenAIMetricAttrsFromContext to retrieve GenAIMetricAttrs from the context.
Activity
  • No human activity (comments, reviews) was detected on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the telemetry system to align with OpenTelemetry semantic conventions, removing outdated metrics and introducing a new, more descriptive set for MCP operations and sessions. However, a critical security concern has been identified: several new telemetry metrics, specifically labels like mcp.method.name, toolset.name, gen_ai.tool.name, and gen_ai.prompt.name, are populated directly from untrusted user input without prior validation. This poses a significant risk of metrics cardinality explosion, potentially leading to a Denial of Service by exhausting memory. Additionally, there are suggestions to improve code clarity and robustness regarding how metric attributes are handled to prevent potential slice aliasing issues.

Copy link
Copy Markdown
Contributor

@Yuan325 Yuan325 left a comment

Choose a reason for hiding this comment

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

Thank you for being prompt in this PR submission :)

@AjmeraParth132 AjmeraParth132 requested review from a team as code owners March 2, 2026 22:03
@AjmeraParth132
Copy link
Copy Markdown
Contributor Author

hello @Yuan325, updated the PR and added some comments.

Copy link
Copy Markdown
Contributor

@Yuan325 Yuan325 left a comment

Choose a reason for hiding this comment

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

Some very minimal changes, thank you so much again!

@Yuan325
Copy link
Copy Markdown
Contributor

Yuan325 commented Mar 10, 2026

/gcbrun

@Yuan325 Yuan325 added the tests: run Label to trigger Github Action tests. label Mar 10, 2026
@Yuan325 Yuan325 assigned Yuan325 and unassigned duwenxin99 Mar 10, 2026
@AjmeraParth132
Copy link
Copy Markdown
Contributor Author

@Yuan325 changed both the attribute copying as well - wasn't a problem for us, but agreed this is a clearer way to do so

@Yuan325
Copy link
Copy Markdown
Contributor

Yuan325 commented Mar 10, 2026

/gcbrun

@Yuan325 Yuan325 added tests: run Label to trigger Github Action tests. and removed tests: run Label to trigger Github Action tests. labels Mar 10, 2026
@Yuan325
Copy link
Copy Markdown
Contributor

Yuan325 commented Mar 10, 2026

/gcbrun

@Yuan325 Yuan325 enabled auto-merge (squash) March 10, 2026 22:29
@Yuan325
Copy link
Copy Markdown
Contributor

Yuan325 commented Mar 11, 2026

/gcbrun

@Yuan325 Yuan325 merged commit 131d764 into googleapis:main Mar 11, 2026
15 checks passed
github-actions bot pushed a commit to pepe57/genai-toolbox that referenced this pull request Mar 11, 2026
…oogleapis#2566)

## Description

This PR updates MCP telemetry to align with [OTel semantic
conventions](https://opentelemetry.io/docs/specs/semconv/gen-ai/mcp/#metrics)
by removing all existing transport-specific and HTTP-API metrics and
introducing a unified, future-proof set. It adds
1. `mcp.server.operation.duration` to capture per-method request rate,
latency, and errors across all MCP transports;
2. `mcp.server.session.duration` to track session lifecycles for stdio
and SSE;
3. `toolbox.server.mcp.active_sessions` for real-time capacity,
saturation, and leak detection.
4. `toolbox.tool.operation.duration` to isolate backend tool execution
time from MCP/protocol overhead, enabling clearer attribution of
performance bottlenecks between the MCP layer and tool runtime.

Together, these changes simplify the metrics surface while significantly
improving observability and debuggability with minimal runtime overhead.

## PR Checklist

- [x] Make sure you reviewed

[CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md)
- [x] Make sure to open an issue as a

[bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose)
  before writing your code! That way we can discuss the change, evaluate
  designs, and agree on the general idea
- [x] Ensure the tests and linter pass
- [x] Code coverage does not decrease (if any source code was changed)
- [ ] Appropriate docs were updated (if necessary)
- [x] Make sure to add `!` if this involve a breaking change

🛠️ Fixes googleapis#2222

---------

Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> 131d764
dumians pushed a commit to dumians/genai-toolbox that referenced this pull request Mar 12, 2026
…is#2566)

## Description

This PR updates MCP telemetry to align with [OTel semantic
conventions](https://opentelemetry.io/docs/specs/semconv/gen-ai/mcp/#metrics)
by removing all existing transport-specific and HTTP-API metrics and
introducing a unified, future-proof set. It adds
1. `mcp.server.operation.duration` to capture per-method request rate,
latency, and errors across all MCP transports;
2. `mcp.server.session.duration` to track session lifecycles for stdio
and SSE;
3. `toolbox.server.mcp.active_sessions` for real-time capacity,
saturation, and leak detection.
4. `toolbox.tool.operation.duration` to isolate backend tool execution
time from MCP/protocol overhead, enabling clearer attribution of
performance bottlenecks between the MCP layer and tool runtime.

Together, these changes simplify the metrics surface while significantly
improving observability and debuggability with minimal runtime overhead.

## PR Checklist

- [x] Make sure you reviewed

[CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md)
- [x] Make sure to open an issue as a

[bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose)
  before writing your code! That way we can discuss the change, evaluate
  designs, and agree on the general idea
- [x] Ensure the tests and linter pass
- [x] Code coverage does not decrease (if any source code was changed)
- [ ] Appropriate docs were updated (if necessary)
- [x] Make sure to add `!` if this involve a breaking change

🛠️ Fixes googleapis#2222

---------

Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com>
Yuan325 added a commit that referenced this pull request Mar 13, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.29.0](v0.28.0...v0.29.0)
(2026-03-13)


### ⚠ BREAKING CHANGES

* **source/alloydb:** restructure prebuilt toolsets
([#2639](#2639))
* **source/spanner:** restructure prebuilt toolsets
([#2641](#2641))
* **source/dataplex:** restructure prebuilt toolsets
([#2640](#2640))
* **source/oss-db:** restructure prebuilt toolsets
([#2638](#2638))
* **source/cloudsql:** restructure prebuilt toolsets
([#2635](#2635))
* **source/bigquery:** restructure prebuilt toolsets
([#2637](#2637))
* **source/firestore:** restructure prebuilt toolsets
([#2636](#2636))
* telemetry metrics updates as per semantic convention
([#2566](#2566))

### Features

* Add user agent to embeddings generation
([#2572](#2572))
([287251a](287251a))
* **skill:** Attach user agent metadata for generated skill
([#2697](#2697))
([9598a6a](9598a6a))
* **skills:** Add additional-notes flag to generate skills command
([#2696](#2696))
([73bf962](73bf962))
* **skill:** Update skill generation logic
([#2646](#2646))
([c233eee](c233eee))
* **source/alloydb:** Restructure prebuilt toolsets
([#2639](#2639))
([5f3f063](5f3f063))
* **source/bigquery:** Restructure prebuilt toolsets
([#2637](#2637))
([dc984ba](dc984ba))
* **sources/bigquery:** Support custom oauth header name
([#2564](#2564))
([d3baf77](d3baf77))
* **source/cloudsql:** Restructure prebuilt toolsets
([#2635](#2635))
([99613dc](99613dc))
* **source/dataplex:** Restructure prebuilt toolsets
([#2640](#2640))
([acb9a80](acb9a80))
* **source/firestore:** Restructure prebuilt toolsets
([#2636](#2636))
([22ab7b9](22ab7b9))
* **source/oss-db:** Restructure prebuilt toolsets
([#2638](#2638))
([5196c6a](5196c6a))
* **source/spanner:** Restructure prebuilt toolsets
([#2641](#2641))
([ea2b698](ea2b698))
* Telemetry metrics updates as per semantic convention
([#2566](#2566))
([131d764](131d764))
* **tools/mongodb:** Add tool annotations to MongoDB tools for improved
LLM understanding
([#2219](#2219))
([b7a5f80](b7a5f80))
* **tools/serverless-spark:** Add get_session_template tool
([#2308](#2308))
([a136e16](a136e16))
* **tools/serverless-spark:** Add list/get sessions tools
([#2576](#2576))
([a554298](a554298))


### Bug Fixes

* Improve list locks integration test for postgres
([#2279](#2279))
([d9ebe5d](d9ebe5d))
* **mcp:** Guard nil SSE session lookup and return 400 for missing
session
([#2681](#2681))
([f66189f](f66189f))
* **oracle:** Update oracle-execute-sql tool interface to match source
signature
([#2627](#2627))
([81699a3](81699a3))
* Return AllParams for GetParameter() for tools with
templateParameter([#2734](#2734))
([bfd7ba6](bfd7ba6))
* **server/mcp:** Scope defer span.End inside loop iteration
([#2558](#2558))
([c88a62d](c88a62d)),
closes [#2549](#2549)
* **skill:** Fix env variable propagation
([#2645](#2645))
([5271368](5271368))
* **sources/looker:** Looker and looker-dev prebuilt tools should share
one source definition.
([#2620](#2620))
([df7f2fd](df7f2fd))
* **telemetry:** Histogram buckets from OTel standard to MCP standards
([#2729](#2729))
([87cd4a0](87cd4a0))
* **ui:** Remove module from script
([#2703](#2703))
([6943ab6](6943ab6))
* Update toolset attributes naming
([#2554](#2554))
([3d6ae4e](3d6ae4e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com>
github-actions bot pushed a commit that referenced this pull request Mar 13, 2026
🤖 I have created a release *beep* *boop*
---

##
[0.29.0](v0.28.0...v0.29.0)
(2026-03-13)

### ⚠ BREAKING CHANGES

* **source/alloydb:** restructure prebuilt toolsets
([#2639](#2639))
* **source/spanner:** restructure prebuilt toolsets
([#2641](#2641))
* **source/dataplex:** restructure prebuilt toolsets
([#2640](#2640))
* **source/oss-db:** restructure prebuilt toolsets
([#2638](#2638))
* **source/cloudsql:** restructure prebuilt toolsets
([#2635](#2635))
* **source/bigquery:** restructure prebuilt toolsets
([#2637](#2637))
* **source/firestore:** restructure prebuilt toolsets
([#2636](#2636))
* telemetry metrics updates as per semantic convention
([#2566](#2566))

### Features

* Add user agent to embeddings generation
([#2572](#2572))
([287251a](287251a))
* **skill:** Attach user agent metadata for generated skill
([#2697](#2697))
([9598a6a](9598a6a))
* **skills:** Add additional-notes flag to generate skills command
([#2696](#2696))
([73bf962](73bf962))
* **skill:** Update skill generation logic
([#2646](#2646))
([c233eee](c233eee))
* **source/alloydb:** Restructure prebuilt toolsets
([#2639](#2639))
([5f3f063](5f3f063))
* **source/bigquery:** Restructure prebuilt toolsets
([#2637](#2637))
([dc984ba](dc984ba))
* **sources/bigquery:** Support custom oauth header name
([#2564](#2564))
([d3baf77](d3baf77))
* **source/cloudsql:** Restructure prebuilt toolsets
([#2635](#2635))
([99613dc](99613dc))
* **source/dataplex:** Restructure prebuilt toolsets
([#2640](#2640))
([acb9a80](acb9a80))
* **source/firestore:** Restructure prebuilt toolsets
([#2636](#2636))
([22ab7b9](22ab7b9))
* **source/oss-db:** Restructure prebuilt toolsets
([#2638](#2638))
([5196c6a](5196c6a))
* **source/spanner:** Restructure prebuilt toolsets
([#2641](#2641))
([ea2b698](ea2b698))
* Telemetry metrics updates as per semantic convention
([#2566](#2566))
([131d764](131d764))
* **tools/mongodb:** Add tool annotations to MongoDB tools for improved
LLM understanding
([#2219](#2219))
([b7a5f80](b7a5f80))
* **tools/serverless-spark:** Add get_session_template tool
([#2308](#2308))
([a136e16](a136e16))
* **tools/serverless-spark:** Add list/get sessions tools
([#2576](#2576))
([a554298](a554298))

### Bug Fixes

* Improve list locks integration test for postgres
([#2279](#2279))
([d9ebe5d](d9ebe5d))
* **mcp:** Guard nil SSE session lookup and return 400 for missing
session
([#2681](#2681))
([f66189f](f66189f))
* **oracle:** Update oracle-execute-sql tool interface to match source
signature
([#2627](#2627))
([81699a3](81699a3))
* Return AllParams for GetParameter() for tools with
templateParameter([#2734](#2734))
([bfd7ba6](bfd7ba6))
* **server/mcp:** Scope defer span.End inside loop iteration
([#2558](#2558))
([c88a62d](c88a62d)),
closes [#2549](#2549)
* **skill:** Fix env variable propagation
([#2645](#2645))
([5271368](5271368))
* **sources/looker:** Looker and looker-dev prebuilt tools should share
one source definition.
([#2620](#2620))
([df7f2fd](df7f2fd))
* **telemetry:** Histogram buckets from OTel standard to MCP standards
([#2729](#2729))
([87cd4a0](87cd4a0))
* **ui:** Remove module from script
([#2703](#2703))
([6943ab6](6943ab6))
* Update toolset attributes naming
([#2554](#2554))
([3d6ae4e](3d6ae4e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> 39832a0
github-actions bot pushed a commit to renovate-bot/googleapis-_-genai-toolbox that referenced this pull request Mar 13, 2026
🤖 I have created a release *beep* *boop*
---

##
[0.29.0](googleapis/mcp-toolbox@v0.28.0...v0.29.0)
(2026-03-13)

### ⚠ BREAKING CHANGES

* **source/alloydb:** restructure prebuilt toolsets
([googleapis#2639](googleapis#2639))
* **source/spanner:** restructure prebuilt toolsets
([googleapis#2641](googleapis#2641))
* **source/dataplex:** restructure prebuilt toolsets
([googleapis#2640](googleapis#2640))
* **source/oss-db:** restructure prebuilt toolsets
([googleapis#2638](googleapis#2638))
* **source/cloudsql:** restructure prebuilt toolsets
([googleapis#2635](googleapis#2635))
* **source/bigquery:** restructure prebuilt toolsets
([googleapis#2637](googleapis#2637))
* **source/firestore:** restructure prebuilt toolsets
([googleapis#2636](googleapis#2636))
* telemetry metrics updates as per semantic convention
([googleapis#2566](googleapis#2566))

### Features

* Add user agent to embeddings generation
([googleapis#2572](googleapis#2572))
([287251a](googleapis@287251a))
* **skill:** Attach user agent metadata for generated skill
([googleapis#2697](googleapis#2697))
([9598a6a](googleapis@9598a6a))
* **skills:** Add additional-notes flag to generate skills command
([googleapis#2696](googleapis#2696))
([73bf962](googleapis@73bf962))
* **skill:** Update skill generation logic
([googleapis#2646](googleapis#2646))
([c233eee](googleapis@c233eee))
* **source/alloydb:** Restructure prebuilt toolsets
([googleapis#2639](googleapis#2639))
([5f3f063](googleapis@5f3f063))
* **source/bigquery:** Restructure prebuilt toolsets
([googleapis#2637](googleapis#2637))
([dc984ba](googleapis@dc984ba))
* **sources/bigquery:** Support custom oauth header name
([googleapis#2564](googleapis#2564))
([d3baf77](googleapis@d3baf77))
* **source/cloudsql:** Restructure prebuilt toolsets
([googleapis#2635](googleapis#2635))
([99613dc](googleapis@99613dc))
* **source/dataplex:** Restructure prebuilt toolsets
([googleapis#2640](googleapis#2640))
([acb9a80](googleapis@acb9a80))
* **source/firestore:** Restructure prebuilt toolsets
([googleapis#2636](googleapis#2636))
([22ab7b9](googleapis@22ab7b9))
* **source/oss-db:** Restructure prebuilt toolsets
([googleapis#2638](googleapis#2638))
([5196c6a](googleapis@5196c6a))
* **source/spanner:** Restructure prebuilt toolsets
([googleapis#2641](googleapis#2641))
([ea2b698](googleapis@ea2b698))
* Telemetry metrics updates as per semantic convention
([googleapis#2566](googleapis#2566))
([131d764](googleapis@131d764))
* **tools/mongodb:** Add tool annotations to MongoDB tools for improved
LLM understanding
([googleapis#2219](googleapis#2219))
([b7a5f80](googleapis@b7a5f80))
* **tools/serverless-spark:** Add get_session_template tool
([googleapis#2308](googleapis#2308))
([a136e16](googleapis@a136e16))
* **tools/serverless-spark:** Add list/get sessions tools
([googleapis#2576](googleapis#2576))
([a554298](googleapis@a554298))

### Bug Fixes

* Improve list locks integration test for postgres
([googleapis#2279](googleapis#2279))
([d9ebe5d](googleapis@d9ebe5d))
* **mcp:** Guard nil SSE session lookup and return 400 for missing
session
([googleapis#2681](googleapis#2681))
([f66189f](googleapis@f66189f))
* **oracle:** Update oracle-execute-sql tool interface to match source
signature
([googleapis#2627](googleapis#2627))
([81699a3](googleapis@81699a3))
* Return AllParams for GetParameter() for tools with
templateParameter([googleapis#2734](googleapis#2734))
([bfd7ba6](googleapis@bfd7ba6))
* **server/mcp:** Scope defer span.End inside loop iteration
([googleapis#2558](googleapis#2558))
([c88a62d](googleapis@c88a62d)),
closes [googleapis#2549](googleapis#2549)
* **skill:** Fix env variable propagation
([googleapis#2645](googleapis#2645))
([5271368](googleapis@5271368))
* **sources/looker:** Looker and looker-dev prebuilt tools should share
one source definition.
([googleapis#2620](googleapis#2620))
([df7f2fd](googleapis@df7f2fd))
* **telemetry:** Histogram buckets from OTel standard to MCP standards
([googleapis#2729](googleapis#2729))
([87cd4a0](googleapis@87cd4a0))
* **ui:** Remove module from script
([googleapis#2703](googleapis#2703))
([6943ab6](googleapis@6943ab6))
* Update toolset attributes naming
([googleapis#2554](googleapis#2554))
([3d6ae4e](googleapis@3d6ae4e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> 39832a0
github-actions bot pushed a commit to Jaleel-zhu/genai-toolbox that referenced this pull request Mar 13, 2026
🤖 I have created a release *beep* *boop*
---

##
[0.29.0](googleapis/mcp-toolbox@v0.28.0...v0.29.0)
(2026-03-13)

### ⚠ BREAKING CHANGES

* **source/alloydb:** restructure prebuilt toolsets
([googleapis#2639](googleapis#2639))
* **source/spanner:** restructure prebuilt toolsets
([googleapis#2641](googleapis#2641))
* **source/dataplex:** restructure prebuilt toolsets
([googleapis#2640](googleapis#2640))
* **source/oss-db:** restructure prebuilt toolsets
([googleapis#2638](googleapis#2638))
* **source/cloudsql:** restructure prebuilt toolsets
([googleapis#2635](googleapis#2635))
* **source/bigquery:** restructure prebuilt toolsets
([googleapis#2637](googleapis#2637))
* **source/firestore:** restructure prebuilt toolsets
([googleapis#2636](googleapis#2636))
* telemetry metrics updates as per semantic convention
([googleapis#2566](googleapis#2566))

### Features

* Add user agent to embeddings generation
([googleapis#2572](googleapis#2572))
([287251a](googleapis@287251a))
* **skill:** Attach user agent metadata for generated skill
([googleapis#2697](googleapis#2697))
([9598a6a](googleapis@9598a6a))
* **skills:** Add additional-notes flag to generate skills command
([googleapis#2696](googleapis#2696))
([73bf962](googleapis@73bf962))
* **skill:** Update skill generation logic
([googleapis#2646](googleapis#2646))
([c233eee](googleapis@c233eee))
* **source/alloydb:** Restructure prebuilt toolsets
([googleapis#2639](googleapis#2639))
([5f3f063](googleapis@5f3f063))
* **source/bigquery:** Restructure prebuilt toolsets
([googleapis#2637](googleapis#2637))
([dc984ba](googleapis@dc984ba))
* **sources/bigquery:** Support custom oauth header name
([googleapis#2564](googleapis#2564))
([d3baf77](googleapis@d3baf77))
* **source/cloudsql:** Restructure prebuilt toolsets
([googleapis#2635](googleapis#2635))
([99613dc](googleapis@99613dc))
* **source/dataplex:** Restructure prebuilt toolsets
([googleapis#2640](googleapis#2640))
([acb9a80](googleapis@acb9a80))
* **source/firestore:** Restructure prebuilt toolsets
([googleapis#2636](googleapis#2636))
([22ab7b9](googleapis@22ab7b9))
* **source/oss-db:** Restructure prebuilt toolsets
([googleapis#2638](googleapis#2638))
([5196c6a](googleapis@5196c6a))
* **source/spanner:** Restructure prebuilt toolsets
([googleapis#2641](googleapis#2641))
([ea2b698](googleapis@ea2b698))
* Telemetry metrics updates as per semantic convention
([googleapis#2566](googleapis#2566))
([131d764](googleapis@131d764))
* **tools/mongodb:** Add tool annotations to MongoDB tools for improved
LLM understanding
([googleapis#2219](googleapis#2219))
([b7a5f80](googleapis@b7a5f80))
* **tools/serverless-spark:** Add get_session_template tool
([googleapis#2308](googleapis#2308))
([a136e16](googleapis@a136e16))
* **tools/serverless-spark:** Add list/get sessions tools
([googleapis#2576](googleapis#2576))
([a554298](googleapis@a554298))

### Bug Fixes

* Improve list locks integration test for postgres
([googleapis#2279](googleapis#2279))
([d9ebe5d](googleapis@d9ebe5d))
* **mcp:** Guard nil SSE session lookup and return 400 for missing
session
([googleapis#2681](googleapis#2681))
([f66189f](googleapis@f66189f))
* **oracle:** Update oracle-execute-sql tool interface to match source
signature
([googleapis#2627](googleapis#2627))
([81699a3](googleapis@81699a3))
* Return AllParams for GetParameter() for tools with
templateParameter([googleapis#2734](googleapis#2734))
([bfd7ba6](googleapis@bfd7ba6))
* **server/mcp:** Scope defer span.End inside loop iteration
([googleapis#2558](googleapis#2558))
([c88a62d](googleapis@c88a62d)),
closes [googleapis#2549](googleapis#2549)
* **skill:** Fix env variable propagation
([googleapis#2645](googleapis#2645))
([5271368](googleapis@5271368))
* **sources/looker:** Looker and looker-dev prebuilt tools should share
one source definition.
([googleapis#2620](googleapis#2620))
([df7f2fd](googleapis@df7f2fd))
* **telemetry:** Histogram buckets from OTel standard to MCP standards
([googleapis#2729](googleapis#2729))
([87cd4a0](googleapis@87cd4a0))
* **ui:** Remove module from script
([googleapis#2703](googleapis#2703))
([6943ab6](googleapis@6943ab6))
* Update toolset attributes naming
([googleapis#2554](googleapis#2554))
([3d6ae4e](googleapis@3d6ae4e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> 39832a0
NightStack15 added a commit to NightStack15/googleapis-_-genai-toolbox that referenced this pull request Mar 20, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.29.0](googleapis/mcp-toolbox@v0.28.0...v0.29.0)
(2026-03-13)


### ⚠ BREAKING CHANGES

* **source/alloydb:** restructure prebuilt toolsets
([#2639](googleapis/mcp-toolbox#2639))
* **source/spanner:** restructure prebuilt toolsets
([#2641](googleapis/mcp-toolbox#2641))
* **source/dataplex:** restructure prebuilt toolsets
([#2640](googleapis/mcp-toolbox#2640))
* **source/oss-db:** restructure prebuilt toolsets
([#2638](googleapis/mcp-toolbox#2638))
* **source/cloudsql:** restructure prebuilt toolsets
([#2635](googleapis/mcp-toolbox#2635))
* **source/bigquery:** restructure prebuilt toolsets
([#2637](googleapis/mcp-toolbox#2637))
* **source/firestore:** restructure prebuilt toolsets
([#2636](googleapis/mcp-toolbox#2636))
* telemetry metrics updates as per semantic convention
([#2566](googleapis/mcp-toolbox#2566))

### Features

* Add user agent to embeddings generation
([#2572](googleapis/mcp-toolbox#2572))
([287251a](googleapis/mcp-toolbox@287251a))
* **skill:** Attach user agent metadata for generated skill
([#2697](googleapis/mcp-toolbox#2697))
([9598a6a](googleapis/mcp-toolbox@9598a6a))
* **skills:** Add additional-notes flag to generate skills command
([#2696](googleapis/mcp-toolbox#2696))
([73bf962](googleapis/mcp-toolbox@73bf962))
* **skill:** Update skill generation logic
([#2646](googleapis/mcp-toolbox#2646))
([c233eee](googleapis/mcp-toolbox@c233eee))
* **source/alloydb:** Restructure prebuilt toolsets
([#2639](googleapis/mcp-toolbox#2639))
([5f3f063](googleapis/mcp-toolbox@5f3f063))
* **source/bigquery:** Restructure prebuilt toolsets
([#2637](googleapis/mcp-toolbox#2637))
([dc984ba](googleapis/mcp-toolbox@dc984ba))
* **sources/bigquery:** Support custom oauth header name
([#2564](googleapis/mcp-toolbox#2564))
([d3baf77](googleapis/mcp-toolbox@d3baf77))
* **source/cloudsql:** Restructure prebuilt toolsets
([#2635](googleapis/mcp-toolbox#2635))
([99613dc](googleapis/mcp-toolbox@99613dc))
* **source/dataplex:** Restructure prebuilt toolsets
([#2640](googleapis/mcp-toolbox#2640))
([acb9a80](googleapis/mcp-toolbox@acb9a80))
* **source/firestore:** Restructure prebuilt toolsets
([#2636](googleapis/mcp-toolbox#2636))
([22ab7b9](googleapis/mcp-toolbox@22ab7b9))
* **source/oss-db:** Restructure prebuilt toolsets
([#2638](googleapis/mcp-toolbox#2638))
([5196c6a](googleapis/mcp-toolbox@5196c6a))
* **source/spanner:** Restructure prebuilt toolsets
([#2641](googleapis/mcp-toolbox#2641))
([ea2b698](googleapis/mcp-toolbox@ea2b698))
* Telemetry metrics updates as per semantic convention
([#2566](googleapis/mcp-toolbox#2566))
([131d764](googleapis/mcp-toolbox@131d764))
* **tools/mongodb:** Add tool annotations to MongoDB tools for improved
LLM understanding
([#2219](googleapis/mcp-toolbox#2219))
([b7a5f80](googleapis/mcp-toolbox@b7a5f80))
* **tools/serverless-spark:** Add get_session_template tool
([#2308](googleapis/mcp-toolbox#2308))
([a136e16](googleapis/mcp-toolbox@a136e16))
* **tools/serverless-spark:** Add list/get sessions tools
([#2576](googleapis/mcp-toolbox#2576))
([a554298](googleapis/mcp-toolbox@a554298))


### Bug Fixes

* Improve list locks integration test for postgres
([#2279](googleapis/mcp-toolbox#2279))
([d9ebe5d](googleapis/mcp-toolbox@d9ebe5d))
* **mcp:** Guard nil SSE session lookup and return 400 for missing
session
([#2681](googleapis/mcp-toolbox#2681))
([f66189f](googleapis/mcp-toolbox@f66189f))
* **oracle:** Update oracle-execute-sql tool interface to match source
signature
([#2627](googleapis/mcp-toolbox#2627))
([81699a3](googleapis/mcp-toolbox@81699a3))
* Return AllParams for GetParameter() for tools with
templateParameter([#2734](googleapis/mcp-toolbox#2734))
([bfd7ba6](googleapis/mcp-toolbox@bfd7ba6))
* **server/mcp:** Scope defer span.End inside loop iteration
([#2558](googleapis/mcp-toolbox#2558))
([c88a62d](googleapis/mcp-toolbox@c88a62d)),
closes [#2549](googleapis/mcp-toolbox#2549)
* **skill:** Fix env variable propagation
([#2645](googleapis/mcp-toolbox#2645))
([5271368](googleapis/mcp-toolbox@5271368))
* **sources/looker:** Looker and looker-dev prebuilt tools should share
one source definition.
([#2620](googleapis/mcp-toolbox#2620))
([df7f2fd](googleapis/mcp-toolbox@df7f2fd))
* **telemetry:** Histogram buckets from OTel standard to MCP standards
([#2729](googleapis/mcp-toolbox#2729))
([87cd4a0](googleapis/mcp-toolbox@87cd4a0))
* **ui:** Remove module from script
([#2703](googleapis/mcp-toolbox#2703))
([6943ab6](googleapis/mcp-toolbox@6943ab6))
* Update toolset attributes naming
([#2554](googleapis/mcp-toolbox#2554))
([3d6ae4e](googleapis/mcp-toolbox@3d6ae4e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com>
NirajNandre pushed a commit to NirajNandre/genai-toolbox-fork that referenced this pull request Mar 24, 2026
…is#2566)

## Description

This PR updates MCP telemetry to align with [OTel semantic
conventions](https://opentelemetry.io/docs/specs/semconv/gen-ai/mcp/#metrics)
by removing all existing transport-specific and HTTP-API metrics and
introducing a unified, future-proof set. It adds
1. `mcp.server.operation.duration` to capture per-method request rate,
latency, and errors across all MCP transports;
2. `mcp.server.session.duration` to track session lifecycles for stdio
and SSE;
3. `toolbox.server.mcp.active_sessions` for real-time capacity,
saturation, and leak detection.
4. `toolbox.tool.operation.duration` to isolate backend tool execution
time from MCP/protocol overhead, enabling clearer attribution of
performance bottlenecks between the MCP layer and tool runtime.

Together, these changes simplify the metrics surface while significantly
improving observability and debuggability with minimal runtime overhead.

## PR Checklist

- [x] Make sure you reviewed

[CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md)
- [x] Make sure to open an issue as a

[bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose)
  before writing your code! That way we can discuss the change, evaluate
  designs, and agree on the general idea
- [x] Ensure the tests and linter pass
- [x] Code coverage does not decrease (if any source code was changed)
- [ ] Appropriate docs were updated (if necessary)
- [x] Make sure to add `!` if this involve a breaking change

🛠️ Fixes googleapis#2222

---------

Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com>
NirajNandre pushed a commit to NirajNandre/genai-toolbox-fork that referenced this pull request Mar 24, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.29.0](googleapis/mcp-toolbox@v0.28.0...v0.29.0)
(2026-03-13)


### ⚠ BREAKING CHANGES

* **source/alloydb:** restructure prebuilt toolsets
([googleapis#2639](googleapis#2639))
* **source/spanner:** restructure prebuilt toolsets
([googleapis#2641](googleapis#2641))
* **source/dataplex:** restructure prebuilt toolsets
([googleapis#2640](googleapis#2640))
* **source/oss-db:** restructure prebuilt toolsets
([googleapis#2638](googleapis#2638))
* **source/cloudsql:** restructure prebuilt toolsets
([googleapis#2635](googleapis#2635))
* **source/bigquery:** restructure prebuilt toolsets
([googleapis#2637](googleapis#2637))
* **source/firestore:** restructure prebuilt toolsets
([googleapis#2636](googleapis#2636))
* telemetry metrics updates as per semantic convention
([googleapis#2566](googleapis#2566))

### Features

* Add user agent to embeddings generation
([googleapis#2572](googleapis#2572))
([287251a](googleapis@287251a))
* **skill:** Attach user agent metadata for generated skill
([googleapis#2697](googleapis#2697))
([9598a6a](googleapis@9598a6a))
* **skills:** Add additional-notes flag to generate skills command
([googleapis#2696](googleapis#2696))
([73bf962](googleapis@73bf962))
* **skill:** Update skill generation logic
([googleapis#2646](googleapis#2646))
([c233eee](googleapis@c233eee))
* **source/alloydb:** Restructure prebuilt toolsets
([googleapis#2639](googleapis#2639))
([5f3f063](googleapis@5f3f063))
* **source/bigquery:** Restructure prebuilt toolsets
([googleapis#2637](googleapis#2637))
([dc984ba](googleapis@dc984ba))
* **sources/bigquery:** Support custom oauth header name
([googleapis#2564](googleapis#2564))
([d3baf77](googleapis@d3baf77))
* **source/cloudsql:** Restructure prebuilt toolsets
([googleapis#2635](googleapis#2635))
([99613dc](googleapis@99613dc))
* **source/dataplex:** Restructure prebuilt toolsets
([googleapis#2640](googleapis#2640))
([acb9a80](googleapis@acb9a80))
* **source/firestore:** Restructure prebuilt toolsets
([googleapis#2636](googleapis#2636))
([22ab7b9](googleapis@22ab7b9))
* **source/oss-db:** Restructure prebuilt toolsets
([googleapis#2638](googleapis#2638))
([5196c6a](googleapis@5196c6a))
* **source/spanner:** Restructure prebuilt toolsets
([googleapis#2641](googleapis#2641))
([ea2b698](googleapis@ea2b698))
* Telemetry metrics updates as per semantic convention
([googleapis#2566](googleapis#2566))
([131d764](googleapis@131d764))
* **tools/mongodb:** Add tool annotations to MongoDB tools for improved
LLM understanding
([googleapis#2219](googleapis#2219))
([b7a5f80](googleapis@b7a5f80))
* **tools/serverless-spark:** Add get_session_template tool
([googleapis#2308](googleapis#2308))
([a136e16](googleapis@a136e16))
* **tools/serverless-spark:** Add list/get sessions tools
([googleapis#2576](googleapis#2576))
([a554298](googleapis@a554298))


### Bug Fixes

* Improve list locks integration test for postgres
([googleapis#2279](googleapis#2279))
([d9ebe5d](googleapis@d9ebe5d))
* **mcp:** Guard nil SSE session lookup and return 400 for missing
session
([googleapis#2681](googleapis#2681))
([f66189f](googleapis@f66189f))
* **oracle:** Update oracle-execute-sql tool interface to match source
signature
([googleapis#2627](googleapis#2627))
([81699a3](googleapis@81699a3))
* Return AllParams for GetParameter() for tools with
templateParameter([googleapis#2734](googleapis#2734))
([bfd7ba6](googleapis@bfd7ba6))
* **server/mcp:** Scope defer span.End inside loop iteration
([googleapis#2558](googleapis#2558))
([c88a62d](googleapis@c88a62d)),
closes [googleapis#2549](googleapis#2549)
* **skill:** Fix env variable propagation
([googleapis#2645](googleapis#2645))
([5271368](googleapis@5271368))
* **sources/looker:** Looker and looker-dev prebuilt tools should share
one source definition.
([googleapis#2620](googleapis#2620))
([df7f2fd](googleapis@df7f2fd))
* **telemetry:** Histogram buckets from OTel standard to MCP standards
([googleapis#2729](googleapis#2729))
([87cd4a0](googleapis@87cd4a0))
* **ui:** Remove module from script
([googleapis#2703](googleapis#2703))
([6943ab6](googleapis@6943ab6))
* Update toolset attributes naming
([googleapis#2554](googleapis#2554))
([3d6ae4e](googleapis@3d6ae4e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests: run Label to trigger Github Action tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance Telemetry for Toolbox Servers

3 participants