Download the PHP package jonnx/datadog-client without Composer
On this page you can find all versions of the php package jonnx/datadog-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jonnx/datadog-client
More information about jonnx/datadog-client
Files in jonnx/datadog-client
Package datadog-client
Short Description Standalone DataDog PHP Client, works without datadog agent
License MIT
Homepage https://github.com/jonnx/datadog-client
Informations about the package datadog-client
Datadog PHP Client
Lightweight php-only datadog client
This is a simple php client for datadog which does not require setting up the DataDog Agent This library supports sending metric data or events at the moment, as those should be the most common use cases. Feel free to extend it to your own needs or sending pull requests.
Installation
This library can be installed using composer
Getting Started
To start sending requests to Datadog you need to provider your personal API key first. You find that key in Datadog API Settings.
Sending Events
Events can be sent directly to Datadog using the provided Event class:
Additional properties can be set the usual way:
There is also a shortcut method which handles all that stuff for you:
Event Properties
dateHappened
Type: integer
Timestamp of the event. Defaults to current timestamp.
priority
Type: Event::PRIORITY_
Event priority. Datadog supports LOW and NORMAL
alertType
Type: Event::TYPE_
Event alert_type. Datadog supports INFO, WARNING, ERROR and SUCCESS
aggregationKey
Type: string
Arbitary string used to group events
Sending Metrics
Datadog requires metric data to be encapsulated into a series. One series contains one or more metric objects, which itself contains one or more measurement points.
If you want to send just one metric at a time, you can use the Client::sendMetric method:
Again, there is a shortcut method which can handle that for you:
Metric Properties
name
Type: string
Name of the metric. Can contain underscored or dots for easier grouping, e.g. web.exception.404
type
Type: Metric::TYPE_
Type of the metric. Datadog supports gauge or counter
host
Type: string
Hostname of the source machine
points
Type: array
Array of data points.
A point consists of an optional timestamp and a numeric value. If no timestamp is specified, the current timestamp will be used. Order matters. If a timestamp is specified, it should be the first value.
Examples:
Origin of this package
This is a re-upload of the original repository removed by the orignal author Matthias Bayer. Class names and paths have been updated to submit this project to packagist. This ensures it can easily be installed using composer out of the box.
Source: https://twitter.com/JonasWeigert/status/1590894486397538306