Giter VIP home page Giter VIP logo

li3_metrics's Introduction

li3_metrics

Lithium library for sending statistical data to librato metrics. Have a look at their documentation.

Installation

Add a submodule to your li3 libraries:

git submodule add [email protected]:bruensicke/li3_metrics.git libraries/li3_metrics

and activate it in you app (config/bootstrap/libraries.php), of course:

Libraries::add('li3_metrics');

Usage

Preparation

Metrics::$username = '[email protected]';
Metrics::$token = '4077254dbb55d78414a9de3b97e4e2807f5addb8c746c3a6f6edaf1cb164940a';

Sending data

In order to send data to Metrics, you need to build an array with all gauges/counters you want to submit

Metrics::post(array(
	'gauges' => array(
		'api.requests' => array(
			'value' => 2,
		),
		'api.requests.internal' => array(
			'value' => 3,
		),
	),
));

You can also use a shortcut, but that works only for one gauge at a time, so try to avoid that, if you want to send more than one data-metric

Metrics::gauge('api.requests', 1, $hostname);

Retrieving a list of metrics

You can easily retrieve a list of all metrics you have with get()

// returns all metrics
$metrics = Metrics::get();

You can also filter your results by giving a substring to search for in name, or passing in a tag-name

// returns only metrics, that have 'request' in their name
$metrics = Metrics::get('request');

or

// returns all metrics containing 'request' in their name, that carry a tag 'api'
$metrics = Metrics::get('request', array('api'));

Credits

li3_metrics's People

Contributors

d1rk avatar

Watchers

 avatar James Cloos avatar Eduardo Ayala avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.