Skip to content

Cleanup op and description mapping #4560

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

Open
wants to merge 1 commit into
base: potel-base
Choose a base branch
from

Conversation

sl0thentr0py
Copy link
Member

@sl0thentr0py sl0thentr0py commented Jul 8, 2025

The main change is that op is now optional and name and description are basically interchangeable and map to each other as best as possible.

Preference is given to explicitly set values (SentrySpanAttribute) and if not (in the case of pure otel spans), we try to derive them. The entire flow is much cleaner now instead of repeated calls to the same attributes.

(For the main mapping changes in opentelemetry/test_utils I'd recommend reading the new code instead of the diff.)

Copy link

codecov bot commented Jul 8, 2025

❌ 33 Tests Failed:

Tests completed Failed Passed Skipped
21176 33 21143 4366
View the top 3 failed test(s) by shortest run time
tests.integrations.redis.test_redis::test_data_truncation_custom
Stack Traces | 0.079s run time
.../integrations/redis/test_redis.py:209: in test_data_truncation_custom
    assert (
E   assert '- op=null: description=null\n  - op="db.redis": description="SET \'somekey1\' \'aaaaaaaaaaa..."\n  - op="db.redis": description="SET \'somekey2\' \'bbbbbbbbbb\'"' == '- op="<unlabeled span>": description=null\n  - op="db.redis": description="SET \'somekey1\' \'aaaaaaaaaaa..."\n  - op="db.redis": description="SET \'somekey2\' \'bbbbbbbbbb\'"'
E     - - op="<unlabeled span>": description=null
E     ?      ^^ - --- ---------
E     + - op=null: description=null
E     ?      ^
E         - op="db.redis": description="SET 'somekey1' 'aaaaaaaaaaa..."
E         - op="db.redis": description="SET 'somekey2' 'bbbbbbbbbb'"
tests.integrations.redis.test_redis::test_sensitive_data
Stack Traces | 0.079s run time
.../integrations/redis/test_redis.py:103: in test_sensitive_data
    assert (
E   assert '- op=null: description=null\n  - op="db.redis": description="GET [Filtered]"' == '- op="<unlabeled span>": description=null\n  - op="db.redis": description="GET [Filtered]"'
E     - - op="<unlabeled span>": description=null
E     ?      ^^ - --- ---------
E     + - op=null: description=null
E     ?      ^
E         - op="db.redis": description="GET [Filtered]"
tests.integrations.redis.test_redis_cache_module_async::test_cache_basic
Stack Traces | 0.079s run time
.../integrations/redis/test_redis_cache_module_async.py:64: in test_cache_basic
    assert (
E   assert '- op=null: description=null\n  - op="cache.get": description="myasynccachekey"\n    - op="db.redis": description="GET \'myasynccachekey\'"' == '- op="<unlabeled span>": description=null\n  - op="cache.get": description="myasynccachekey"\n    - op="db.redis": description="GET \'myasynccachekey\'"'
E     - - op="<unlabeled span>": description=null
E     ?      ^^ - --- ---------
E     + - op=null: description=null
E     ?      ^
E         - op="cache.get": description="myasynccachekey"
E           - op="db.redis": description="GET 'myasynccachekey'"

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

@sl0thentr0py sl0thentr0py force-pushed the neel/refactor-span-data branch 7 times, most recently from ef85b4a to 666b8ed Compare July 10, 2025 14:16
@sl0thentr0py sl0thentr0py changed the title Cleanup op, description and status mapping Cleanup op and descriiption mapping Jul 10, 2025
@sl0thentr0py sl0thentr0py force-pushed the neel/refactor-span-data branch 3 times, most recently from 3777d75 to 12c5914 Compare July 10, 2025 14:40
@@ -822,7 +822,7 @@ def test_clickhouse_dbapi_spans(sentry_init, capture_events, capture_envelopes)
span.pop("span_id", None)
span.pop("start_timestamp", None)
span.pop("timestamp", None)
span.pop("status")
span.pop("status", None)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these were all None before anyway

@sl0thentr0py sl0thentr0py force-pushed the neel/refactor-span-data branch from 12c5914 to e83681a Compare July 10, 2025 14:44
@sl0thentr0py sl0thentr0py changed the title Cleanup op and descriiption mapping Cleanup op and description mapping Jul 10, 2025
@sl0thentr0py sl0thentr0py force-pushed the neel/refactor-span-data branch from e83681a to b230b84 Compare July 10, 2025 14:56
assert len(transaction["spans"]) == 7

assert (
render_span_tree(transaction)
== f"""\
- op="caches": description=null
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here and in all subsequent tests, I made it clear that the transaction name is correct and that the op of the root span is not the transaction name anymore

@sl0thentr0py sl0thentr0py marked this pull request as ready for review July 10, 2025 15:05
@sl0thentr0py sl0thentr0py requested a review from a team as a code owner July 10, 2025 15:05
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