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

Lamet Laravel Package

itsemon245/lamet

High-performance Laravel metrics recorder and aggregator for Grafana dashboards. Install via Artisan, configure DB/cache, track counters, gauges, and timings, flush/clean via commands, and run scheduled tasks to persist aggregates.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Lamet
What Laravel versions does Lamet support?
Lamet follows Laravel’s LTS support policy. Check the package’s `composer.json` for the exact version range, but it typically aligns with Laravel 8.x and 9.x. Always verify compatibility with your Laravel version before installation.
How do I track API response times with Lamet?
Use middleware to auto-instrument HTTP routes. Bind Lamet’s `HttpDurationMiddleware` in `app/Http/Kernel.php` under the `$middleware` array. This will record request durations with labels like `route`, `method`, and `status_code`.
Can Lamet replace Prometheus for Laravel applications?
Lamet is lightweight and Grafana-ready but lacks Prometheus’s scalability for high-cardinality metrics. For production-grade observability, consider exporting Lamet’s data to Prometheus via a custom exporter or use Lamet for simpler use cases like business KPIs.
What cache backend does Lamet recommend for production?
Redis is strongly recommended for high performance. Configure it in `.env` with `LAMET_CACHE_DRIVER=redis` and set `LAMET_CACHE_TTL` to a reasonable value (e.g., 3600 for 1 hour). Memcached is supported but may lack Redis’s feature set.
How do I clean up old metrics to avoid database bloat?
Run the `lamet:clean` Artisan command manually or schedule it via Laravel’s scheduler (e.g., `* * * * * php artisan lamet:clean`). Configure retention policies in `config/lamet.php` by setting `default_ttl` for automatic cleanup.
Does Lamet support multi-tenant metrics isolation?
Lamet doesn’t enforce multi-tenancy out of the box, but you can implement it by adding a `tenant_id` label to all metrics. Use middleware or service providers to inject the tenant context dynamically. Custom aggregations may require filtering by `tenant_id` in queries.
How do I set up Grafana to query Lamet’s database?
Add your Laravel database as a Grafana data source (PostgreSQL/MySQL). Use the `lamet_metrics` table and query raw data with time filters. For better performance, pre-aggregate metrics in the database or export them to Prometheus using a custom exporter.
What happens if the cache fails during metric recording?
Lamet falls back to storing metrics directly in the database if the cache is unavailable. This ensures no data loss but may impact performance. Monitor cache health and set up alerts for cache failures to avoid prolonged database load.
Are there pre-built Grafana dashboards for Lamet?
Lamet doesn’t include pre-built dashboards, but the README references recommended panels (e.g., time-series charts for counters/gauges). You’ll need to create dashboards manually or adapt existing ones. Grafana’s template variables can help filter metrics by labels like `service` or `environment`.
How do I test Lamet in a CI/CD pipeline?
Mock the cache and database in tests using Laravel’s testing helpers. For example, use `Cache::shouldReceive('put')->once()` to verify metric storage. Test edge cases like cache failures by temporarily disabling the cache driver in your test environment.
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.
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
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata