-
-
Notifications
You must be signed in to change notification settings - Fork 21
Integration with the profiler #13
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
5fdb3ef
to
a859ec8
Compare
|
||
if ($config['enable_profiler']) { | ||
$container->register('data_collector.mercure', MercureDataCollector::class) | ||
->setArguments([$publishers, $hubUrls]) |
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.
Maybe that a map hubUrl[publisher]
would be better and less error prone? Or the hub URL could be injected in TraceablePublisher
's constructor and then retrieved using a getter?
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.
I didn't want to inject the hub Url in the TraceablePublisher because the url is only required by the WebProfiler view on this bundle, not on the lib.
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.
Otherwise, we could remove the $hubUrls
argument, as it's only used to display the hub url on the profiler. I don't find it so useful cause most of the time the user already know the hub url cause he configured it ^^
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.
Actually it could be useful for other use cases too to be able to access the hub URL. IMHO it fits well in the lib too.
} | ||
|
||
if ($config['enable_profiler']) { | ||
$container->register('data_collector.mercure', MercureDataCollector::class) |
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 definition should be in the XML file and then removed here if $config['enable_profiler']
is false. Doing this allows to have autocompletion in PHPStorm and the like.
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.
To do so, I'll need to tag the publisher services and handle them through a CompilerPass to inject them in the MercureDataCollector, and manage the hub url too...
Isn't there an easier way to handle that?
} | ||
|
||
if ($config['enable_profiler']) { | ||
$container->register('data_collector.mercure', MercureDataCollector::class) |
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.
$container->register('data_collector.mercure', MercureDataCollector::class) | |
$container->register('mercure.data_collector', MercureDataCollector::class) |
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.
data_collector.<name>
was to respect the same naming convention used by symfony/framework-bundle about DataCollectors: https://github.com/symfony/framework-bundle/blob/master/Resources/config/collectors.xml
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.
Yes because it's in FWBundle, but here as we aren't in FWBundle, we shouldn't "pollute" the global namespace and put every services under the mercure.
key.
…filer option (vincentchalamon) This PR was submitted for the master branch but it was squashed and merged into the 4.3 branch instead (closes #12598). Discussion ---------- Update documentation for MercureBundle: add enable_profiler option Related feature: symfony/mercure-bundle#13  Commits ------- 3705dae Update documentation for MercureBundle: add enable_profiler option
Menu icon
Panel
TODO
symfony/mercure
dependency (waiting for Add TraceablePublisher mercure#15)enable_profiler
configuration option: Add enable_profiler option on mercure-bundle recipes#667