Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Decoupled TraceableEventDispatcher from the Profiler #9170

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

Merged
merged 2 commits into from
Sep 30, 2013

Conversation

fabpot
Copy link
Member

@fabpot fabpot commented Sep 30, 2013

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR n/a

This PR removes the Profiler dependency on the TraceableEventDispatcher. That makes things more decoupled and cleaner. This PR also cleans up how profiles are stored; a Profile is now always stored only once.

I've created a LateDataCollectorInterface that is implemented for data collector that needs to get information from data that are available very late in the request process (when the request and the response are not even available anymore). The lateCollect() method is called just before the profile is stored.

We have 3 data collectors that implement that interface:

  • Time: As the traceable event dipsatcher gets inject timing information via the stopwatch about all events (including the terminate one), we need to get events from the stopwatch as late as possible.
  • Event: The traceable event dispatcher gathers all called listeners to determine non-called ones. To be able to accurately do that for all events (including the terminate one), we need to get the data as late as possible.
  • Memory: We want to get the memory as late as possible to get the most accurate number as possible

I'm not very happy with the name and as always, better suggestions would be much appreciated.

This is an extract from #9168

@stof
Copy link
Member

stof commented Sep 30, 2013

@fabpot you are still integrating the change of the event dispatcher here. I think you messed your rebasing

@stof
Copy link
Member

stof commented Sep 30, 2013

As said in the other PR, the logger collector should be a late one too, to avoid missing some log messages

@fabpot
Copy link
Member Author

fabpot commented Sep 30, 2013

@stof fixed the rebasing and updated the logger data collector.

@fabpot fabpot merged commit 5cedea2 into symfony:master Sep 30, 2013
fabpot added a commit that referenced this pull request Oct 28, 2013
… is used everywhere (fabpot)

This PR was merged into the master branch.

Discussion
----------

[FrameworkBundle] made sure that the debug event dispatcher is used everywhere

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #6686, #7673
| License       | MIT
| Doc PR        | n/a

The removal of the Profiler dependency on the TraceableEventDispatcher (#9170) allows to remerge the patch from #9068 that fixes #6686.

This PR also cleans up how profiles are stored. A Profile is now always stored only once.

The fix will only be available on 2.4+ as the changes are too deep to be backported to 2.2 and 2.3.

Commits
-------

1e1835e [FrameworkBundle] made sure that the debug event dispatcher is used everywhere
// forces collectors to become "read/only" (they loose their object dependencies)
$profile->addCollector(unserialize(serialize($collector)));
// we need to clone for sub-requests
$profile->addCollector(clone $collector);
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this change was a long time ago, but I was just curious if you remembered why this change was needed. Just took a dive into profiling the profiler and it seems like a large amount of time is spent here, wondering what broke to cause this change.

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.

4 participants