-
-
Notifications
You must be signed in to change notification settings - Fork 450
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
[2.0] Implement the Scope and Hub of the unified API #679
Conversation
When talking about That's why we went with the approach to remove this "magic" payload parameter and introduced If someone wants to change
|
Yes, I indeed meant
Even though I understand that exposing all the getters/setter of the event on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a grea PR! Great work with the tests too!
I've commented a few things here and there, but nothing major...
@ste93cry The basic idea is that the use case for Sentry.withScope(function($scope) {
$scope->setLevel(Severity::debug());
Sentry.captureMessage("test");
}); vs. Sentry.captureMessage("test", Severity::debug()); In general, we want that the simplest use case of the SDK doesn't need any deep knowledge about Sentry at all. That's why we removed all the There is The idea of the unified API is to abstract away the complexity of the Client and the Event behind the Hub / Scope. |
Imho soon or later someone will start asking why on the scope there are some methods and not others... Also the API doesn't provide any way except having to use an event processor to remove a tag or any data from the contexts exposed by the scope. It seems to me that the API aims to be simple and this is good, but half of the things can be set in some way and the other half can't. As a user my first question would be on what basis those methods were chosen and not others. |
bdc7dcb
to
76984fa
Compare
@ste93cry So we decided on the public API what we think would be the most common use case for >90% of people using Sentry. Just to elaborate on the advantages of small public API again: While we still wanted to maintain great flexibility if your usage of our SDK isn't the norm, it's fine, we want users to have ways around our limited public API but we will not deliver guarantees that the internal will work like this in a future version of our SDK. The Public API we deliver is a contract we tend to keep, but if we someday decide for example to completely drop the OS Context (not that we actually want to do this) from the event and people where using Ultimately it's about the smaller the public documented API the less maintenance we have to do. |
@HazAT we should probably state this (maybe concisely) on the README to clarify what's covered and considered as public API, in relation to BC and semantic versioning then. |
cb04813
to
462cf21
Compare
462cf21
to
0d2ead0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work so far, there are a few minor things but we will change them in the upcoming PRs. 🥇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
I have added a few questions, but non are blockers for the merge.
f3050e7
to
414afdf
Compare
414afdf
to
30fb3d2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only one minor PHPDoc fix, LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid PR, there are some minor things we iron out in the PRs to come, no blocker.
This PR aims at providing the Scope and Hub features of the unified SDK API. It's based on the work of @HazAT and improves it by adding all the needed docblocks and refactoring the code while improving at the same time the unit tests. There are a few inconsistencies of the API which I would like to discuss before merging:
capture*
methods of theScope
do not follow the same pattern for the function definition: some let you set the severity level of the event, others don't. Also there is no way to pass a customized payload to the client (see theClient::capture*
methods to understand what I'm referring to)Scope
class does not allows to set data on all contexts: runtime and server OS contexts are missing. Also the API of the scope doesn't expose the underlying context object which means that the methods developed to easy the management of the context data are not available to the end user.Hub::applyToEvent
method behaves differently from data to data being merged into the event. As an example, the breadcrumbs are not merged with the existing ones but the severity level always override the one set in the event. Why?