-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Display orphaned events in profiler #24392
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
Conversation
|
The BC break should be removed, as we have a policy of not doing hard BC break: any future BC break needs to be announced with a runtime deprecation notice in 3.4. Which makes me wonder BTW: do we need TraceableEventDispatcherInterface at all? Is it really something we want ppl to be able to implement on their own? If no, then let's just deprecate it. |
|
I think we could deprecate the interface |
| // THEN | ||
| $this->assertEmpty($events); | ||
|
|
||
| // SCENARIO - Returns orphaned event |
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.
different scenarios should be different tests (so that a failure in the first oen does not prevent others from running)
|
@stof @nicolas-grekas |
|
Moving to 4.1. Rebase on master might be needed, where PHP 7.1 features can be used btw. |
ed8fa01 to
5fdb763
Compare
|
Rebased, updated changelogs and |
|
@stof could you check updated code? Tests failure looks unrelated. |
| public function lateCollect() | ||
| { | ||
| if ($this->dispatcher instanceof TraceableEventDispatcherInterface) { | ||
| if ($this->dispatcher instanceof TraceableEventDispatcher) { |
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.
wanted? What about an additional instanceof check before calling setOrphanedEvents.
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.
Good question.
I went this way because TraceableEventDispatcherInterface gets depracted anyway.
@nicolas-grekas, what do you think?
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.
Legacy code should continue to work
|
|
||
| private function preProcess($eventName) | ||
| { | ||
| if (false === $this->dispatcher->hasListeners($eventName)) { |
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->dispatcher->has...
| private function preProcess($eventName) | ||
| { | ||
| if (false === $this->dispatcher->hasListeners($eventName)) { | ||
| $this->orphanedEvents[] = $eventName; |
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.
return; here
| } | ||
|
|
||
| /** | ||
| * Gets the called listeners. |
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.
the diff is kinda messy... cant we avoid it by simply appending set+get (which seem to be the pattern anyway).
|
Thanks @ro0NL for review. |
ro0NL
left a comment
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 👍
| /** | ||
| * Sets the not called listeners. | ||
| * | ||
| * @param array $listeners An array of not called listeners |
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 seems useless
| /** | ||
| * Sets the orphaned events. | ||
| * | ||
| * @param array $events An array of orphaned events |
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 seems useless too
Simperfit
left a comment
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.
left 2 minor comments but LGTM
09a0fa1 to
e18f77c
Compare
|
rebased |
|
deprecations will have to be documented in the |
e18f77c to
fb16cfa
Compare
|
Rebased, deprecations documented in |
UPGRADE-4.1.md
Outdated
| UPGRADE FROM 4.0 to 4.1 | ||
| ======================= | ||
|
|
||
| Event Dispatcher |
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.
EventDispatcher (that's the name of the component :))
UPGRADE-4.1.md
Outdated
| ======================= | ||
|
|
||
| Event Dispatcher | ||
| ----------- |
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.
please use as many dashes as the length of the component's name
…roduced interface deprecation
fb16cfa to
e53b7f3
Compare
|
Thanks @xabbuh, I wasn't aware of that. Rebased and corrected. |
|
Thank you @kejwmen. |
This PR was squashed before being merged into the 4.1-dev branch (closes symfony#24392). Discussion ---------- Display orphaned events in profiler | Q | A | ------------- | --- | Branch? | 4.1 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | symfony#24347 | License | MIT Implements symfony#24347. Deprecating `TraceableEventDispatcherInterface`. Commits ------- 509f9a9 Display orphaned events in profiler
…ont) This PR was merged into the 4.1 branch. Discussion ---------- [EventDispatcher] Clear orphaned events on reset | Q | A | ------------- | --- | Branch? | 4.1 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | NA | License | MIT | Doc PR | NA When the Orphaned Events feature was added in #24392 it was forgotten to also clear them when the `reset` method on the `TraceableEventDispatcher` is called. This makes the Orphaned Events tab on the Event profiler an evergrowing list when using PHP-PM (or other event loop implementations). Commits ------- d3260df [EventDispatcher] Clear orphaned events on TraceableEventDispatcher::reset
Implements #24347.
Deprecating
TraceableEventDispatcherInterface.