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

Update integrations with new continue_trace callback usage #3486

Merged
merged 2 commits into from
Sep 2, 2024

Conversation

sl0thentr0py
Copy link
Member

  • aiohttp
  • asgi
  • aws_lambda
  • celery
  • gcp
  • huey
  • rq
  • sanic - this uses manual enter/exit on the contextmanager so we'll have to test properly
  • tornado
  • ray

closes #3484

* aiohttp
* asgi
* aws_lambda
* celery
* gcp
* huey
* rq
* sanic - this uses manual enter/exit on the contextmanager so we'll
  have to test properly
* tornado
* ray
Copy link

codecov bot commented Aug 30, 2024

❌ 3774 Tests Failed:

Tests completed Failed Passed Skipped
16709 3774 12935 1916
View the top 3 failed tests by shortest run time
tests.integrations.celery.test_celery test_producer_span_data[redis]
Stack Traces | 0s run time
No failure message available
tests.integrations.celery.test_celery test_traces_sampler_gets_task_info_in_sampling_context[<lambda>2]
Stack Traces | 0s run time
No failure message available
tests.integrations.celery.test_celery test_transaction_events[<lambda>1-error]
Stack Traces | 0s run time
No failure message available

To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard

Copy link
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

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

See one comment, else lgtm

"[ASGI] Created transaction (continuing trace): %s",
transaction,
)
else:
Copy link
Contributor

Choose a reason for hiding this comment

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

We're removing this else logic for non-http and non-websocket scope types, was this intentional? I'm not sure why it was there in the first place (maybe future proofing for new asgi scope types?), but it seems deliberate

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok this is why: 44c43a8 Apparently fetching headers might be problematic for other scope types. So we should probably keep this

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks for digging, made the accessor safe to avoid the if
02efbe6

Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

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

I am still very much unconvinced that the breaking change to continue_trace which necessitates these changes is a good idea.

I would like to revisit the continue_trace changes (#3460) and reach a consensus in the team that making this breaking change is truly necessary before we go updating usages everywhere.

Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

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

During an offline discussion the team agreed that #3460 makes sense even independent of the POTel project, since the API is clearer and easier to understand.

In the new API, continue_trace has the responsibility of setting propagation context from the remote span (linking the trace together), and start_span has the responsibility of actually creating and starting the span. In the old API, these responsibilities were confused with each other. We find that breaking the old API in order to get the more understandable new API is worth it.

Given this clarification, I am dropping my objections.

Comment on lines +115 to +116
with sentry_sdk.continue_trace(headers):
with sentry_sdk.start_transaction(
Copy link
Member

Choose a reason for hiding this comment

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

I wonder whether it might make sense to introduce a new convenience function that would continue the trace and start a span in one call, so that these two with context managers could be combined into a single with continue_trace_start_span (perhaps with better naming) statement.

@sl0thentr0py sl0thentr0py merged commit 245195e into potel-base Sep 2, 2024
9 of 108 checks passed
@sl0thentr0py sl0thentr0py deleted the neel/potel/continue-trace-integrations branch September 2, 2024 14:01
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.

3 participants