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

Implement local scope, which is a method parameter for the capture methods #1829

Closed
marandaneto opened this issue Dec 6, 2021 · 8 comments · Fixed by #2084
Closed

Implement local scope, which is a method parameter for the capture methods #1829

marandaneto opened this issue Dec 6, 2021 · 8 comments · Fixed by #2084
Assignees
Labels
enhancement New feature or request Platform: Java
Milestone

Comments

@marandaneto
Copy link
Contributor

Similar to Dart/Flutter https://github.com/getsentry/sentry-dart/pull/463/files

@bruno-garcia
Copy link
Member

Recently added in .NET: getsentry/sentry-dotnet#1412

@adinauer
Copy link
Member

Planning not to change .withScope at all. These new overloads should implement the local scope concept so the scope can be changed for one invocation only without affecting others especially in global hub mode.

Only planning to add overloads to

  • captureMessage
  • captureException
  • captureEvent

@adinauer
Copy link
Member

adinauer commented Jun 1, 2022

@bruno-garcia @marandaneto should we deprecate withScope as this is basically the less bug prone version of it? It's been removed in .NET. It's still there in .NET, however the docs claim that withScope does what the local scope does which is not true in all circumstances (the scope is pushed, modified, callback run and only after that it is reset back again so any call running at the same time would have the modified scope as well).

@marandaneto
Copy link
Contributor Author

https://develop.sentry.dev/sdk/unified-api/
Hub::with_scope(callback) is technically optional, but not deprecated, I'm fine deprecating it tho, let's see what @bruno-garcia says.

@adinauer
Copy link
Member

adinauer commented Jun 2, 2022

I don't see an easy way to fix it as we'd have to pass the Hub to the callback and devs would need to use that instead of Sentry.capture etc. So even if we did that it could still be a source of bugs / wrong info.

@marandaneto
Copy link
Contributor Author

I don't see an easy way to fix it as we'd have to pass the Hub to the callback and devs would need to use that instead of Sentry.capture etc. So even if we did that it could still be a source of bugs / wrong info.

Not sure I've understood the problem here, do you mind elaborating?

Do we want this part of v6?

@marandaneto marandaneto added this to the 7.0.0 milestone Jun 7, 2022
@marandaneto
Copy link
Contributor Author

I've discussed this with @bruno-garcia and this will go to v7 to unblock v6.

@adinauer
Copy link
Member

adinauer commented Jun 7, 2022

Let's deprecate it in v6 and remove with v7. I've opened an issue here #2083

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Platform: Java
Projects
Archived in project
4 participants