Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tracing): Propagate sample_rand to transaction's baggage #4040

Draft
wants to merge 1 commit into
base: szokeasaurusrex/sample_rand-2
Choose a base branch
from

Conversation

szokeasaurusrex
Copy link
Member

@szokeasaurusrex szokeasaurusrex commented Feb 11, 2025

continue_trace now propagates incoming sample_rand values to the transaction's baggage. Also, in the case where sample_rand is missing from the incoming trace and needs to be backfilled, this change introduces a mechanism for the backfilled value from the scope's propagation context to be propagated to the transaction's baggage.

The transaction still does not use the sample_rand for making sampling decisions; this PR only enables propagation. A future PR will add support for reading the incoming/backfilled sample_rand and for using this value to make sampling decisions.

Depends on:

Ref #3998


Thank you for contributing to sentry-python! Please add tests to validate your changes, and lint your code using tox -e linters.

Running the test suite on your PR might require maintainer approval. The AWS Lambda tests additionally require a maintainer to add a special label, and they will fail until this label is added.

Copy link

codecov bot commented Feb 11, 2025

❌ 52 Tests Failed:

Tests completed Failed Passed Skipped
22770 52 22718 5772
View the top 3 failed test(s) by shortest run time
tests.integrations.strawberry.test_strawberry test_breadcrumb_no_operation_name[sync_app_client_factory-False-framework_integrations1]
Stack Traces | 0.063s run time
.../integrations/strawberry/test_strawberry.py:282: in test_breadcrumb_no_operation_name
    sentry_init(
tests/conftest.py:203: in inner
    client = sentry_sdk.Client(*a, **kw)
sentry_sdk/client.py:269: in __init__
    self._init_impl()
sentry_sdk/client.py:392: in _init_impl
    self.integrations = setup_integrations(
sentry_sdk/integrations/__init__.py:211: in setup_integrations
    type(integration).setup_once()
sentry_sdk/integrations/strawberry.py:81: in setup_once
    _patch_execute()
sentry_sdk/integrations/strawberry.py:293: in _patch_execute
    old_execute_sync = strawberry_schema.execute_sync
E   AttributeError: module 'strawberry.schema.schema' has no attribute 'execute_sync'
tests.integrations.strawberry.test_strawberry test_transaction_mutation[sync_app_client_factory-False-framework_integrations1]
Stack Traces | 0.063s run time
.../integrations/strawberry/test_strawberry.py:554: in test_transaction_mutation
    sentry_init(
tests/conftest.py:203: in inner
    client = sentry_sdk.Client(*a, **kw)
sentry_sdk/client.py:269: in __init__
    self._init_impl()
sentry_sdk/client.py:392: in _init_impl
    self.integrations = setup_integrations(
sentry_sdk/integrations/__init__.py:211: in setup_integrations
    type(integration).setup_once()
sentry_sdk/integrations/strawberry.py:81: in setup_once
    _patch_execute()
sentry_sdk/integrations/strawberry.py:293: in _patch_execute
    old_execute_sync = strawberry_schema.execute_sync
E   AttributeError: module 'strawberry.schema.schema' has no attribute 'execute_sync'
tests.integrations.strawberry.test_strawberry test_transaction_no_operation_name[async_app_client_factory-True-framework_integrations0]
Stack Traces | 0.063s run time
.../integrations/strawberry/test_strawberry.py:474: in test_transaction_no_operation_name
    sentry_init(
tests/conftest.py:203: in inner
    client = sentry_sdk.Client(*a, **kw)
sentry_sdk/client.py:269: in __init__
    self._init_impl()
sentry_sdk/client.py:392: in _init_impl
    self.integrations = setup_integrations(
sentry_sdk/integrations/__init__.py:211: in setup_integrations
    type(integration).setup_once()
sentry_sdk/integrations/strawberry.py:81: in setup_once
    _patch_execute()
sentry_sdk/integrations/strawberry.py:293: in _patch_execute
    old_execute_sync = strawberry_schema.execute_sync
E   AttributeError: module 'strawberry.schema.schema' has no attribute 'execute_sync'

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-2 branch from 14a70da to 0a0de06 Compare February 11, 2025 19:21
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-3 branch from 92cd6fb to bea45b9 Compare February 11, 2025 19:21
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-2 branch from 0a0de06 to 21bb038 Compare February 11, 2025 19:29
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-3 branch from bea45b9 to 6363759 Compare February 11, 2025 19:30
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-2 branch from 21bb038 to 836d5b1 Compare February 11, 2025 19:39
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-3 branch 2 times, most recently from c017f49 to 154662a Compare February 11, 2025 19:45
`continue_trace` now propagates incoming `sample_rand` values to the transaction's baggage. Also, in the case where `sample_rand` is missing from the incoming trace and needs to be backfilled, this change introduces a mechanism for the backfilled value from the scope's propagation context to be propagated to the transaction's baggage.

The transaction still does not use the `sample_rand` for making sampling decisions; this PR only enables propagation. A future PR will add support for reading the incoming/backfilled `sample_rand` and for using this value to make sampling decisions.

Ref #3998
@szokeasaurusrex szokeasaurusrex force-pushed the szokeasaurusrex/sample_rand-3 branch from 154662a to af64b16 Compare February 12, 2025 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant