Download the PHP package cosmastech/laravel-statsd-adapter without Composer
On this page you can find all versions of the php package cosmastech/laravel-statsd-adapter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cosmastech/laravel-statsd-adapter
More information about cosmastech/laravel-statsd-adapter
Files in cosmastech/laravel-statsd-adapter
Package laravel-statsd-adapter
Short Description Easily use statsd-client-adapter within your Laravel project
License wtfpl
Informations about the package laravel-statsd-adapter
Laravel StatsD Adapter
Overview
The Laravel StatsD Adapter is a package that provides a seamless integration between Laravel applications and StatsD, a network daemon for collecting and aggregating metrics. By using this adapter, you can effortlessly monitor and measure the performance of your Laravel application, track various metrics, and send them to a StatsD server.
Why Use This Adapter?
- Save time: logs are great, but metrics can quickly tell the big picture of your application's health.
- Performance Monitoring: Easily track the performance of your Laravel application, including response times, database queries, and other custom metrics.
- Aggregation: StatsD collects and aggregates metrics, providing valuable insights into your application's performance over time.
- Flexibility: Configure the adapter to suit your specific needs. You can use multiple statsd instances in one environment or configure each environment to write to a different location: your local environment to write to a log, staging to a statsd instance, and production to DataDog.
- Testability: use
memory
adapter to write unit tests which confirm that stats are recorded under given conditions.
Installation
You can install the package via Composer:
After installing the package, publish the configuration file using the following command:
Optional Dependencies
If you wish to use DataDog for logging stats, require the composer package
For using League's statsd client, you'll need to install their package.
Configuration
The configuration file config/statsd-adapter.php
allows you to customize the adapter's behavior.
Here are the available options:
- Default Connection: Specify the default StatsD connection.
- Default Tags: In addition to sending tags based on an as needed basis, you can also include tags in every outgoing request.
- Connections: Define multiple StatsD connections, each with its own settings.
You can use the example configuration,
Usage
Basic Usage
To send a simple metric, you can use the Stats
facade:
If you prefer using dependency injection in your functions, use the StatsDClientAdapter
interface.
Use Cases
Tracking Page Views
Track the number of times a page is viewed:
Monitoring Response Times
Measure and monitor the response time of your application:
Database Query Monitoring
Track the number of database queries and their execution time:
Advanced Configuration
Custom Connections
You can define multiple connections and use them as needed:
Dynamic Metrics
Create dynamic metric names based on runtime data:
Contributing
Contributions are welcome! Please submit a pull request or open an issue to discuss your ideas.
License
This package is open-sourced software licensed under the WTFPL license.
All versions of laravel-statsd-adapter with dependencies
cosmastech/statsd-client-adapter Version ^0.4
illuminate/support Version ^10.0|^11.0
illuminate/contracts Version ^10.0|^11.0