docs: SQL commenter and telemetry attributes#3281
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces documentation for per-call telemetry attributes in the Python SDK and a new SQL Commenter feature that propagates application context into database query logs. Feedback focused on improving technical accuracy and consistency, specifically by using 'prepending' instead of 'appending' to describe SQL comment placement and ensuring tool names follow the required snake_case convention. Additionally, suggestions were made to refine attribute descriptions with the correct metadata prefixes and project-specific terminology.
| * **[Telemetry](telemetry/index.md)**: Learn how to configure logging levels and understand the core metrics and traces emitted by the Toolbox server. | ||
| * **[Export Telemetry](export_telemetry.md)**: Discover how to deploy and configure an OpenTelemetry (OTel) Collector. No newline at end of file | ||
| * **[Export Telemetry](export_telemetry.md)**: Discover how to deploy and configure an OpenTelemetry (OTel) Collector. | ||
| * **[SQL Commenter](sql_commenter.md)**: Propagate application context into database query logs by appending SQLCommenter-format comments to executed SQL statements. No newline at end of file |
There was a problem hiding this comment.
For consistency with the implementation and the detailed documentation, 'prepending' should be used instead of 'appending'. Additionally, tool names must be in snake_case, so 'SQL Commenter' should be 'sql_commenter'.
| * **[SQL Commenter](sql_commenter.md)**: Propagate application context into database query logs by appending SQLCommenter-format comments to executed SQL statements. | |
| * **[sql_commenter](sql_commenter.md)**: Propagate application context into database query logs by prepending sql_commenter-format comments to executed SQL statements. |
References
- Tool names must be in snake_case.
| type: docs | ||
| weight: 10 | ||
| description: > | ||
| Propagate application context into database query logs by appending SQLCommenter-format comments to executed SQL statements. |
There was a problem hiding this comment.
The implementation and the example on line 57 show that the comment is prepended to the SQL statement, but the description uses the word 'appending'. For accuracy and consistency with line 51, 'prepending' should be used. Also, the tool name should be snake_case ('sql_commenter').
| Propagate application context into database query logs by appending SQLCommenter-format comments to executed SQL statements. | |
| Propagate application context into database query logs by prepending sql_commenter-format comments to executed SQL statements. |
References
- Tool names must be in snake_case.
| convention that propagates application context into the database by appending a | ||
| structured comment to every SQL statement before it is executed. The comment is |
There was a problem hiding this comment.
Similar to the description in the frontmatter, 'prepending' is more accurate here as the comment is added to the beginning of the statement.
| convention that propagates application context into the database by appending a | |
| structured comment to every SQL statement before it is executed. The comment is | |
| convention that propagates application context into the database by prepending a | |
| structured comment to every SQL statement before it is executed. The comment is |
| | `client` | MCP client `_meta["dev.mcp-toolbox/telemetry"]["client.name"]` + `["client.version"]`. | Identifies the SDK or application that initiated the MCP request. | | ||
| | `client.model` | MCP client `_meta["dev.mcp-toolbox/telemetry"]["client.model"]`. | The LLM model that produced the tool call. | | ||
| | `client.user.id` | MCP client `_meta["dev.mcp-toolbox/telemetry"]["client.user.id"]`. | End-user identifier supplied by the client. | | ||
| | `client.agent.id` | MCP client `_meta["dev.mcp-toolbox/telemetry"]["client.agent.id"]`. | Agent identifier supplied by the client. | |
There was a problem hiding this comment.
The descriptions for the client-supplied attributes should include the params. prefix for the _meta field to be consistent with the explanation on line 75 and the MCP specification. Additionally, the description for the client attribute should clarify that the name and version are joined by a / separator, and use the project-specific term 'ADK' instead of 'SDK'.
| | `client` | MCP client `_meta["dev.mcp-toolbox/telemetry"]["client.name"]` + `["client.version"]`. | Identifies the SDK or application that initiated the MCP request. | | |
| | `client.model` | MCP client `_meta["dev.mcp-toolbox/telemetry"]["client.model"]`. | The LLM model that produced the tool call. | | |
| | `client.user.id` | MCP client `_meta["dev.mcp-toolbox/telemetry"]["client.user.id"]`. | End-user identifier supplied by the client. | | |
| | `client.agent.id` | MCP client `_meta["dev.mcp-toolbox/telemetry"]["client.agent.id"]`. | Agent identifier supplied by the client. | | |
| | client | MCP client params._meta["dev.mcp-toolbox/telemetry"]["client.name"] and/or ["client.version"] (joined by /). | Identifies the ADK or application that initiated the MCP request. | | |
| | client.model | MCP client params._meta["dev.mcp-toolbox/telemetry"]["client.model"]. | The LLM model that produced the tool call. | | |
| | client.user.id | MCP client params._meta["dev.mcp-toolbox/telemetry"]["client.user.id"]. | End-user identifier supplied by the client. | | |
| | client.agent.id | MCP client params._meta["dev.mcp-toolbox/telemetry"]["client.agent.id"]. | Agent identifier supplied by the client. | |
References
- Verify project-specific terminology and acronyms (such as 'ADK' for client orchestration frameworks) before assuming they are typos for more common terms (such as 'SDK').
| | `--telemetry-gcp` | bool | Enable exporting directly to Google Cloud Monitoring. Default is `false`. | | ||
| | `--telemetry-otlp` | string | Enable exporting using OpenTelemetry Protocol (OTLP) to the specified endpoint (e.g. "127.0.0.1:4318"). To pass an insecure endpoint here, set environment variable `OTEL_EXPORTER_OTLP_INSECURE=true`. | | ||
| | `--telemetry-service-name` | string | Sets the value of the `service.name` resource attribute. Default is `toolbox`. | | ||
| | `--sql-commenter` | bool | Enable appending [SQLCommenter](../sql_commenter.md)-format comments to executed SQL statements. Default is `false`. | |
There was a problem hiding this comment.
For consistency with the implementation and the detailed documentation, 'prepending' should be used instead of 'appending'. Also, tool names must be in snake_case ('sql_commenter').
| | `--sql-commenter` | bool | Enable appending [SQLCommenter](../sql_commenter.md)-format comments to executed SQL statements. Default is `false`. | | |
| | --sql-commenter | bool | Enable prepending [sql_commenter](../sql_commenter.md)-format comments to executed SQL statements. Default is false. | |
References
- Tool names must be in snake_case.
There was a problem hiding this comment.
@AjmeraParth132 Thanks for the PR!
Could you PTAL at the GCA comments?
I feel the prepend vs append make sense, because we seem to be actually prepending and not appending?
I also think this comment could be relevant as well? WDYT?
a137cb3 to
fcd05e2
Compare
|
🚀 Cloudflare Preview Ready! 🔎 View Preview: https://pr-3281.toolbox-docs-6xc.pages.dev (Note: Subsequent pushes to this PR will automatically update the preview at this same URL) |
fcd05e2 to
5a489e3
Compare
5a489e3 to
d28d338
Compare
|
/gcbrun |
|
Closing this in favour of #3458 |
## Description Documentation update for added SQLCommenter support, and `telemetry_attributes` exposure for client SDKs > [!NOTE] > This PR supercedes the previous PR #3281 to update that with the latest changes from #3387. ## PR Checklist - [x] Make sure you reviewed [CONTRIBUTING.md](https://github.com/googleapis/mcp-toolbox/blob/main/CONTRIBUTING.md) - [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/mcp-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) - [x] Appropriate docs were updated (if necessary) - [ ] Make sure to add `!` if this involve a breaking change 🛠️ Fixes #3061 --------- Co-authored-by: Parth Ajmera <[email protected]>
Description
PR Checklist
CONTRIBUTING.md
bug/issue
before writing your code! That way we can discuss the change, evaluate
designs, and agree on the general idea
!if this involve a breaking change🛠️ Fixes #3061