artprima / prometheus-metrics-bundle

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

Possibility to ban all routes and enable one by one #9

Closed franciscosantamaria closed 3 years ago

franciscosantamaria commented 4 years ago

Hi, I have one question related to this bundle:

One first approach is adding 2 new optional parameters in the _prometheusmetrics.yaml file:

What do you think? If you agree, I can try to code this feature and create a PR.

PS: Can I do this without any change in the bundle and avoid to add a full list of my application routes, to just metric only one or two routes?

BTW thank you for your free time spent it in this bundle.

denisvmedia commented 4 years ago

Thanks for your proposal @franciscosantamaria , it totally makes sense. And yeah, currently, it's not possible in the bundle. The only solution now is to override the RequestCounterListener service. However, it's a bit hacky.

A whitelist strategy can be easily added in addition to a blacklist strategy that we already have. If you are fine with providing a PR, I would happily accept it :) So, I propose this behavior in order not to break the code that already relies on the current one:

What do you think? If you agree, I'd be happy to see a PR :) If not, let's discuss it further.