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/counters with simple callbacks, use built-in queue and Horizon metrics, and optionally secure the endpoint. Ideal for scraping by Prometheus and charting in Grafana.

View on GitHub
Deep Wiki
Context7

title: Creating multiple endpoints weight: 1

By default, all metrics are exported at the default /prometheus endpoint. You can configure Prometheus to periodically scrape metrics from this endpoint using a specified frequency.

If you want to export metrics that should be exported with an alternative frequency, you can create a new endpoint and configure Prometheus to scrape metrics from this endpoint using an alternative frequency.

To use multiple endpoints, you first need to configure them in the prometheus.php config file. Here's an example, where we configure an alternative endpoint

// in config/prometheus.php
    'urls' => [
        'default' => 'prometheus',
        'alternative' => 'alternative-endpoint',
    ],

To expose a metric at the alternative endpoint, you can use the urlName method on the metric. Here's an example:

use Spatie\Prometheus\Facades\Prometheus;

Prometheus::addGauge('User count')
    ->urlName('alternative')
    ->value(fn() => User::count();
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport