-
Notifications
You must be signed in to change notification settings - Fork 548
Make sure op/name/description are set correctly on transactions/spans #3519
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
Merged
antonpirker
merged 6 commits into
potel-base
from
antonpirker/python/potel/fix-op-extraction
Sep 12, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9c41e81
Make sure op/name/description are set correctly on transactions/spans
antonpirker 4fac8a2
added missing file
antonpirker 0f7f750
formatting
antonpirker f458d15
wording
antonpirker 1f3647b
Merge branch 'potel-base' into antonpirker/python/potel/fix-op-extrac…
antonpirker 67e191a
Add deprecation warning for now
antonpirker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import sentry_sdk | ||
|
||
|
||
def test_transaction_name_span_description_compat( | ||
sentry_init, | ||
capture_events, | ||
): | ||
sentry_init(traces_sample_rate=1.0) | ||
|
||
events = capture_events() | ||
|
||
with sentry_sdk.start_transaction( | ||
name="trx-name", | ||
op="trx-op", | ||
) as trx: | ||
with sentry_sdk.start_span( | ||
description="span-desc", | ||
op="span-op", | ||
) as spn: | ||
... | ||
|
||
assert trx.__class__.__name__ == "POTelSpan" | ||
assert trx.op == "trx-op" | ||
assert trx.name == "trx-name" | ||
assert trx.description is None | ||
|
||
assert trx._otel_span is not None | ||
assert trx._otel_span.name == "trx-name" | ||
assert trx._otel_span.attributes["sentry.op"] == "trx-op" | ||
assert trx._otel_span.attributes["sentry.name"] == "trx-name" | ||
assert "sentry.description" not in trx._otel_span.attributes | ||
|
||
assert spn.__class__.__name__ == "POTelSpan" | ||
assert spn.op == "span-op" | ||
assert spn.description == "span-desc" | ||
assert spn.name is None | ||
|
||
assert spn._otel_span is not None | ||
assert spn._otel_span.name == "span-desc" | ||
assert spn._otel_span.attributes["sentry.op"] == "span-op" | ||
assert spn._otel_span.attributes["sentry.description"] == "span-desc" | ||
assert "sentry.name" not in spn._otel_span.attributes | ||
|
||
transaction = events[0] | ||
assert transaction["transaction"] == "trx-name" | ||
assert transaction["contexts"]["trace"]["op"] == "trx-op" | ||
assert transaction["contexts"]["trace"]["data"]["sentry.op"] == "trx-op" | ||
assert transaction["contexts"]["trace"]["data"]["sentry.name"] == "trx-name" | ||
assert "sentry.description" not in transaction["contexts"]["trace"]["data"] | ||
|
||
span = transaction["spans"][0] | ||
assert span["description"] == "span-desc" | ||
assert span["op"] == "span-op" | ||
assert span["data"]["sentry.op"] == "span-op" | ||
assert span["data"]["sentry.description"] == "span-desc" | ||
assert "sentry.name" not in span["data"] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.