If you are using Tolerance’s operation runners you can decorate them with some additional operation runner that will publish some metrics. It’s an easy way to collect metrics from your application with almost no effort.
This operation runner will increment a :
.failure and a :
.success metric at every run. You can therefore
count the number of ran operation as well as their status.
1 2 3 4 5 6 7
use Tolerance\Operation\Runner\Metrics\SuccessFailurePublisherOperationRunner; $runner = new SuccessFailurePublisherOperationRunner( $decoratedRunner, $metricPublisher, 'metric_namespace' );
You can also uses Symfony’s bridge to create and use this runner without any PHP code.