All Projects → domnikl → Statsd Php

domnikl / Statsd Php

Licence: mit
a PHP client for statsd

Projects that are alternatives of or similar to Statsd Php

Dcos Metrics
The metrics pipeline for DC/OS 1.9-1.11
Stars: ✭ 57 (-82.57%)
Mutual labels:  metrics, statsd
Amon
Amon is a modern server monitoring platform.
Stars: ✭ 1,331 (+307.03%)
Mutual labels:  metrics, statsd
Graylog Plugin Metrics Reporter
Graylog Metrics Reporter Plugins
Stars: ✭ 71 (-78.29%)
Mutual labels:  metrics, statsd
Logmonitor
Monitoring log files on windows systems.
Stars: ✭ 23 (-92.97%)
Mutual labels:  metrics, statsd
Node Statsd Client
Node.js client for statsd
Stars: ✭ 170 (-48.01%)
Mutual labels:  metrics, statsd
Cernan
telemetry aggregation and shipping, last up the ladder
Stars: ✭ 306 (-6.42%)
Mutual labels:  metrics, statsd
Dipstick
Configurable metrics toolkit for Rust applications
Stars: ✭ 92 (-71.87%)
Mutual labels:  metrics, statsd
Banshee
Anomalies detection system for periodic metrics.
Stars: ✭ 1,045 (+219.57%)
Mutual labels:  metrics, statsd
Go Statsd Client
statsd client for Go
Stars: ✭ 163 (-50.15%)
Mutual labels:  metrics, statsd
Statsd Vis
Standalone StatsD server with built-in visualization
Stars: ✭ 124 (-62.08%)
Mutual labels:  metrics, statsd
Statsd exporter
StatsD to Prometheus metrics exporter
Stars: ✭ 608 (+85.93%)
Mutual labels:  metrics, statsd
dats
📈 Minimalistic zero-dependencies statsd client for Node.js
Stars: ✭ 63 (-80.73%)
Mutual labels:  tcp, statsd
Python Prometheus Demo
Demo of using Prometheus for monitoring Python web applications
Stars: ✭ 83 (-74.62%)
Mutual labels:  metrics, statsd
Foundatio
Pluggable foundation blocks for building distributed apps.
Stars: ✭ 1,365 (+317.43%)
Mutual labels:  metrics, statsd
Statix
Fast and reliable Elixir client for StatsD-compatible servers
Stars: ✭ 228 (-30.28%)
Mutual labels:  metrics, statsd
Statsd
Daemon for easy but powerful stats aggregation
Stars: ✭ 16,179 (+4847.71%)
Mutual labels:  metrics, statsd
Matomo Sdk Android
SDK for Android to measure your apps with Matomo. Works on Android phones, tablets, Fire TV sticks, and more!
Stars: ✭ 309 (-5.5%)
Mutual labels:  metrics
Reading
整理阅读过的干货文章, 帖子
Stars: ✭ 318 (-2.75%)
Mutual labels:  tcp
Devstats
📈CNCF-created tool for analyzing and graphing developer contributions
Stars: ✭ 308 (-5.81%)
Mutual labels:  metrics
Prometheus flask exporter
Prometheus exporter for Flask applications
Stars: ✭ 318 (-2.75%)
Mutual labels:  metrics

statsd-php

⚠️ This repo is abandoned and will no longer be maintained. Please use slickdeals/statsd instead.

A PHP client library for the statistics daemon (statsd) intended to send metrics from PHP applications.

Build Status Donate

Installation

The best way to install statsd-php is to use Composer and add the following to your project's composer.json file:

{
    "require": {
        "domnikl/statsd": "~3.0"
    }
}

Usage

<?php
$connection = new \Domnikl\Statsd\Connection\UdpSocket('localhost', 8125);
$statsd = new \Domnikl\Statsd\Client($connection, "test.namespace");

// the global namespace is prepended to every key (optional)
$statsd->setNamespace("test");

// simple counts
$statsd->increment("foo.bar");
$statsd->decrement("foo.bar");
$statsd->count("foo.bar", 1000);

When establishing the connection to statsd and sending metrics, errors will be suppressed to prevent your application from crashing.

If you run statsd in TCP mode, there is also a \Domnikl\Statsd\Connection\TcpSocket adapter that works like the UdpSocket except that it throws a \Domnikl\Statsd\Connection\TcpSocketException if no connection could be established. Please consider that unlike UDP, TCP is used for reliable networks and therefor exceptions (and errors) will not be suppressed in TCP mode.

Timings

<?php
// timings
$statsd->timing("foo.bar", 320);
$statsd->time("foo.bar.bla", function() {
    // code to be measured goes here ...
});

// more complex timings can be handled with startTiming() and endTiming()
$statsd->startTiming("foo.bar");
// more complex code here ...
$statsd->endTiming("foo.bar");

Memory profiling

<?php
// memory profiling
$statsd->startMemoryProfile('memory.foo');
// some complex code goes here ...
$statsd->endMemoryProfile('memory.foo');

// report peak usage
$statsd->memory('foo.memory_peak_usage');

Gauges

statsd supports gauges, arbitrary values which can be recorded.

This method accepts both absolute (3) and delta (+11) values.

NOTE: Negative values are treated as delta values, not absolute.

<?php
// Absolute value
$statsd->gauge('foobar', 3);

// Pass delta values as a string. 
// Accepts both positive (+11) and negative (-4) delta values.
$statsd->gauge('foobar', '+11'); 

Sets

statsd supports sets, so you can view the uniqueness of a given value.

<?php
$statsd->set('userId', 1234);

disabling sending of metrics

To disable sending any metrics to the statsd server, you can use the Domnikl\Statsd\Connection\Blackhole connection 
class instead of the default socket abstraction. This may be incredibly useful for feature flags. Another options is to use Domnikl\Statsd\Connection\InMemory connection class, that will collect your messages but won't actually send them.

Authors

Original author: Dominik Liebler [email protected] Several other contributors - Thank you!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].