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

Log profiling duration to file #9458

Closed
mikehaertl opened this issue Aug 18, 2015 · 6 comments
Closed

Log profiling duration to file #9458

mikehaertl opened this issue Aug 18, 2015 · 6 comments

Comments

@mikehaertl
Copy link
Contributor

Currently the profiling result is not logged to file (or at least I couldn't figure out how to do that). All I get in my logfiles is something like:

2015-08-18 12:07:06 [-][-][-][profile begin][app\export\shop\BaseUpdate::update] Update prices
2015-08-18 12:07:06 [-][-][-][profile end][app\export\shop\BaseUpdate::update] Update prices

So it's missing the actual profiling information about duration.

@cronfy
Copy link
Contributor

cronfy commented Feb 24, 2017

What about imlementing this feature?

Indeed, currently there is no way of profiling database queries and other stuff. There is just no enough information. E. g. for database queries, if we enable profile logging, we can see number of queries and queries itself, but we can't find out how much time it was taken to execute a query.

What prevents #10045 from merging?

@samdark samdark modified the milestones: 2.0.12, 2.0.x Feb 24, 2017
@samdark
Copy link
Member

samdark commented Feb 24, 2017

@cronfy seems I've somehow missed it. Will review for next release.

@cronfy
Copy link
Contributor

cronfy commented Feb 24, 2017

@samdark What if use another approach here?

  1. Create separate yii\base\Profiler class with begin() and end() methods (copy beginProfile() and endProfile() from BaseYii).
  2. Make profiler a core component.
  3. Replace BaseYii::beginProfile() contents with Yii::$app->profiler->begin($token, $category), and same with BaseYii::endProfile().

Then everyone will be able to replace profiler with his own implementation. This gives a starting point to solve all "profiler does not work as I need" issues (#8112, #7617, #9458, http://stackoverflow.com/questions/30711195/how-to-profile-a-yii2-based-api/30717856).

@samdark
Copy link
Member

samdark commented Feb 24, 2017

@cronfy sounds like a good plan.

@klimov-paul
Copy link
Member

Then everyone will be able to replace profiler with his own implementation.

It is already possible to replace standard Logger with your own implementation. What the sense of introduction of another abstraction layer here?

@samdark samdark modified the milestones: 2.0.13, 2.0.12 Apr 20, 2017
@klimov-paul
Copy link
Member

Resolved via #14611

@klimov-paul klimov-paul modified the milestones: 2.1.0, 2.0.13 Aug 31, 2017
@klimov-paul klimov-paul removed the status:ready for adoption Feel free to implement this issue. label Aug 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants