diff --git a/.github/workflows/test-integrations-ai.yml b/.github/workflows/test-integrations-ai.yml index c81f574eea..f3864b09f9 100644 --- a/.github/workflows/test-integrations-ai.yml +++ b/.github/workflows/test-integrations-ai.yml @@ -68,7 +68,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml @@ -130,7 +130,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml diff --git a/.github/workflows/test-integrations-aws-lambda.yml b/.github/workflows/test-integrations-aws.yml similarity index 92% rename from .github/workflows/test-integrations-aws-lambda.yml rename to .github/workflows/test-integrations-aws.yml index b6fce68067..3764a51a1a 100644 --- a/.github/workflows/test-integrations-aws-lambda.yml +++ b/.github/workflows/test-integrations-aws.yml @@ -1,6 +1,6 @@ # Do not edit this file. This file is generated automatically by executing # python scripts/split-tox-gh-actions/split-tox-gh-actions.py -name: Test AWS Lambda +name: Test AWS on: push: branches: @@ -52,8 +52,8 @@ jobs: - name: Check permissions on repo branch if: github.event_name == 'push' run: true - test-aws_lambda-pinned: - name: AWS Lambda (pinned) + test-aws-pinned: + name: AWS (pinned) timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: @@ -87,7 +87,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml @@ -102,13 +102,13 @@ jobs: files: .junitxml verbose: true check_required_tests: - name: All pinned AWS Lambda tests passed - needs: test-aws_lambda-pinned + name: All pinned AWS tests passed + needs: test-aws-pinned # Always run this, even if a dependent job failed if: always() runs-on: ubuntu-20.04 steps: - name: Check for failures - if: contains(needs.test-aws_lambda-pinned.result, 'failure') || contains(needs.test-aws_lambda-pinned.result, 'skipped') + if: contains(needs.test-aws-pinned.result, 'failure') || contains(needs.test-aws-pinned.result, 'skipped') run: | echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integrations-cloud-computing.yml b/.github/workflows/test-integrations-cloud.yml similarity index 90% rename from .github/workflows/test-integrations-cloud-computing.yml rename to .github/workflows/test-integrations-cloud.yml index b20eaa3cf2..9fc4ace8dc 100644 --- a/.github/workflows/test-integrations-cloud-computing.yml +++ b/.github/workflows/test-integrations-cloud.yml @@ -1,6 +1,6 @@ # Do not edit this file. This file is generated automatically by executing # python scripts/split-tox-gh-actions/split-tox-gh-actions.py -name: Test Cloud Computing +name: Test Cloud on: push: branches: @@ -20,8 +20,8 @@ env: CACHED_BUILD_PATHS: | ${{ github.workspace }}/dist-serverless jobs: - test-cloud_computing-latest: - name: Cloud Computing (latest) + test-cloud-latest: + name: Cloud (latest) timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: @@ -64,7 +64,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml @@ -78,8 +78,8 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} files: .junitxml verbose: true - test-cloud_computing-pinned: - name: Cloud Computing (pinned) + test-cloud-pinned: + name: Cloud (pinned) timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: @@ -122,7 +122,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml @@ -137,13 +137,13 @@ jobs: files: .junitxml verbose: true check_required_tests: - name: All pinned Cloud Computing tests passed - needs: test-cloud_computing-pinned + name: All pinned Cloud tests passed + needs: test-cloud-pinned # Always run this, even if a dependent job failed if: always() runs-on: ubuntu-20.04 steps: - name: Check for failures - if: contains(needs.test-cloud_computing-pinned.result, 'failure') || contains(needs.test-cloud_computing-pinned.result, 'skipped') + if: contains(needs.test-cloud-pinned.result, 'failure') || contains(needs.test-cloud-pinned.result, 'skipped') run: | echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integrations-common.yml b/.github/workflows/test-integrations-common.yml index f9248f0339..8eaf0bf7fa 100644 --- a/.github/workflows/test-integrations-common.yml +++ b/.github/workflows/test-integrations-common.yml @@ -52,7 +52,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml diff --git a/.github/workflows/test-integrations-databases.yml b/.github/workflows/test-integrations-dbs.yml similarity index 94% rename from .github/workflows/test-integrations-databases.yml rename to .github/workflows/test-integrations-dbs.yml index 0f44ede674..ac9be77cc2 100644 --- a/.github/workflows/test-integrations-databases.yml +++ b/.github/workflows/test-integrations-dbs.yml @@ -1,6 +1,6 @@ # Do not edit this file. This file is generated automatically by executing # python scripts/split-tox-gh-actions/split-tox-gh-actions.py -name: Test Databases +name: Test DBs on: push: branches: @@ -20,8 +20,8 @@ env: CACHED_BUILD_PATHS: | ${{ github.workspace }}/dist-serverless jobs: - test-databases-latest: - name: Databases (latest) + test-dbs-latest: + name: DBs (latest) timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: @@ -91,7 +91,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml @@ -105,8 +105,8 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} files: .junitxml verbose: true - test-databases-pinned: - name: Databases (pinned) + test-dbs-pinned: + name: DBs (pinned) timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: @@ -176,7 +176,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml @@ -191,13 +191,13 @@ jobs: files: .junitxml verbose: true check_required_tests: - name: All pinned Databases tests passed - needs: test-databases-pinned + name: All pinned DBs tests passed + needs: test-dbs-pinned # Always run this, even if a dependent job failed if: always() runs-on: ubuntu-20.04 steps: - name: Check for failures - if: contains(needs.test-databases-pinned.result, 'failure') || contains(needs.test-databases-pinned.result, 'skipped') + if: contains(needs.test-dbs-pinned.result, 'failure') || contains(needs.test-dbs-pinned.result, 'skipped') run: | echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integrations-graphql.yml b/.github/workflows/test-integrations-graphql.yml index dcc467c61f..c8a4017de5 100644 --- a/.github/workflows/test-integrations-graphql.yml +++ b/.github/workflows/test-integrations-graphql.yml @@ -64,7 +64,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml @@ -122,7 +122,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml diff --git a/.github/workflows/test-integrations-miscellaneous.yml b/.github/workflows/test-integrations-misc.yml similarity index 92% rename from .github/workflows/test-integrations-miscellaneous.yml rename to .github/workflows/test-integrations-misc.yml index 2a1c2818fd..cf3ecbdc78 100644 --- a/.github/workflows/test-integrations-miscellaneous.yml +++ b/.github/workflows/test-integrations-misc.yml @@ -1,6 +1,6 @@ # Do not edit this file. This file is generated automatically by executing # python scripts/split-tox-gh-actions/split-tox-gh-actions.py -name: Test Miscellaneous +name: Test Misc on: push: branches: @@ -20,8 +20,8 @@ env: CACHED_BUILD_PATHS: | ${{ github.workspace }}/dist-serverless jobs: - test-miscellaneous-latest: - name: Miscellaneous (latest) + test-misc-latest: + name: Misc (latest) timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: @@ -76,7 +76,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml @@ -90,8 +90,8 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} files: .junitxml verbose: true - test-miscellaneous-pinned: - name: Miscellaneous (pinned) + test-misc-pinned: + name: Misc (pinned) timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: @@ -146,7 +146,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml @@ -161,13 +161,13 @@ jobs: files: .junitxml verbose: true check_required_tests: - name: All pinned Miscellaneous tests passed - needs: test-miscellaneous-pinned + name: All pinned Misc tests passed + needs: test-misc-pinned # Always run this, even if a dependent job failed if: always() runs-on: ubuntu-20.04 steps: - name: Check for failures - if: contains(needs.test-miscellaneous-pinned.result, 'failure') || contains(needs.test-miscellaneous-pinned.result, 'skipped') + if: contains(needs.test-misc-pinned.result, 'failure') || contains(needs.test-misc-pinned.result, 'skipped') run: | echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integrations-networking.yml b/.github/workflows/test-integrations-network.yml similarity index 91% rename from .github/workflows/test-integrations-networking.yml rename to .github/workflows/test-integrations-network.yml index c5b4722b57..6ce39b1781 100644 --- a/.github/workflows/test-integrations-networking.yml +++ b/.github/workflows/test-integrations-network.yml @@ -1,6 +1,6 @@ # Do not edit this file. This file is generated automatically by executing # python scripts/split-tox-gh-actions/split-tox-gh-actions.py -name: Test Networking +name: Test Network on: push: branches: @@ -20,8 +20,8 @@ env: CACHED_BUILD_PATHS: | ${{ github.workspace }}/dist-serverless jobs: - test-networking-latest: - name: Networking (latest) + test-network-latest: + name: Network (latest) timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: @@ -64,7 +64,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml @@ -78,8 +78,8 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} files: .junitxml verbose: true - test-networking-pinned: - name: Networking (pinned) + test-network-pinned: + name: Network (pinned) timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: @@ -122,7 +122,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml @@ -137,13 +137,13 @@ jobs: files: .junitxml verbose: true check_required_tests: - name: All pinned Networking tests passed - needs: test-networking-pinned + name: All pinned Network tests passed + needs: test-network-pinned # Always run this, even if a dependent job failed if: always() runs-on: ubuntu-20.04 steps: - name: Check for failures - if: contains(needs.test-networking-pinned.result, 'failure') || contains(needs.test-networking-pinned.result, 'skipped') + if: contains(needs.test-network-pinned.result, 'failure') || contains(needs.test-network-pinned.result, 'skipped') run: | echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integrations-data-processing.yml b/.github/workflows/test-integrations-tasks.yml similarity index 93% rename from .github/workflows/test-integrations-data-processing.yml rename to .github/workflows/test-integrations-tasks.yml index 713ba71727..c8c579ded7 100644 --- a/.github/workflows/test-integrations-data-processing.yml +++ b/.github/workflows/test-integrations-tasks.yml @@ -1,6 +1,6 @@ # Do not edit this file. This file is generated automatically by executing # python scripts/split-tox-gh-actions/split-tox-gh-actions.py -name: Test Data Processing +name: Test Tasks on: push: branches: @@ -20,8 +20,8 @@ env: CACHED_BUILD_PATHS: | ${{ github.workspace }}/dist-serverless jobs: - test-data_processing-latest: - name: Data Processing (latest) + test-tasks-latest: + name: Tasks (latest) timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: @@ -82,7 +82,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml @@ -96,8 +96,8 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} files: .junitxml verbose: true - test-data_processing-pinned: - name: Data Processing (pinned) + test-tasks-pinned: + name: Tasks (pinned) timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: @@ -158,7 +158,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml @@ -173,13 +173,13 @@ jobs: files: .junitxml verbose: true check_required_tests: - name: All pinned Data Processing tests passed - needs: test-data_processing-pinned + name: All pinned Tasks tests passed + needs: test-tasks-pinned # Always run this, even if a dependent job failed if: always() runs-on: ubuntu-20.04 steps: - name: Check for failures - if: contains(needs.test-data_processing-pinned.result, 'failure') || contains(needs.test-data_processing-pinned.result, 'skipped') + if: contains(needs.test-tasks-pinned.result, 'failure') || contains(needs.test-tasks-pinned.result, 'skipped') run: | echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integrations-web-frameworks-1.yml b/.github/workflows/test-integrations-web-1.yml similarity index 92% rename from .github/workflows/test-integrations-web-frameworks-1.yml rename to .github/workflows/test-integrations-web-1.yml index cca39c2cdc..f36b859892 100644 --- a/.github/workflows/test-integrations-web-frameworks-1.yml +++ b/.github/workflows/test-integrations-web-1.yml @@ -1,6 +1,6 @@ # Do not edit this file. This file is generated automatically by executing # python scripts/split-tox-gh-actions/split-tox-gh-actions.py -name: Test Web Frameworks 1 +name: Test Web 1 on: push: branches: @@ -20,8 +20,8 @@ env: CACHED_BUILD_PATHS: | ${{ github.workspace }}/dist-serverless jobs: - test-web_frameworks_1-latest: - name: Web Frameworks 1 (latest) + test-web_1-latest: + name: Web 1 (latest) timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: @@ -82,7 +82,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml @@ -96,8 +96,8 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} files: .junitxml verbose: true - test-web_frameworks_1-pinned: - name: Web Frameworks 1 (pinned) + test-web_1-pinned: + name: Web 1 (pinned) timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: @@ -158,7 +158,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml @@ -173,13 +173,13 @@ jobs: files: .junitxml verbose: true check_required_tests: - name: All pinned Web Frameworks 1 tests passed - needs: test-web_frameworks_1-pinned + name: All pinned Web 1 tests passed + needs: test-web_1-pinned # Always run this, even if a dependent job failed if: always() runs-on: ubuntu-20.04 steps: - name: Check for failures - if: contains(needs.test-web_frameworks_1-pinned.result, 'failure') || contains(needs.test-web_frameworks_1-pinned.result, 'skipped') + if: contains(needs.test-web_1-pinned.result, 'failure') || contains(needs.test-web_1-pinned.result, 'skipped') run: | echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/.github/workflows/test-integrations-web-frameworks-2.yml b/.github/workflows/test-integrations-web-2.yml similarity index 93% rename from .github/workflows/test-integrations-web-frameworks-2.yml rename to .github/workflows/test-integrations-web-2.yml index 8f4b9d4eb3..b3dedd124f 100644 --- a/.github/workflows/test-integrations-web-frameworks-2.yml +++ b/.github/workflows/test-integrations-web-2.yml @@ -1,6 +1,6 @@ # Do not edit this file. This file is generated automatically by executing # python scripts/split-tox-gh-actions/split-tox-gh-actions.py -name: Test Web Frameworks 2 +name: Test Web 2 on: push: branches: @@ -20,8 +20,8 @@ env: CACHED_BUILD_PATHS: | ${{ github.workspace }}/dist-serverless jobs: - test-web_frameworks_2-latest: - name: Web Frameworks 2 (latest) + test-web_2-latest: + name: Web 2 (latest) timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: @@ -88,7 +88,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml @@ -102,8 +102,8 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} files: .junitxml verbose: true - test-web_frameworks_2-pinned: - name: Web Frameworks 2 (pinned) + test-web_2-pinned: + name: Web 2 (pinned) timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: @@ -170,7 +170,7 @@ jobs: coverage xml - name: Upload coverage to Codecov if: ${{ !cancelled() }} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml @@ -185,13 +185,13 @@ jobs: files: .junitxml verbose: true check_required_tests: - name: All pinned Web Frameworks 2 tests passed - needs: test-web_frameworks_2-pinned + name: All pinned Web 2 tests passed + needs: test-web_2-pinned # Always run this, even if a dependent job failed if: always() runs-on: ubuntu-20.04 steps: - name: Check for failures - if: contains(needs.test-web_frameworks_2-pinned.result, 'failure') || contains(needs.test-web_frameworks_2-pinned.result, 'skipped') + if: contains(needs.test-web_2-pinned.result, 'failure') || contains(needs.test-web_2-pinned.result, 'skipped') run: | echo "One of the dependent jobs has failed. You may need to re-run it." && exit 1 diff --git a/scripts/split-tox-gh-actions/split-tox-gh-actions.py b/scripts/split-tox-gh-actions/split-tox-gh-actions.py index c0bf2a7a09..c4b8f3e5e5 100755 --- a/scripts/split-tox-gh-actions/split-tox-gh-actions.py +++ b/scripts/split-tox-gh-actions/split-tox-gh-actions.py @@ -65,18 +65,18 @@ "openai", "huggingface_hub", ], - "AWS Lambda": [ + "AWS": [ # this is separate from Cloud Computing because only this one test suite # needs to run with access to GitHub secrets "aws_lambda", ], - "Cloud Computing": [ + "Cloud": [ "boto3", "chalice", "cloud_resource_context", "gcp", ], - "Data Processing": [ + "Tasks": [ "arq", "beam", "celery", @@ -86,7 +86,7 @@ "rq", "spark", ], - "Databases": [ + "DBs": [ "asyncpg", "clickhouse_driver", "pymongo", @@ -100,19 +100,19 @@ "graphene", "strawberry", ], - "Networking": [ + "Network": [ "gevent", "grpc", "httpx", "requests", ], - "Web Frameworks 1": [ + "Web 1": [ "django", "flask", "starlette", "fastapi", ], - "Web Frameworks 2": [ + "Web 2": [ "aiohttp", "asgi", "bottle", @@ -124,7 +124,7 @@ "starlite", "tornado", ], - "Miscellaneous": [ + "Misc": [ "launchdarkly", "loguru", "openfeature", diff --git a/scripts/split-tox-gh-actions/templates/test_group.jinja b/scripts/split-tox-gh-actions/templates/test_group.jinja index 4fcfe6cd8e..0187434790 100644 --- a/scripts/split-tox-gh-actions/templates/test_group.jinja +++ b/scripts/split-tox-gh-actions/templates/test_group.jinja @@ -81,7 +81,7 @@ - name: Upload coverage to Codecov if: {% raw %}${{ !cancelled() }}{% endraw %} - uses: codecov/codecov-action@v4.6.0 + uses: codecov/codecov-action@v5.0.2 with: token: {% raw %}${{ secrets.CODECOV_TOKEN }}{% endraw %} files: coverage.xml diff --git a/sentry_sdk/integrations/django/caching.py b/sentry_sdk/integrations/django/caching.py index aa60993155..b07bd4e9cf 100644 --- a/sentry_sdk/integrations/django/caching.py +++ b/sentry_sdk/integrations/django/caching.py @@ -133,10 +133,22 @@ def _get_address_port(settings): return address, int(port) if port is not None else None -def patch_caching(): - # type: () -> None +def should_enable_cache_spans(): + # type: () -> bool from sentry_sdk.integrations.django import DjangoIntegration + client = sentry_sdk.get_client() + integration = client.get_integration(DjangoIntegration) + from django.conf import settings + + return integration is not None and ( + (client.spotlight is not None and settings.DEBUG is True) + or integration.cache_spans is True + ) + + +def patch_caching(): + # type: () -> None if not hasattr(CacheHandler, "_sentry_patched"): if DJANGO_VERSION < (3, 2): original_get_item = CacheHandler.__getitem__ @@ -146,8 +158,7 @@ def sentry_get_item(self, alias): # type: (CacheHandler, str) -> Any cache = original_get_item(self, alias) - integration = sentry_sdk.get_client().get_integration(DjangoIntegration) - if integration is not None and integration.cache_spans: + if should_enable_cache_spans(): from django.conf import settings address, port = _get_address_port( @@ -169,8 +180,7 @@ def sentry_create_connection(self, alias): # type: (CacheHandler, str) -> Any cache = original_create_connection(self, alias) - integration = sentry_sdk.get_client().get_integration(DjangoIntegration) - if integration is not None and integration.cache_spans: + if should_enable_cache_spans(): address, port = _get_address_port(self.settings[alias or "default"]) _patch_cache(cache, address, port)