bestit / flagception-bundle

Feature flags on steroids!
MIT License
210 stars 42 forks source link

Symfony profiler doesn't show configured features #78

Open simcen opened 4 years ago

simcen commented 4 years ago

Hello,

We're running quite old Symfony 2.8.x based application. The symfony profiles shows "Features" section but not the configured features. However, I can actually work with them in the code.

Configuration in config.php:

$container->loadFromExtension('flagception', [
    'features' => [
        'feature_123' => [
            'default' => true,
        ],

        'feature_abc' => [
            'default' => false,
        ],
    ],
]);

--> can access feature manager, e.g. from a view with: $this->container->get('flagception.manager.feature_manager')->isActive('feature_123')

Any idea?

Debug container output:

# ./app/console debug:container --env=dev | grep -i flagception
  flagception.activator.array_activator                                                                  Flagception\Activator\ArrayActivator
  flagception.activator.constraint_activator                                                             Flagception\Activator\ConstraintActivator
  flagception.activator.environment_activator                                                            Flagception\Activator\EnvironmentActivator
  flagception.configurator.array_configurator                                                            Flagception\Bundle\FlagceptionBundle\DependencyInjection\Configurator\ArrayConfigurator
  flagception.configurator.constraint_configurator                                                       Flagception\Bundle\FlagceptionBundle\DependencyInjection\Configurator\ConstraintConfigurator
  flagception.configurator.contentful_configurator                                                       Flagception\Bundle\FlagceptionBundle\DependencyInjection\Configurator\ContentfulConfigurator
  flagception.configurator.cookie_configurator                                                           Flagception\Bundle\FlagceptionBundle\DependencyInjection\Configurator\CookieConfigurator
  flagception.configurator.database_configurator                                                         Flagception\Bundle\FlagceptionBundle\DependencyInjection\Configurator\DatabaseConfigurator
  flagception.configurator.environment_configurator                                                      Flagception\Bundle\FlagceptionBundle\DependencyInjection\Configurator\EnvironmentConfigurator
  flagception.listener.routing_metadata_subscriber                                                       Flagception\Bundle\FlagceptionBundle\Listener\RoutingMetadataSubscriber
  flagception.manager.feature_manager                                                                    Flagception\Manager\FeatureManager
  flagception\manager\featuremanagerinterface                                                            alias for "flagception.manager.feature_manager"
migo315 commented 4 years ago

Can you tell me which flagception bundle and flagception sdk version you are using?

In your debug container output, I'm missing the traceable chain activator. He is responsible for executing all activators and collect data for the profiler: https://github.com/bestit/flagception-bundle/blob/3.5.1/src/Activator/TraceableChainActivator.php

The traceable chain decorator should be injected normally: https://github.com/bestit/flagception-bundle/blob/3.5.1/src/Resources/config/services.yml#L5

simcen commented 4 years ago

"flagception/flagception-bundle" 3.5.1 and "flagception/flagception" 1.5.0

migo315 commented 4 years ago

Ah, perhaps there is a misunderstanding here. The profiler does not show the features that are configured, only those that are actually requested (by '->isActive' for example).

So if you call a page where no features are requested, then there will be no features in the profiler. Does that help you?