PHP code example of cboxdk / laravel-telemetry

1. Go to this page and download the library: Download cboxdk/laravel-telemetry library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cboxdk / laravel-telemetry example snippets


Telemetry::counter('orders.created')->inc();
Telemetry::gauge('queue.depth', fn () => Queue::size());
Telemetry::histogram('checkout.duration', unit: 'ms')->record($ms);

Telemetry::span('import.customers', function () {
    // traced work — exceptions recorded, duration measured
});

Telemetry::event('autoscale.decision', ['workers' => 7]);

Schedule::command('telemetry:flush')->everyMinute()->onOneServer();

if (class_exists(\Cbox\Telemetry\Facades\Telemetry::class)) {
    Telemetry::provider(new QueueMetricsProvider);
}