-
Notifications
You must be signed in to change notification settings - Fork 299
Description
This is to add telemetry for custom tools. Details are present in review comments from a previous PR- #3048 (comment)
// copied from review comments
Please add explicit OpenTelemetry tracing for custom stored-procedure MCP tools.
Scope: DynamicCustomTool.ExecuteAsync(...)
Requirements:
Create an Activity/span around each tool invocation (e.g., span name mcp.tool.call or dab.mcp.custom_tool.execute).
Add span attributes/tags at minimum:
mcp.tool.name = tool name
dab.entity = entity alias/name
dab.operation = execute
db.procedure (or equivalent) = stored procedure name / db object (schema-qualified if available)
Record outcome on the span:
mark success vs failure (ActivityStatusCode.Ok / Error)
on exceptions, record the exception on the span and include an error message/code where available.
Notes:
Logging via ILogger is not sufficient; the tool should emit tracing spans directly.
Ensure spans are created for both success and failure paths (including auth/validation failures).
Please implement OpenTelemetry tracing for MCP tool execution centrally to avoid duplicating instrumentation in every tool.
Goal: Every MCP tools/call invocation (built-in DML tools and dynamic custom stored-proc tools) emits a consistent span.
General idea:
Add instrumentation in the MCP dispatcher / tool execution entry point (the code path that resolves the tool by name and invokes IMcpTool.ExecuteAsync).
Start an Activity span for each tool call (e.g., mcp.tool.call / dab.mcp.tool.execute) and ensure it wraps the entire execution including auth/validation and query execution.
Apply standard tags (e.g., mcp.tool.name, dab.entity when applicable, dab.operation, db.procedure when applicable).
Set span status to Ok/Error and record exceptions.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status