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

[emitter] Split check runs from main agent payload #3446

Merged
merged 2 commits into from
Aug 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,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 @@ -160,15 +164,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