Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pup #78

Closed
wants to merge 11 commits into from
7 changes: 1 addition & 6 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# CONSTANTS
DATADOG_CONF = "datadog.conf"
DEFAULT_CHECK_FREQUENCY = 15 # seconds
STATSD_FREQUENCY = 2 # seconds

def get_parsed_args():
parser = OptionParser()
Expand Down Expand Up @@ -145,11 +144,7 @@ def get_config(parse_args = True, cfg_path=None, init_logging=False):
agentConfig['pup_url'] = config.get('Main', 'pup_url')
else:
agentConfig['pup_url'] = 'http://localhost:17125'

# Increases the frequency of statsd metrics when only sending to Pup
if not agentConfig['use_dd'] and agentConfig['use_pup']:
dogstatsd_interval = STATSD_FREQUENCY


if not agentConfig['use_dd'] and not agentConfig['use_pup']:
sys.stderr.write("Please specify at least one endpoint to send metrics to. This can be done in datadog.conf.")
exit(2)
Expand Down
20 changes: 10 additions & 10 deletions ddagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,21 @@ def get_url(self, endpoint):
return self._application._agentConfig[endpoint] + '/intake/'

def flush(self):
for current_idx, endpoint in enumerate(self._endpoints):
logging.debug("End point: %s" % endpoint)
req = tornado.httpclient.HTTPRequest(self.get_url(endpoint),
method = "POST", body = self.get_data() )
for endpoint in self._endpoints:
url = self.get_url(endpoint)
logging.info("Sending metrics to endpoint %s at %s" % (endpoint, url))
req = tornado.httpclient.HTTPRequest(url, method="POST", body=self.get_data())

# Send Transaction to the endpoint
http = tornado.httpclient.AsyncHTTPClient()

logging.info(req.url)

# Check response for last endpoint
# 1st priority, dd_url; 2nd priority, pup_url.
# The success of this metric transaction should only depend on
# whether or not it's successfully sent to datadoghq. If it fails
# getting sent to pup, it's not a big deal.
if endpoint == 'dd_url':
http.fetch(req, callback=lambda(x): None)
http.fetch(req, callback=self.on_response)
else:
http.fetch(req, callback=lambda(x): self.on_response(x))
http.fetch(req, callback=lambda(x): None)

def on_response(self, response):
if response.error:
Expand Down
1 change: 0 additions & 1 deletion dogstatsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ def main(config_path=None):
target = c['dogstatsd_target']
interval = c['dogstatsd_interval']
api_key = c['api_key']
host = 'localhost'

hostname = gethostname(c)

Expand Down
2 changes: 1 addition & 1 deletion packaging/datadog-agent/source/setup_agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pip install argparse

# set up the agent
mkdir -p $dd_base/agent
$dl_cmd $dd_base/agent.tar.gz https://github.com/DataDog/dd-agent/tarball/add-pup
$dl_cmd $dd_base/agent.tar.gz https://github.com/DataDog/dd-agent/tarball/pup
tar -xz -C $dd_base/agent --strip-components 1 -f $dd_base/agent.tar.gz
if [ $apikey ]; then
sed "s/api_key:.*/api_key: $apikey/" $dd_base/agent/datadog.conf.example > $dd_base/agent/datadog.conf.1
Expand Down
4 changes: 4 additions & 0 deletions pup/README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ First install the [Datadog agent](https://github.com/DataDog/dd-agent) by runnin

That's it! Now navigate to **localhost:17125**. Within ten seconds, system metrics should start streaming.

### Upgrade

It's easy, just re-install. No files will be lost.

### Custom metrics with statsd

If you would like to add custom metrics to your applications, use the dogstatsd-python or dogstatsd-ruby libraries to instrument your code. Thorough documentation on using DogStatsd and Statsd can be found at [Datadog HQ](http://api.datadoghq.com/guides/dogstatsd/). Below is an abridged introduction to Statsd, and an walkthrough on getting custom metrics viewed on Pup.
Expand Down
62 changes: 31 additions & 31 deletions pup/assets/javascript/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,35 @@
*/

var C = (function() {
return {
WIDTH : "width",
HEIGHT : "height",
G : "g",
TRANSFORM : "transform",
CLASS : "class",
ID : "id",
RECT : "rect",
TEXT : "text",
X : "x",
Y : "y",
D : "d",
PATH : "path",
LINE : "line",
AREA : "area",
PERIOD : ".",
HASH : "#",
TRANSLATE : "translate",
OPENPAREN : "(",
CLOSEPAREN: ")",
DASH : "-",
COMMA : ",",
CLIP : "clip",
URL : "url",
ZERO : "0",
HIDDEN : "hidden",
TIME : "time",
VALUE : "value",
NAME : "name",
TIME : "time"
};
return {
WIDTH : "width",
HEIGHT : "height",
G : "g",
TRANSFORM : "transform",
CLASS : "class",
ID : "id",
RECT : "rect",
TEXT : "text",
X : "x",
Y : "y",
D : "d",
PATH : "path",
LINE : "line",
AREA : "area",
PERIOD : ".",
HASH : "#",
TRANSLATE : "translate",
OPENPAREN : "(",
CLOSEPAREN: ")",
DASH : "-",
COMMA : ",",
CLIP : "clip",
URL : "url",
ZERO : "0",
HIDDEN : "hidden",
TIME : "time",
VALUE : "value",
NAME : "name",
TIME : "time"
};
}());
Loading