mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-09 07:09:11 +02:00
Hoist ToolError imports to module level, add rpc.* migration note
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8f240fab1e
commit
63744015c5
3 changed files with 6 additions and 6 deletions
|
|
@ -193,6 +193,10 @@ def risky_operation() -> str:
|
|||
|
||||
## Attributes Reference
|
||||
|
||||
<Warning>
|
||||
**Migrating from v3.1 or earlier:** The `rpc.system`, `rpc.service`, and `rpc.method` span attributes were removed in favor of the [MCP semantic conventions](https://opentelemetry.io/docs/specs/semconv/gen-ai/mcp/) listed below. If you have dashboards or alerts keyed on those `rpc.*` attributes, update them to use `mcp.method.name` and the `fastmcp.*` attributes instead.
|
||||
</Warning>
|
||||
|
||||
### MCP Semantic Conventions
|
||||
|
||||
FastMCP implements the [OpenTelemetry MCP semantic conventions](https://opentelemetry.io/docs/specs/semconv/gen-ai/mcp/):
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ from contextlib import contextmanager
|
|||
|
||||
from opentelemetry.trace import Span, SpanKind, Status, StatusCode
|
||||
|
||||
from fastmcp.exceptions import ToolError as _ToolError
|
||||
from fastmcp.telemetry import get_tracer
|
||||
|
||||
|
||||
|
|
@ -44,8 +45,6 @@ def client_span(
|
|||
yield span
|
||||
except Exception as e:
|
||||
if span.is_recording():
|
||||
from fastmcp.exceptions import ToolError as _ToolError
|
||||
|
||||
error_type = (
|
||||
"tool_error" if isinstance(e, _ToolError) else type(e).__qualname__
|
||||
)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ from mcp.server.lowlevel.server import request_ctx
|
|||
from opentelemetry.context import Context
|
||||
from opentelemetry.trace import Span, SpanKind, Status, StatusCode
|
||||
|
||||
from fastmcp.exceptions import ToolError as _ToolError
|
||||
from fastmcp.telemetry import extract_trace_context, get_tracer
|
||||
|
||||
|
||||
|
|
@ -95,8 +96,6 @@ def server_span(
|
|||
yield span
|
||||
except Exception as e:
|
||||
if span.is_recording():
|
||||
from fastmcp.exceptions import ToolError as _ToolError
|
||||
|
||||
error_type = (
|
||||
"tool_error" if isinstance(e, _ToolError) else type(e).__qualname__
|
||||
)
|
||||
|
|
@ -132,8 +131,6 @@ def delegate_span(
|
|||
yield span
|
||||
except Exception as e:
|
||||
if span.is_recording():
|
||||
from fastmcp.exceptions import ToolError as _ToolError
|
||||
|
||||
error_type = (
|
||||
"tool_error" if isinstance(e, _ToolError) else type(e).__qualname__
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue