Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[HttpKernel] Add Profiler::isEnabled() method#45265

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 0 commits intosymfony:6.1fromBilge:profiler-enabled
Feb 21, 2022

Conversation

@Bilge
Copy link
Contributor

QA
Branch?6.1
Bug fix?no
New feature?yes
Deprecations?no
Ticketsn/a
LicenseMIT
Doc PRsymfony/symfony-docs#...

When disabling the profiler programmatically, collectors will not be called, but any collaborating services that collect profiling data on behalf of those collectors will still do unnecessary work. By being able to inquire about whether the profiler is enabled, such services may elect to omit data collection thus reducing memory and CPU footprint.

Relates to#45241.

@carsonbotcarsonbot added this to the6.1 milestoneFeb 1, 2022
@BilgeBilgeforce-pushed theprofiler-enabled branch 2 times, most recently from2063db8 toc3b08e8CompareFebruary 1, 2022 10:08
@carsonbot
Copy link

Hey!

I think@mtarld has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

@GromNaN
Copy link
Member

GromNaN commentedFeb 2, 2022
edited
Loading

If I get it right, the "collaborating services" will depend on theprofiler service, which is not needed currently. Don't you get a circular depencency (profiler -> collector -> collaborating service -> profiler) ?

Alternative proposition : propagate status to the collectors whenProfiler::disable() is called.

@Bilge
Copy link
ContributorAuthor

Bilge commentedFeb 2, 2022 via email

This has nothing to do with collectors.
On Wed, 2 Feb 2022, 07:37 Jérôme Tamarelle, ***@***.***> wrote: If I get it right, the "collaborating services" will depends on the profiler service, which is not needed currently. You don't get a circular depencency (profiler -> collector -> collaborating service -> profiler) ? Alternative proposition : propagate status to the collectors when Profiler::disable() is called. — Reply to this email directly, view it on GitHub <#45265 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AADS4YQOR6R6E7HS77YZR6LUZDNLXANCNFSM5NIVTLCA> . Triage notifications on the go with GitHub Mobile for iOS <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>. You are receiving this because you authored the thread.Message ID: ***@***.***>

@GromNaN
Copy link
Member

This has nothing to do with collectors.

Well, could you describe your use-case a little more. What is a "collaborating service that collect profiling data on behalf of those collectors" ?

@Bilge
Copy link
ContributorAuthor

Bilge commentedFeb 2, 2022
edited by GromNaN
Loading

Sure. I wrote a database profiler similar to the one you know in Doctrine, but for theAmp drivers instead (see also:doctrine/DoctrineBundle#1464). The regular connection pool is decorated with a profiled pool; this is the collaborating service. This service is injected into the collector. When the profiler is disabled the collector will not be called, but the pool is still decorated and still collects data anyway, since it is unaware of the status of the profiler.

Copy link
Member

@GromNaNGromNaN left a comment
edited
Loading

Choose a reason for hiding this comment

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

Thanks for the details.
I have almost the same use-case and used%kernel.debug% to enable/disable collection of queries in the client decorator. Your solution is smarter.

Regarding circular dependency, the container builder is able to handle it.

@carsonbotcarsonbot changed the titleAdd Profiler::isEnabled() method[HttpKernel] Add Profiler::isEnabled() methodFeb 2, 2022
@SHTIKOV

This comment was marked as off-topic.

@Bilge
Copy link
ContributorAuthor

Can this be included in 5.4 somehow?

@fabpot
Copy link
Member

No, new features are always merged on the upcoming branch.

@fabpot
Copy link
Member

Thank you@Bilge.

@fabpotfabpot closed thisFeb 21, 2022
@fabpotfabpot merged commit0c1bf57 intosymfony:6.1Feb 21, 2022
@fabpotfabpot mentioned this pull requestApr 15, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@GromNaNGromNaNGromNaN approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

6.1

Development

Successfully merging this pull request may close these issues.

7 participants

@Bilge@carsonbot@GromNaN@SHTIKOV@fabpot@nicolas-grekas@derrabus

[8]ページ先頭

©2009-2025 Movatter.jp