Skip to content

Commit

Permalink
[emitter] Split check runs from main agent payload (#3446)
Browse files Browse the repository at this point in the history
  • Loading branch information
remh authored and olivielpeau committed Aug 21, 2017
1 parent 8ac4fc9 commit 401dd03
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
12 changes: 10 additions & 2 deletions emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ def split_payload(legacy_payload):

del legacy_payload['metrics']

return legacy_payload, metrics_payload
checkruns_payload = legacy_payload["service_checks"]

del legacy_payload["service_checks"]

return legacy_payload, metrics_payload, checkruns_payload

def http_emitter(message, log, agentConfig, endpoint):
api_key = message.get('apiKey')
Expand All @@ -161,15 +165,19 @@ def http_emitter(message, log, agentConfig, endpoint):

legacy_url = "{0}/intake/{1}?api_key={2}".format(agentConfig['dd_url'], endpoint, api_key)
metrics_endpoint = "{0}/api/v1/series?api_key={1}".format(agentConfig['dd_url'], api_key)
checkruns_endpoint = "{0}/api/v1/check_run?api_key={1}".format(agentConfig['dd_url'], api_key)

legacy_payload, metrics_payload = split_payload(message)
legacy_payload, metrics_payload, checkruns_payload = split_payload(message)

# Post legacy payload
post_payload(legacy_url, legacy_payload, agentConfig, log)

# Post metrics payload
post_payload(metrics_endpoint, metrics_payload, agentConfig, log)

# Post check runs payload
post_payload(checkruns_endpoint, checkruns_payload, agentConfig, log)


def get_post_headers(agentConfig, payload):
return {
Expand Down
Loading

0 comments on commit 401dd03

Please sign in to comment.