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

Unpack custom_sampling_context into attributes in ASGI #3764

Merged
merged 26 commits into from
Nov 14, 2024

Conversation

sentrivana
Copy link
Contributor

@sentrivana sentrivana commented Nov 12, 2024

Replace custom_sampling_context={"asgi_scope": scope} with several span attributes. Also, add sampling_context["transaction_context"]["source"], which was previously missing.

With the switch to OTel, custom_sampling_context can't continue to work as before. We've opted for making all necessary data accessible in the traces_sampler via span attributes instead. In order to use span attributes, we need to unpack any objects with serializable OTel-friendly data.

Part of #3746

Copy link

codecov bot commented Nov 12, 2024

❌ 1613 Tests Failed:

Tests completed Failed Passed Skipped
19831 1613 18218 4413
View the top 1 failed tests by shortest run time
tests.test_utils test_datetime_from_isoformat[2021-01-01T00:00:00.000000-00:00-expected_output4]
Stack Traces | 0.001s run time
tests/test_utils.py:109: in test_datetime_from_isoformat
    assert datetime_from_isoformat(input_str) == expected_output, input_str
E   NameError: name 'datetime_from_isoformat' is not defined
View the full list of 2 ❄️ flaky tests
tests.test_utils test_datetime_from_isoformat[2021-01-01T00:00:00.000000-0000-expected_output6]

Flake rate in main: 50.00% (Passed 32 times, Failed 32 times)

Stack Traces | 0.001s run time
tests/test_utils.py:109: in test_datetime_from_isoformat
    assert datetime_from_isoformat(input_str) == expected_output, input_str
E   NameError: name 'datetime_from_isoformat' is not defined
tests.test_scope test_with_isolation_scope_data

Flake rate in main: 99.11% (Passed 2 times, Failed 223 times)

Stack Traces | 0.001s run time
tests/test_scope.py:387: in test_with_isolation_scope_data
    assert scope._tags == {"before_isolation_scope": 1}
E   AssertionError: assert {} == {'before_isolation_scope': 1}
E     
E     Right contains 1 more item:
E     {'before_isolation_scope': 1}
E     
E     Full diff:
E     + {}
E     - {
E     -     'before_isolation_scope': 1,
E     - }

To view more test analytics, go to the Test Analytics Dashboard
Got feedback? Let us know on Github

@sentrivana sentrivana mentioned this pull request Nov 12, 2024
12 tasks
@sentrivana sentrivana changed the title Replace custom_sampling_context with attributes in ASGI Unpack custom_sampling_context into attributes in ASGI Nov 12, 2024
@sentrivana sentrivana marked this pull request as ready for review November 12, 2024 13:41
Base automatically changed from ivana/sampling-context to potel-base November 12, 2024 14:19
@sentrivana sentrivana marked this pull request as draft November 12, 2024 14:25
@sentrivana
Copy link
Contributor Author

Making this a draft, will try to fix sampler-related asgi tests here too

@sentrivana sentrivana marked this pull request as ready for review November 12, 2024 14:57
@sentrivana sentrivana changed the base branch from potel-base to ivana/potel/fix-sampler November 13, 2024 11:39
Base automatically changed from ivana/potel/fix-sampler to potel-base November 14, 2024 10:58
@sentrivana sentrivana merged commit 13ec94f into potel-base Nov 14, 2024
32 of 119 checks passed
@sentrivana sentrivana deleted the ivana/custom-sampling-context-integrations branch November 14, 2024 11:18
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.

2 participants