fastmcp/tests/server/telemetry
strawgate 13d6412741 feat: instrument ctx.sample() / sampling loop with OpenTelemetry spans
Add OTEL tracing to the sampling pipeline:
- `sampling/createMessage` span wrapping sample_impl() with attributes for
  temperature, max_tokens, tool_count, result_type, and iteration count
- `sampling/createMessage step` child spans per loop iteration with
  iteration index and stop reason
- `sampling.execute_tool <name>` spans for tool calls within sampling,
  including error status on failures
- Validation failure and text response retry events on the parent span
- Opt-in content capture via OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT

Also adds is_recording() guards to server_span, delegate_span, and
client_span to avoid unnecessary attribute serialization when sampling is
disabled, and sets error.type using __qualname__ for better nested class
names.

Closes #3891

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:28:07 -05:00
..
__init__.py Add OpenTelemetry tracing support 2026-01-14 09:45:41 -05:00
test_provider_tracing.py Fix ty 0.0.17 diagnostics and bump lockfile 2026-02-16 16:13:38 -05:00
test_sampling_tracing.py feat: instrument ctx.sample() / sampling loop with OpenTelemetry spans 2026-04-13 01:28:07 -05:00
test_server_tracing.py Add component versioning and VersionFilter transform (#2894) 2026-01-16 20:53:18 -05:00