Skip to content

ref(otel): Use new scopes API#2865

Merged
sentrivana merged 5 commits into
sentry-sdk-2.0from
ivana/2.0/otel-new-scopes
Mar 28, 2024
Merged

ref(otel): Use new scopes API#2865
sentrivana merged 5 commits into
sentry-sdk-2.0from
ivana/2.0/otel-new-scopes

Conversation

@sentrivana

Copy link
Copy Markdown
Contributor

Speedrunning through the remaining integrations 🏃🏻‍♀️

Relates #2817


General Notes

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. Some tests (AWS Lambda) additionally require a maintainer to add a special label to run and will fail if the label is not present.

For maintainers

Sensitive test suites require maintainer review to ensure that tests do not compromise our secrets. This review must be repeated after any code revisions.

Before running sensitive test suites, please carefully check the PR. Then, apply the Trigger: tests using secrets label. The label will be removed after any code changes to enforce our policy requiring maintainers to review all code revisions before running sensitive tests.

@sentrivana
sentrivana force-pushed the ivana/2.0/otel-new-scopes branch from 9fc643b to 275f1d4 Compare March 25, 2024 16:21
@sentrivana
sentrivana marked this pull request as ready for review March 26, 2024 13:26
szokeasaurusrex added a commit that referenced this pull request Mar 28, 2024
Adds the instrumenter argument to sentry_sdk.start_transaction. Should unblock #2865.

@szokeasaurusrex szokeasaurusrex left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good mostly, please see the question I left

def on_start(self, otel_span, parent_context=None):
# type: (OTelSpan, Optional[SpanContext]) -> None
hub = Hub.current
if not hub:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does the dsn check make this check redundant? Trying to understand why we are removing this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What would be the post-hub world equivalent of this check? It seems to me like the purpose of the hub in this function was basically two things: accessing the client and making sure the client has a DSN, and using the hub directly when starting the Sentry span (which we don't want to do anymore in favor of using the top-level API).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As far as I remember those checks where here to just make sure we have a Sentry setup with and DSN where we can send data to.

So I think it is OK to remove the hub check and just check for a valid DSN further down.

@antonpirker antonpirker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good!

def on_start(self, otel_span, parent_context=None):
# type: (OTelSpan, Optional[SpanContext]) -> None
hub = Hub.current
if not hub:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As far as I remember those checks where here to just make sure we have a Sentry setup with and DSN where we can send data to.

So I think it is OK to remove the hub check and just check for a valid DSN further down.

@szokeasaurusrex szokeasaurusrex left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I also approve, thank you both for addressing my question

@sentrivana
sentrivana merged commit 66f530a into sentry-sdk-2.0 Mar 28, 2024
@sentrivana
sentrivana deleted the ivana/2.0/otel-new-scopes branch March 28, 2024 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants