artsy/volley

Name: volley

Owner: Artsy

Description: Datadog StatsD ingestion for client-side data

Created: 2018-05-01 22:54:48.0

Updated: 2018-05-10 17:50:43.0

Pushed: 2018-05-10 17:50:41.0

Homepage: null

Size: 43

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Volley

CircleCI

Datadog Agent proxy service for client-side metrics collection.

Meta
Summary

Metric is a thin HTTP wrapper for node-dogstatsd. It receives metric data from browser applications and forwards it to a Datadog Agent, which in turn handles collection of metrics from multiple sources into Datadog.

Development
Datadog local setup
Running locally

Development is done via Hokusai (follow the setup instructions in that readme). Then you may run the following command:

sai dev start

That will build a Docker container with the app's dependencies. You can also run development outside Docker, via yarn install and yarn start (run npm install -g yarn, if you don't already have Yarn).

Usage
Whitelists

Because Datadog plans have an allotment of custom metrics and tags, Metric offers the ability to restrict possible values for metric names and tags that are allowed. The whitelists are managed by environment variables.

Global tags

The Datadog Agent is already configured to send an env tag with all metrics it publishes. If you want to add additional global tags, set the GLOBAL_TAGS environment variable to a comma-separated list of tags with the process mentioned in the previous section.

Publishing metrics

From a client application, make a POST request to the /report endpoint. Example:

ODO

You may push multiple metrics in one payload. In all situations, Metric will respond with status code 202 and the text “OK”, so watch Datadog for metrics appearing and Metric's logs for errors.

The following payload demonstrates the format of all possible metric types:


erviceName": "client-service",
etrics": [
{
  "type": "timer",
  "name": "elapsed-time",  
  "value": 12345,
  "tags": ["tag-name:tag-arg"]
},
{
  "type": "increment",
  "name": "count",  
  "sampleRate": 1, // optional; defaults to 1
  "tags": ["tag-name:tag-arg"]
},
{
  "type": "incrementBy",
  "name": "count",  
  "value": 5,
  "tags": ["tag-name:tag-arg"]
},
{
  "type": "decrement",
  "name": "count",  
  "sampleRate": 3, // optional; defaults to 1
  "tags": ["tag-name:tag-arg"]
},
{
  "type": "decrementBy",
  "name": "count",  
  "value": 3,
  "tags": ["tag-name:tag-arg"]
},
{
  "type": "gauge",
  "name": "stat",  
  "sampleRate": 2,  // optional; defaults to 1
  "value": 12345,
  "tags": ["tag-name:tag-arg"]
},
{
  "type": "histogram",
  "name": "stat",  
  "value": 4567,
  "sampleRate": 6,
  "tags": ["tag-name:tag-arg"]
},
{
  "type": "set",
  "name": "tracked-items",  
  "value": "item",
  "tags": ["tag-name:tag-arg"]
}


Name

A volley in sports is to knock an airborne ball onward without letting it touch the ground. Or it's a large number of projectiles airborn at once. Either way, it's a vaguely physics-oriented term, because of…motion…and stuff.

Enjoy https://www.youtube.com/watch?v=1C9STKF0Lv4, for an example.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.