artprima / prometheus-metrics-bundle

Symfony 5/6 Prometheus Metrics Bundle
MIT License
133 stars 29 forks source link

Add command to clear metrics #33

Closed slappyslap closed 3 years ago

slappyslap commented 3 years ago

All is in the title, you can add a command to clear metrics (for exemple after some performance testing)

wuestkamp commented 3 years ago

+1

denisvmedia commented 3 years ago

I agree that we need it. Unfortunately, I don't have enough time at the moment to provide us with the quality solution. And I don't know when I will have. So, if there is any volunteer to do that, the PR would be more than appreciated.

denisvmedia commented 3 years ago

So, I checked it. It actually is already possible, see this test code:

        /** @var Adapter $adapter */
        $adapter = self::$container->get('prometheus_metrics_bundle.adapter');

        // [ .... skipped .... ]

        // wipe storage
        $adapter->wipeStorage();

So, you can inject @prometheus_metrics_bundle.adapter service to your code and call its wipeStorage method when you need.