LiipMonitorBundle
                                
                                
                                
                                    LiipMonitorBundle copied to clipboard
                            
                            
                            
                        No route found - Using app with autoconfigure:true
Hi guys.
I'm using the configuration autoconfigure:true in my app, and the 'liip_monitor.check''check is being tagged automatically. When I' run the Health check page the check works fine, but, when i try repeat a individual custom check in the button GO the app receives the error below with route not found.
No route found for "POST http://localhost:8000/monitor/health/run/App/Diagnostics/Check/CustomCheck" (from "http://localhost:8000/monitor/health/")
My configurations:
config/services.yaml
services:
    # default configuration for services in *this* file
    _defaults:
        autowire: true      # Automatically injects dependencies in your services.
        autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
config/packages/monitor.yaml
liip_monitor:
    default_group: default
    enable_controller: true
config/routes/monitor.yaml
_monitor:
    resource: "@LiipMonitorBundle/Resources/config/routing.xml"
    prefix: /monitor/health
Custom check class
<?php
declare(strict_types=1);
namespace App\Diagnostics\Check;
use Laminas\Diagnostics\Check\CheckInterface;
use Laminas\Diagnostics\Result\Failure;
use Laminas\Diagnostics\Result\Success;
class CustomCheck implements CheckInterface
{
                                    
                                    
                                    
                                
Could you please help me if i'm missing some configuration?
Thank you.
Hi @igordeveloper, sorry for the delay - I've been on vacation.
Yes, you'll need to add an alias as it's trying to match the route on the class name.
Hi @igordeveloper, sorry for the delay - I've been on vacation.
Yes, you'll need to add an alias as it's trying to match the route on the class name.
Hi @kbond , no worries.
I add a alias as below, and now i have 2 entries 'Custom check' http://localhost:8000/monitor/health
    monitor.check.custom:
        class: App\Diagnostics\Check\CustomCheck
        arguments:
            - [ xhprof, apc, memcache ]
        tags:
            - { name: liip_monitor.check, alias: custom}
One of them gives an error because the route is created with 'monitor.check.mercure' and the another works.
Is there any other way to fix this, besides inserting autoconfigure: false for this service? Because my app's _defaults is set to true.
Thank you again!
Is there any other way to fix this, besides inserting autoconfigure: false for this service
I don't think so. Some work needs to be done with how checks are auto-configured.
Is there any other way to fix this, besides inserting autoconfigure: false for this service
I don't think so. Some work needs to be done with how checks are auto-configured.
Sorry, needs to be done in my configuration or bundle side?
Right now, you'll need to add autoconfigure: false to your config to avoid 2 instances being registered:
    monitor.check.custom:
        class: App\Diagnostics\Check\CustomCheck
        autoconfigure: false
        arguments:
            - [ xhprof, apc, memcache ]
        tags:
            - { name: liip_monitor.check, alias: custom}
The bundle needs some work to avoid needing this.
Right now, you'll need to add
autoconfigure: falseto your config to avoid 2 instances being registered:monitor.check.custom: class: App\Diagnostics\Check\CustomCheck autoconfigure: false arguments: - [ xhprof, apc, memcache ] tags: - { name: liip_monitor.check, alias: custom}The bundle needs some work to avoid needing this.
ok, perfect.
thank you for the help, right now, i'll use with autoconfigure:false .
Hi @kbond .
do you have a estimate for this work in the bundle? Can i help with a pull request suggest for this? thanks.
I'm not immediately seeing a great path to a solution. The following is true:
- It's valid for a check to have multiple 
liip_monitor.checktags (to add to multiple groups). - Some amount of users (myself included) don't care about the alias. We just want 
CheckInterface's auto added to the default group (and we don't use the api). 
Of course, I'm open to ideas but autoconfigure: false feels like the simplest solution to me.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed. Feel free to re-open if it is still relevant.