https://github.com/fidum/laravel-dashboard-vapor-metrics-tile
Vapor environment, cache and database metrics tiles for laravel dashboard
https://github.com/fidum/laravel-dashboard-vapor-metrics-tile
chart dashboard laravel laravel-vapor spatie tiles vapor vapor-metrics-tile
Last synced: 2 months ago
JSON representation
Vapor environment, cache and database metrics tiles for laravel dashboard
- Host: GitHub
- URL: https://github.com/fidum/laravel-dashboard-vapor-metrics-tile
- Owner: fidum
- License: mit
- Created: 2020-05-05T17:21:02.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-02-24T21:27:10.000Z (3 months ago)
- Last Synced: 2025-03-17T22:08:14.546Z (2 months ago)
- Topics: chart, dashboard, laravel, laravel-vapor, spatie, tiles, vapor, vapor-metrics-tile
- Language: PHP
- Homepage: https://github.com/spatie/laravel-dashboard
- Size: 964 KB
- Stars: 20
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# Vapor Metrics Tile
[](https://packagist.org/packages/fidum/laravel-dashboard-vapor-metrics-tile)
[](https://github.com/fidum/laravel-dashboard-vapor-metrics-tile/actions?query=workflow%3Arun-tests+branch%3Amaster)
[](https://codecov.io/gh/fidum/laravel-dashboard-vapor-metrics-tile)
[](https://twitter.com/danmasonmp)Displays metrics for **all** of your laravel vapor projects - caches, databases and environment metrics and charts included!

## Installation
You can install the package via composer:
```bash
composer require fidum/laravel-dashboard-vapor-metrics-tile
```## Usage
In the `dashboard` config file, you must add this configuration in the `tiles` key. There are separate settings for
`caches`, `databases` and `environments`.```php
// in config/dashboard.php
return [
// ...
'tiles' => [
'vapor_metrics' => [
'secret' => env('VAPOR_API_TOKEN'), // optional: Uses `VAPOR_API_TOKEN` env by default
'refresh_interval_in_seconds' => 300, // optional: Default: 300 seconds (5 minutes)
'period' => '7d', // optional: 1m, 5m, 30m, 1h, 8h, 1d (default), 3d, 7d, 1M
'caches' => [ // Leave empty if you don't want any cache tiles
'My Cache Instance' => [ // Key will be used as the title of the displayed tile
'cache_id' => 222, // required: The id of your vapor cache instance
'period' => '7d', // optional: 1m, 5m, 30m, 1h, 8h, 1d (default), 3d, 7d, 1M
'refresh_interval_in_seconds' => 60, // optional: override individual tile
'secret' => null, // :optional: override individual tile
],
'Another Cache' => ['cache_id' => 333]
],
'databases' => [ // Leave empty if you don't want any database tiles
'My Database' => [ // Key will be used as the title of the displayed tile
'database_id' => 555, // required: The id of your vapor database instance
'period' => '7d', // optional: 1m, 5m, 30m, 1h, 8h, 1d (default), 3d, 7d, 1M
'refresh_interval_in_seconds' => 60, // optional: override individual tile
'secret' => null, // :optional: override individual tile
],
'Another Database' => ['database_id' => 444]
],
'environments' => [ // Leave empty if you don't want any envrionment tiles
'My Staging Website' => [ // Key will be used as the title of the displayed tile
'project_id' => 1111, // required: The id of your vapor project
'environment' => 'staging', // optional: Defaults to 'production'
'period' => '7d', // optional: 1m, 5m, 30m, 1h, 8h, 1d (default), 3d, 7d, 1M
'refresh_interval_in_seconds' => 60, // optional: override individual tile
'secret' => null, // :optional: override individual tile
],
'My Production Website' => ['project_id' => 1111],
],
],
],
];
```In `app\Console\Kernel.php` you should schedule the below to run every `x` minutes. Only add the commands where you have configured the related tiles above.
```php
// in app/console/Kernel.php
protected function schedule(Schedule $schedule)
{
$schedule->command(\Fidum\VaporMetricsTile\Commands\FetchVaporCacheMetricsCommand::class)->everyThirtyMinutes();
$schedule->command(\Fidum\VaporMetricsTile\Commands\FetchVaporDatabaseMetricsCommand::class)->everyThirtyMinutes();
$schedule->command(\Fidum\VaporMetricsTile\Commands\FetchVaporEnvironmentMetricsCommand::class)->everyThirtyMinutes();
}
```In your dashboard view you can use one or all or multiple of each of these components. The `tileName` and `position`
attributes are **required**. The `tileName` attribute value needs to match the name specified in the config:```blade
```
For charts an additional `type` value should be provided to select which chart to show:
- `cli-avg-duration`: Average CLI Invocation Duration (ms)
- `cli-invocations-total`: CLI Invocations
- `http-requests-avg-duration`: Average HTTP Request Duration (ms)
- `http-requests-total`: HTTP Requests
- `queue-avg-duration`: Average Queue Invocation Duration (ms)
- `queue-invocations-total`: Queue InvocationsThe charts use [fidum/laravel-dashboard-chart-tile](https://github.com/fidum/laravel-dashboard-chart-tile) internally.
You can use the below additional properties for further customisation:
- `height` sets the height of the chart, depending on your dashboard layout you may need to adjust this (defaults to `100%`).
- `refreshIntervalInSeconds` use this to override the refresh rate of an individual tile (defaults to above configured setting)## Testing
```bash
composer test
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security
If you discover any security related issues, please email :author_email instead of using the issue tracker.
## Credits
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.