github getsentry/sentry-python 2.43.0

2 days ago

Various fixes & improvements

  • Pydantic AI integration (#4906) by @constantinius

    Enable the new Pydantic AI integration with the code snippet below, and you can use the Sentry AI dashboards to observe your AI calls:

    import sentry_sdk
    from sentry_sdk.integrations.pydantic_ai import PydanticAIIntegration
    sentry_sdk.init(
        dsn="<your-dsn>",
        # Set traces_sample_rate to 1.0 to capture 100%
        # of transactions for tracing.
        traces_sample_rate=1.0,
        # Add data like inputs and responses;
        # see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
        send_default_pii=True,
        integrations=[
            PydanticAIIntegration(),
        ],
    )
  • MCP Python SDK (#4964) by @constantinius

    Enable the new Python MCP integration with the code snippet below:

    import sentry_sdk
    from sentry_sdk.integrations.mcp import MCPIntegration
    sentry_sdk.init(
        dsn="<your-dsn>",
        # Set traces_sample_rate to 1.0 to capture 100%
        # of transactions for tracing.
        traces_sample_rate=1.0,
        # Add data like inputs and responses;
        # see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
        send_default_pii=True,
        integrations=[
            MCPIntegration(),
        ],
    )
  • fix(strawberry): Remove autodetection, always use sync extension (#4984) by @sentrivana

    Previously, StrawberryIntegration would try to guess whether it should install the sync or async version of itself. This auto-detection was very brittle and could lead to us auto-enabling async code in a sync context. With this change, StrawberryIntegration remains an auto-enabling integration, but it'll enable the sync version by default. If you want to enable the async version, pass the option explicitly:

    sentry_sdk.init(
        # ...
        integrations=[
            StrawberryIntegration(
                async_execution=True
            ),
        ],
    )
  • fix(google-genai): Set agent name (#5038) by @constantinius

  • fix(integrations): hooking into error tracing function to find out if an execute tool span should be set to error (#4986) by @constantinius

  • fix(django): Improve logic for classifying cache hits and misses (#5029) by @alexander-alderman-webb

  • chore(metrics): Rename _metrics to metrics (#5035) by @alexander-alderman-webb

  • fix(tracemetrics): Bump metric buffer size to 1k (#5031) by @k-fish

  • fix startlette deprecation warning (#5034) by @DeoLeung

  • build(deps): bump actions/upload-artifact from 4 to 5 (#5032) by @dependabot

  • fix(ai): truncate messages for google genai (#4992) by @shellmayr

  • fix(ai): add message truncation to litellm (#4973) by @shellmayr

  • feat(langchain): Support v1 (#4874) by @sentrivana

  • ci: Run common test suite on Python 3.14t (#4969) by @alexander-alderman-webb

  • feat: Officially support 3.14 & run integration tests on 3.14 (#4974) by @sentrivana

  • Make logger template format safer to missing kwargs (#4981) by @sl0thentr0py

  • tests(huggingface): Support 1.0.0rc7 (#4979) by @alexander-alderman-webb

  • feat: Enable HTTP request code origin by default (#4967) by @alexander-alderman-webb

  • ci: Run common test suite on Python 3.14 (#4896) by @sentrivana

Don't miss a new sentry-python release

NewReleases is sending notifications on new releases.