Download the PHP package metrics-tracker/watchlog without Composer
On this page you can find all versions of the php package metrics-tracker/watchlog. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download metrics-tracker/watchlog
More information about metrics-tracker/watchlog
Files in metrics-tracker/watchlog
Package watchlog
Short Description A PHP package for sending metrics.
License MIT
Informations about the package watchlog
Watchlog Usage Documentation
Introduction
The Watchlog
class is a simple PHP class for sending various types of metrics to a server. It uses the Guzzle HTTP client for making asynchronous HTTP requests.
Setup
-
Install Watchlog: Ensure you have the Watchlog package installed via Composer. Run the following command in your project directory:
- Include the
Watchlog
Class: Ensure your PHP script includes theWatchlog
class. Use an autoloader or include the class file directly.
Usage
Here are the methods available in the Watchlog
class and how to use them:
-
Increment a Metric:
-
Decrement a Metric:
-
Set a Gauge Value:
-
Set a Percentage Value:
- Set a System Byte Value:
Notes
- Ensure the server agent is set up to handle the incoming metric requests.
- Each method (
increment
,decrement
,gauge
,percentage
,systembyte
) sends a metric to the server with the specified method, metric name, and value. - The
sendMetric
method is a private method used internally to handle the HTTP request logic.
This documentation should help you understand how to set up and use the Watchlog
class for tracking metrics in your PHP application.