Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Prometheus Laravel Package

spatie/laravel-prometheus

Export Laravel app metrics to Prometheus via a /prometheus endpoint. Register custom gauges and counters in code, with built-in metrics for queues and Horizon. Includes optional security so your metrics aren’t publicly exposed; pair with Grafana for dashboards.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Observability Roadmap: Enables real-time monitoring of Laravel application metrics (e.g., queue jobs, user counts, API response times) for proactive issue detection and performance optimization.
  • Build vs. Buy: Buy—avoids reinventing Prometheus integration, leveraging Spatie’s battle-tested, Laravel-native solution with built-in security and Grafana compatibility.
  • Use Cases:
    • DevOps/Engineering: Track queue job failures (Horizon/vanilla queues), API latency, and custom business metrics (e.g., active_users, failed_payments).
    • SRE/Incident Response: Alert on anomalies (e.g., queue_jobs_pending > 1000) via Prometheus/Grafana dashboards.
    • Product Analytics: Monitor feature adoption (e.g., feature_x_usage) without modifying core analytics tools.
  • Cost Efficiency: Reduces cloud monitoring costs by replacing vendor-specific tools (e.g., Datadog) with self-hosted Prometheus for high-cardinality metrics.

When to Consider This Package

  • Adopt if:
    • Your Laravel app uses queues (Horizon/vanilla) or needs custom metric tracking (e.g., database queries, API calls).
    • You’re already using Prometheus/Grafana or plan to adopt them for cost-effective observability.
    • Your team lacks bandwidth to build a custom Prometheus exporter from scratch.
    • You need security controls (e.g., middleware) to restrict /prometheus endpoint access.
  • Look elsewhere if:
    • You’re on Laravel <11 or PHP <8.4 (package drops legacy support).
    • Your stack is non-Laravel (e.g., Node.js, Python) or requires advanced Prometheus features (e.g., custom collectors).
    • You need real-time streaming (e.g., WebSockets) instead of periodic scraping.
    • Your observability needs are vendor-locked (e.g., AWS CloudWatch, New Relic).

How to Pitch It (Stakeholders)

For Executives: "This package lets us instrument our Laravel app with Prometheus—freeing us from vendor lock-in while enabling real-time monitoring of queues, APIs, and custom metrics. For example, we can track failed jobs in Horizon and visualize them in Grafana, reducing MTTR for critical issues. It’s a low-code, high-impact way to cut cloud monitoring costs by 30%+ while improving reliability."

For Engineering: *"Spatie’s laravel-prometheus gives us a drop-in solution to expose metrics like queue job counts, API response times, and custom business KPIs to Prometheus. Key benefits:

  • Zero reinvention: Built for Laravel, with Horizon/queue collectors out of the box.
  • Security: Easy middleware integration to lock down the /prometheus endpoint.
  • Flexibility: Supports gauges (e.g., active_users), counters (e.g., api_requests), and conditional logic.
  • Future-proof: Actively maintained (Laravel 13+ support), with Grafana dashboards ready to go. Tradeoff: Requires Prometheus/Grafana setup, but we can start with a single instance for dev/staging."*
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony