3slab/tweedegolf-prometheus-bundle
Symfony bundle integrating the Tweede Golf Prometheus client. Configure a /metrics endpoint, choose a storage adapter, and define counters/gauges/histograms via YAML collectors. Update metrics through the CollectorRegistry service in your app.
url for request tracking), which is valuable for distributed tracing but may be overkill for lightweight Laravel apps.tweedegolf/prometheus-client (v0.2.3, 2018), which is abandoned and lacks Laravel compatibility. The client’s API may not align with Laravel’s PSR-11 container or event-driven architecture.config/ system supports YAML, but the bundle’s hardcoded Symfony assumptions (e.g., AppKernel) may conflict./metrics endpoint by default, which is standard for Prometheus but requires:
Monolog handlers).response_timing) require bucket calculations, which may slow down high-traffic endpoints.spatie/laravel-prometheus)?/metrics endpoint be secured (e.g., basic auth, firewall rules)?AppKernel, CollectorRegistry service). A wrapper layer is required to:
Route::get() or API resources).config.yml to Laravel’s config/prometheus.php.spatie/laravel-prometheus or prometheus/client_php.Prometheus::counter('requests')->inc()) to hide Symfony-specific code.// app/Facades/Prometheus.php
namespace App\Facades;
use Illuminate\Support\Facades\Facade;
class Prometheus extends Facade { protected static function getAccessor() { return 'prometheus'; } }
config/app.php:
'prometheus' => function ($app) {
return new \TweedeGolf\PrometheusBundle\PrometheusService($app);
},
config/prometheus.php:
'collectors' => [
'requests' => [
'type' => 'counter',
'labels' => ['url'],
'help' => 'Number of requests',
],
],
// app/Providers/PrometheusServiceProvider.php
public function register() {
$this->app->register(\TweedeGolf\PrometheusBundle\TweedeGolfPrometheusBundle::class);
}
/metrics route in routes/web.php:
Route::get('/metrics', [\TweedeGolf\PrometheusBundle\Controller\MetricsController::class, 'metrics']);
Route::middleware(['throttle:60,1'])->get('/metrics', ...);
symfony/dependency-injection, symfony/http-kernel, etc. These can be polyfilled but may add bloat.predis/predis as a drop-in replacement.curl http://laravel.test/metrics).alert if error_rate > 0.1).tweedegolf/prometheus-client for vulnerabilities.dd() or Xdebug for Symfony-specific classes.tweedegolf/prometheus-client makes migration to other clients difficult.How can I help you explore Laravel packages today?