stream() calls by @alexander-alderman-webb in #5950httpx types in rate-limit test by @alexander-alderman-webb in #5975httpx types in embedding tests by @alexander-alderman-webb in #5970httpx types in nonstreaming completion() tests by @alexander-alderman-webb in #5937gen_ai.tool.type span attribute by @ericapisani in #5964None span context in the span processor and pin tokenizers version for anthropic tests on Python 3.8 by @alexander-alderman-webb in #5967gen_ai.operation.name and gen_ai.pipeline.name on LLM spans by @ericapisani in #5849gen_ai.generate_text by @ericapisani in #5796Add experimental async transport by @BYK in #5646
See https://github.com/getsentry/sentry-python/discussions/5919 for details.
_iterator for streamed responses by @alexander-alderman-webb in #5917gen_ai.response.streaming for Responses by @alexander-alderman-webb in #5697max_output_tokens for Responses API by @alexander-alderman-webb in #5693gen_ai.response.streaming for Completions by @alexander-alderman-webb in #5692httpx types by @alexander-alderman-webb in #5724This is an alpha release for internal testing.
AsyncStream.close() and AsyncMessageStream.close() to finish spans by @alexander-alderman-webb in #5675Stream.close() and MessageStream.close() to finish spans by @alexander-alderman-webb in #5674-latest alias for each integration test suite by @sentrivana in #5706gen_ai.chat spans for asynchronous messages.stream() by @alexander-alderman-webb in #5572messages.stream() by @alexander-alderman-webb in #5565gen_ai.system attribute to spans by @ericapisani in #5661GeneratorExit by @alexander-alderman-webb in #5643set_attribute example to changelog by @sentrivana in #5578stream() by @alexander-alderman-webb in #5665with_streaming_response() by @alexander-alderman-webb in #5583httpx for streamed responses by @alexander-alderman-webb in #5580httpx in non-MCP tool tests by @alexander-alderman-webb in #5602httpx in MCP tool tests by @alexander-alderman-webb in #5605httpx in handoff tests by @alexander-alderman-webb in #5604httpx in API error test by @alexander-alderman-webb in #5601httpx in non-error single-response tests by @alexander-alderman-webb in #5600namespace tool field for new openai versions by @alexander-alderman-webb in #5599httpx to linting requirements by @alexander-alderman-webb in #5644populate_tox.py by @alexander-alderman-webb in #5574potel-base by @sentrivana in #5614This is an alpha release for internal testing.
Add set_attribute, remove_attribute to global API by @sentrivana in #5555
You can now set and unset attributes on logs and metrics via top-level API. Think of it as sentry_sdk.set_tag() for attribute-based telemetry. Other event types (transactions, spans, errors) will be unaffected.
import sentry_sdk
sentry_sdk.init(...)
sentry_sdk.set_attribute("my.attribute", "my value")
# This metric will have "my.attribute" set
sentry_sdk.metrics.count("counter", 1)
# Remove the attribute
sentry_sdk.remove_attribute("my.attribute")
# This log will not have "my.attribute" set
sentry_sdk.logger.info("An info log")
ToolManager._call_tool by @sentrivana in #5522set_data_normalized for primitive attributes by @alexander-alderman-webb in #5509set_data_normalized for primitive attributes by @alexander-alderman-webb in #5504set_data_normalized for the gen_ai.response.model attribute by @alexander-alderman-webb in #5512This is an alpha release for internal testing.
This is an alpha release for internal testing.
execute_final_output() functions following library refactor by @alexander-alderman-webb in #5453execute_handoffs() functions following library refactor by @alexander-alderman-webb in #5452run_single_turn_streamed() functions following library refactor by @alexander-alderman-webb in #5451run_single_turn() functions following library refactor by @alexander-alderman-webb in #5450openai-agents control-flow by @alexander-alderman-webb in #5447openai-agents control-flow by @alexander-alderman-webb in #5447gen_ai.conversation.id if available by @constantinius in #5307HostedMCPTool when streaming by @alexander-alderman-webb in #5405Message by @alexander-alderman-webb in #5411test_fastmcp_without_request_context() by @alexander-alderman-webb in #5412AsyncClient for SSE by @alexander-alderman-webb in #5400TestClient for Streamable HTTP by @alexander-alderman-webb in #5384AsyncClient for SSE by @alexander-alderman-webb in #5396TestClient for Streamable HTTP by @alexander-alderman-webb in #5383gen_ai.conversation.id if available by @constantinius in #5307HostedMCPTool when streaming by @alexander-alderman-webb in #5405Message by @alexander-alderman-webb in #5411test_fastmcp_without_request_context() by @alexander-alderman-webb in #5412AsyncClient for SSE by @alexander-alderman-webb in #5400TestClient for Streamable HTTP by @alexander-alderman-webb in #5384AsyncClient for SSE by @alexander-alderman-webb in #5396TestClient for Streamable HTTP by @alexander-alderman-webb in #5383gen_ai.chat spans by @alexander-alderman-webb in #5370trace_lifecycle switch (1) by @sentrivana in #5397set_data_normalized() with Span.set_data() for system instructions by @alexander-alderman-webb in #5374gen_ai.response.time_to_first_token by @constantinius in #5348gen_ai.chat spans by @alexander-alderman-webb in #5370set_conversation_id and managing functions on the Scope and apply it on the Span on .finish() by @constantinius in #5362gen_ai.response.time_to_first_token by @constantinius in #5348set_conversation_id and managing functions on the Scope and apply it on the Span on .finish() by @constantinius in #5362feat(asyncio): Add on-demand way to enable AsyncioIntegration by @sentrivana in #5288
You can now enable the AsyncioIntegration on demand, after calling sentry_sdk.init(). This is useful in scenarios where you don't have
the event loop running early on, or when you need to instrument multiple event loops.
import sentry_sdk
from sentry_sdk.integrations.asyncio import enable_asyncio_integration
# Initializing the SDK as early as possible, when there is no event loop yet
sentry_sdk.init(
...
# No AsyncioIntegration in explicitly provided `integrations`
)
async def main():
enable_asyncio_integration() # instruments the current event loop
# ...your code...
HostedMCPTool by @alexander-alderman-webb in #5297gen_ai.request.messages extraction from parameters by @constantinius in #5275gen_ai.request.messages structure by @constantinius in #5251gen_ai.request.messages to be as expected by @constantinius in #5255AttributeError try-except by @alexander-alderman-webb in #5339Scope.set_attribute by @sentrivana in #5256middleware_spans docstring by @sentrivana in #5279