PHP Class Datadogstatsd

Afficher le fichier Open project: datadog/php-datadogstatsd Class Usage Examples

Protected Properties

Свойство Type Description
$__server
$__serverPort

Méthodes publiques

Méthode Description
configure ( $apiKey, $applicationKey, $datadogHost = 'https://app.datadoghq.com', $submitEventsOver = 'TCP', $localStatsdServer = 'localhost', $localStatsdPort = 8125, $curlVerifySslHost = 2, $curlVerifySslPeer = 1 )
decrement ( string | array $stats, float $sampleRate = 1, array $tags = null ) : boolean Decrements one or more stats counters.
event ( string $title, array $vals = [] ) : null Send an event to the Datadog HTTP api. Potentially slow, so avoid making many call in a row if you don't want to stall your app.
flush ( $udp_message )
gauge ( string $stat, float $value, float $sampleRate = 1, array $tags = null ) Gauge
histogram ( string $stat, float $value, float $sampleRate = 1, array $tags = null ) Histogram
increment ( string | array $stats, float $sampleRate = 1, array $tags = null ) : boolean Increments one or more stats counters
microtiming ( string $stat, float $time, float $sampleRate = 1, array $tags = null ) A convenient alias for the timing function when used with micro-timing
report ( $udp_message )
report_metric ( $udp_message )
send ( array $data, float $sampleRate = 1, array $tags = null ) : null Squirt the metrics over UDP
service_check ( string $name, integer $status, array $tags = null, string $hostname = null, string $message = null, integer $timestamp = null ) : null Send a custom service check status over UDP
set ( string $stat, float $value, float $sampleRate = 1, array $tags = null ) Set
timing ( string $stat, float $time, float $sampleRate = 1, array $tags = null ) Log timing information
updateStats ( string | array $stats, integer $delta = 1, float $sampleRate = 1, array $tags = null ) : boolean Updates one or more stats counters by arbitrary amounts.

Private Methods

Méthode Description
escape_sc_message ( $msg )
eventUdp ( array $vals ) : null Formats $vals array into event for submission to Datadog via UDP

Method Details

configure() public static méthode

public static configure ( $apiKey, $applicationKey, $datadogHost = 'https://app.datadoghq.com', $submitEventsOver = 'TCP', $localStatsdServer = 'localhost', $localStatsdPort = 8125, $curlVerifySslHost = 2, $curlVerifySslPeer = 1 )

decrement() public static méthode

Decrements one or more stats counters.
public static decrement ( string | array $stats, float $sampleRate = 1, array $tags = null ) : boolean
$stats string | array The metric(s) to decrement.
$sampleRate float the rate (0-1) for sampling.
$tags array Key Value array of Tag => Value, or single tag as string
Résultat boolean

event() public static méthode

Requires PHP >= 5.3.0
public static event ( string $title, array $vals = [] ) : null
$title string Title of the event
$vals array Optional values of the event. See http://docs.datadoghq.com/guides/dogstatsd/#events for the valid keys
Résultat null

flush() public static méthode

public static flush ( $udp_message )

gauge() public static méthode

Gauge
public static gauge ( string $stat, float $value, float $sampleRate = 1, array $tags = null )
$stat string The metric
$value float The value
$sampleRate float the rate (0-1) for sampling.
$tags array Key Value array of Tag => Value, or single tag as string

histogram() public static méthode

Histogram
public static histogram ( string $stat, float $value, float $sampleRate = 1, array $tags = null )
$stat string The metric
$value float The value
$sampleRate float the rate (0-1) for sampling.
$tags array Key Value array of Tag => Value, or single tag as string

increment() public static méthode

Increments one or more stats counters
public static increment ( string | array $stats, float $sampleRate = 1, array $tags = null ) : boolean
$stats string | array The metric(s) to increment.
$sampleRate float the rate (0-1) for sampling.
$tags array Key Value array of Tag => Value, or single tag as string
Résultat boolean

microtiming() public static méthode

A convenient alias for the timing function when used with micro-timing
public static microtiming ( string $stat, float $time, float $sampleRate = 1, array $tags = null )
$stat string The metric name
$time float The elapsed time to log, IN SECONDS
$sampleRate float the rate (0-1) for sampling.
$tags array Key Value array of Tag => Value, or single tag as string

report() public static méthode

public static report ( $udp_message )

report_metric() public static méthode

public static report_metric ( $udp_message )

send() public static méthode

Squirt the metrics over UDP
public static send ( array $data, float $sampleRate = 1, array $tags = null ) : null
$data array Incoming Data
$sampleRate float the rate (0-1) for sampling.
$tags array Key Value array of Tag => Value, or single tag as string
Résultat null

service_check() public static méthode

Send a custom service check status over UDP
public static service_check ( string $name, integer $status, array $tags = null, string $hostname = null, string $message = null, integer $timestamp = null ) : null
$name string service check name
$status integer service check status code (see static::OK, static::WARNING,...)
$tags array Key Value array of Tag => Value, or single tag as string
$hostname string hostname to associate with this service check status
$message string message to associate with this service check status
$timestamp integer timestamp for the service check status (defaults to now)
Résultat null

set() public static méthode

Set
public static set ( string $stat, float $value, float $sampleRate = 1, array $tags = null )
$stat string The metric
$value float The value
$sampleRate float the rate (0-1) for sampling.
$tags array Key Value array of Tag => Value, or single tag as string

timing() public static méthode

Log timing information
public static timing ( string $stat, float $time, float $sampleRate = 1, array $tags = null )
$stat string The metric to in log timing info for.
$time float The elapsed time (ms) to log
$sampleRate float the rate (0-1) for sampling.
$tags array Key Value array of Tag => Value, or single tag as string

updateStats() public static méthode

Updates one or more stats counters by arbitrary amounts.
public static updateStats ( string | array $stats, integer $delta = 1, float $sampleRate = 1, array $tags = null ) : boolean
$stats string | array The metric(s) to update. Should be either a string or array of metrics.
$delta integer The amount to increment/decrement each metric by.
$sampleRate float the rate (0-1) for sampling.
$tags array Key Value array of Tag => Value, or single tag as string
Résultat boolean

Property Details

$__server protected_oe static_oe property

protected static $__server

$__serverPort protected_oe static_oe property

protected static $__serverPort