File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,23 +29,25 @@ When a health check failed the HTTP Response status code will be 503. And the JS
2929 composer require openconext/monitor-bundle
3030 ```
3131
32- * Add the bundle to your kernel in ` app/AppKernel.php`
32+ * If you don' t use [Symfony Flex](https://symfony.com/doc/current/setup/flex.html), you must enable the bundle manually in the application:
33+
3334 ```php
34- public function registerBundles()
35- {
36- // ...
37- new OpenConext\M onitorBundle\O penConextMonitorBundle(),
38- }
39- ` ` `
35+ // config/bundles.php
36+ // in older Symfony apps, enable the bundle in app/AppKernel.php
37+ return [
38+ // ...
39+ OpenConext\MonitorBundle\OpenConextMonitorBundle::class => [' all' => true],
40+ ];
41+ ```
4042
41- * Include the routing configuration in ` app/ config/routing .yml` by adding:
43+ * Include the routing configuration in `config/routes .yml` by adding:
4244 ```yaml
43- openconext_monitor :
45+ open_conext_monitor :
4446 resource: "@OpenConextMonitorBundle/Resources/config/routing.yml"
4547 prefix: /
4648 ```
4749
48- * Add security exceptions in ` app/ config/security.yml` (if this is required at all)
50+ * Add security exceptions in `config/security.yml` (if this is required at all)
4951 ```yaml
5052 security:
5153 firewalls:
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ public function __construct(HealthCheckChain $healthChecker)
4040 $ this ->healthChecker = $ healthChecker ;
4141 }
4242
43- public function healthAction (): JsonResponse
43+ public function __invoke (): JsonResponse
4444 {
4545 $ statusResponse = $ this ->healthChecker ->check ();
4646
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ public function __construct(
6666 $ this ->debuggerEnabled = $ debuggerEnabled ;
6767 }
6868
69- public function infoAction (): JsonResponse
69+ public function __invoke (): JsonResponse
7070 {
7171 $ info = Information::buildFrom (
7272 BuildPathFactory::buildFrom ($ this ->buildPath ),
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ public function check(HealthReportInterface $report): HealthReportInterface
5555 $ table = reset ($ tables );
5656 // Perform a light-weight query on the chosen table
5757 $ query = 'SELECT * FROM `%s` LIMIT 1 ' ;
58- $ this ->entityManager ->getConnection ()->query (sprintf ($ query , $ table ->getName ()));
58+ $ this ->entityManager ->getConnection ()->executeQuery (sprintf ($ query , $ table ->getName ()));
5959 }
6060 } catch (Exception $ e ) {
6161 return HealthReport::buildStatusDown ('Unable to execute a query on the database. ' );
Original file line number Diff line number Diff line change @@ -2,10 +2,10 @@ monitor.info:
22 path : /info
33 methods : [GET]
44 defaults :
5- _controller : openconext.monitor.controller.info:infoAction
5+ _controller : openconext.monitor.controller.info
66
77monitor.health :
88 path : /health
99 methods : [GET]
1010 defaults :
11- _controller : openconext.monitor.controller.health:healthAction
11+ _controller : openconext.monitor.controller.health
Original file line number Diff line number Diff line change @@ -6,14 +6,15 @@ services:
66 - ' %kernel.environment%'
77 - ' %kernel.debug%'
88 public : true
9- tags : ['controller.service_arguments']
9+ autowire : true
10+ tags : ['controller.service_arguments', 'container.service_subscriber']
1011
1112 openconext.monitor.controller.health :
1213 class : OpenConext\MonitorBundle\Controller\HealthController
1314 arguments :
1415 - ' @openconext.monitor.health_check_chain'
1516 public : true
16- tags : ['controller.service_arguments']
17+ tags : ['controller.service_arguments', 'container.service_subscriber' ]
1718
1819 openconext.monitor.health_check_chain :
1920 class : OpenConext\MonitorBundle\HealthCheck\HealthCheckChain
You can’t perform that action at this time.
0 commit comments