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

Skip to content

Extract the profiler to a new component #14763

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

Closed
wants to merge 5 commits into from
Closed

Conversation

jelte
Copy link

@jelte jelte commented May 27, 2015

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? yes
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR not use how to handle documentation

This pull request is a replacement for #10374

This pull request extracts the HTTP profiler from the HttpKernel component to a new dedicated component: Profiler.

The goals are to improve the general architecture and usability of the component as stated by @webmozart ( #10374 (comment) )
as it stands now no BC is broken as the original DataCollectors are still supported by the new Profiler.

New DataCollectors and Profiler no longer require a Request.
DataCollectors are should be able to collect data from other sources, which will prevent some ugly hacks that were previously required, they will still require to listen to events to collect the data, I don't see a way around this, but this doesn't seem a big issue.

If a DataCollector requires the Request, it should have the RequestStack and get it from there, the Responses can be added just like Controllers are added, by subscribing to the Kernel Events.

$httpProfiler = new HttpProfiler($requestStack, $storageInterface);
$httpProfiler->addCollector(new RequestDataCollector($requestStack));
$httpProfiler->addCollector(new ExceptionDataCollector());
$httpProfiler->addCollector(new FormDataCollector());

// Runtime data is collected
$profile = $httpProfiler->collect();

$requestData = $profile->get('request');

// Late data is collected
$httpProfiler->save($profile);

Ideas

  • rename Profiler::collect() to Profiler::profile() or other name that makes slightly more sense. (+ would help on BC)
  • provide ConsoleProfiler, will require some interface changes to the WebProfiler or a console version

Todo's

  • gather feedback for my changes
  • add additional tests to increase coverage.
  • add README.md
  • submit changes to the documentation

hason and others added 4 commits May 17, 2015 04:16
This PR was submitted for the 2.7 branch but it was merged into the 2.8 branch instead (closes symfony#13324).

Discussion
----------

[WebProfilerBundle] Improved page for logs

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

*Before*
![logs-before](https://cloud.githubusercontent.com/assets/288535/5661713/3942c530-972f-11e4-89cb-2e185a6d07ac.png)
*After*
![logs-after](https://cloud.githubusercontent.com/assets/288535/5661681/d02b50da-972e-11e4-96e8-0572428ba82f.png)

Commits
-------

5fdc650 [WebProfilerBundle] Improved page for logs
This PR was squashed before being merged into the 2.8 branch (closes symfony#14403).

Discussion
----------

[Form] deprecate read_only option

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | symfony#10658
| License       | MIT
| Doc PR        | symfony/symfony-docs#3782

Replaces symfony#10676 with a slightly different implementation.
- fixes BC break when 'read_only' => true option and at the same time custom attributes are used by using a normalizer
- adds deprecation notice
- keeps legacy tests

Commits
-------

53330e1 [Form] deprecate read_only option
@stof
Copy link
Member

stof commented May 27, 2015

Can this be implemented in 2.8 with a BC layer instead of being in master ? We tend to avoid doing refactorings directly in 3.0 as it makes the upgrade harder (no grace periode thanks to deprecations)

class MemoryData implements ProfileDataInterface
{

protected $memory;
Copy link
Member

Choose a reason for hiding this comment

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

please use the private visibility everywhere. We always make things private by default as it makes the maintenance much easier (everything protected involves some BC concern as it becomes an extension point)

@stof
Copy link
Member

stof commented May 28, 2015

@jelte what about my previous question ?

@jelte
Copy link
Author

jelte commented May 28, 2015

Will need to make a new pull request for that, which I will make later today.
just checking some potential BC issues and processing @dosten 's feedback.

@@ -20,8 +21,9 @@
* @author Fabien Potencier <[email protected]>
*
* @api
* @deprecated since x.x, to be removed in x.x. Use Symfony\Component\Profiler\DataCollector\DataCollectorInterface instead.
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing space between tags

@jelte
Copy link
Author

jelte commented May 29, 2015

Creating new one based on 2.8

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.

7 participants