diff --git a/emitter.py b/emitter.py index 7dc0d6c800..6c71dd7789 100644 --- a/emitter.py +++ b/emitter.py @@ -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') @@ -160,8 +164,9 @@ 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) @@ -169,6 +174,9 @@ def http_emitter(message, log, agentConfig, endpoint): # 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 { diff --git a/tests/core/fixtures/payloads/sc_payload.json b/tests/core/fixtures/payloads/sc_payload.json new file mode 100644 index 0000000000..5dcccfacfb --- /dev/null +++ b/tests/core/fixtures/payloads/sc_payload.json @@ -0,0 +1 @@ +[{"status": 0, "tags": ["check:ntp"], "timestamp": 1487973678.956833, "id": 818, "host_name": "remi-split-payloads", "message": null, "check": "datadog.agent.check_status"}, {"status": 0, "tags": ["check:disk"], "timestamp": 1487973678.984175, "id": 819, "host_name": "remi-split-payloads", "message": null, "check": "datadog.agent.check_status"}, {"status": 0, "tags": ["supervisord_server:server0"], "timestamp": 1487973679.04499, "id": 820, "host_name": "remi-split-payloads", "message": null, "check": "supervisord.can_connect"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:alerting-event-evaluator"], "timestamp": 1487973679.045075, "id": 821, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: alerting-event-evaluator\nProcess group: alerting\nDescription: Not started\nError log file: /var/log/supervisor/alerting-event-evaluator-stderr---supervisor-JFsWlB.log\nStdout log file: /home/vagrant/var/log/alerting-event-evaluator.log\nLog file: /home/vagrant/var/log/alerting-event-evaluator.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:alerting-metric-evaluator"], "timestamp": 1487973679.045117, "id": 822, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: alerting-metric-evaluator\nProcess group: alerting\nDescription: Not started\nError log file: /var/log/supervisor/alerting-metric-evaluator-stderr---supervisor-Zg65sR.log\nStdout log file: /home/vagrant/var/log/alerting-metric-evaluator.log\nLog file: /home/vagrant/var/log/alerting-metric-evaluator.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:alerting-metric-query"], "timestamp": 1487973679.04514, "id": 823, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: alerting-metric-query\nProcess group: alerting\nDescription: Not started\nError log file: /var/log/supervisor/alerting-metric-query-stderr---supervisor-a0an9b.log\nStdout log file: /home/vagrant/var/log/herc.log\nLog file: /home/vagrant/var/log/herc.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:alerting-scheduler"], "timestamp": 1487973679.045161, "id": 824, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: alerting-scheduler\nProcess group: alerting\nDescription: Not started\nError log file: /var/log/supervisor/alerting-scheduler-stderr---supervisor-2f8mwK.log\nStdout log file: /home/vagrant/var/log/alerting-scheduler.log\nLog file: /home/vagrant/var/log/alerting-scheduler.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:colvin"], "timestamp": 1487973679.04518, "id": 825, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: colvin\nProcess group: alerting\nDescription: Not started\nError log file: /var/log/supervisor/colvin-stderr---supervisor-txwFyr.log\nStdout log file: /home/vagrant/var/log/colvin.log\nLog file: /home/vagrant/var/log/colvin.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:cutty"], "timestamp": 1487973679.045197, "id": 826, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: cutty\nProcess group: alerting\nDescription: Not started\nError log file: /var/log/supervisor/cutty-stderr---supervisor-f_iDE_.log\nStdout log file: /home/vagrant/var/log/cutty.log\nLog file: /home/vagrant/var/log/cutty.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:delancie-default"], "timestamp": 1487973679.045213, "id": 827, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: delancie-default\nProcess group: alerting\nDescription: Not started\nError log file: /var/log/supervisor/delancie-default-stderr---supervisor-4r1F7Y.log\nStdout log file: /home/vagrant/var/log/delancie-default.log\nLog file: /home/vagrant/var/log/delancie-default.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:delancie-notification"], "timestamp": 1487973679.045229, "id": 828, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: delancie-notification\nProcess group: alerting\nDescription: Not started\nError log file: /var/log/supervisor/delancie-notification-stderr---supervisor-17iVcO.log\nStdout log file: /home/vagrant/var/log/delancie-notification.log\nLog file: /home/vagrant/var/log/delancie-notification.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:herc"], "timestamp": 1487973679.045245, "id": 829, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: herc\nProcess group: alerting\nDescription: Not started\nError log file: /var/log/supervisor/herc-stderr---supervisor-BjyJTI.log\nStdout log file: /home/vagrant/var/log/herc.log\nLog file: /home/vagrant/var/log/herc.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:templeton-alerts"], "timestamp": 1487973679.045261, "id": 830, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: templeton-alerts\nProcess group: alerting\nDescription: Not started\nError log file: /var/log/supervisor/templeton-alerts-stderr---supervisor-cNAG2Y.log\nStdout log file: /home/vagrant/var/log/templeton-alerts.log\nLog file: /home/vagrant/var/log/templeton-alerts.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:templeton-events"], "timestamp": 1487973679.045277, "id": 831, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: templeton-events\nProcess group: alerting\nDescription: Not started\nError log file: /var/log/supervisor/templeton-events-stderr---supervisor-CAGDpp.log\nStdout log file: /home/vagrant/var/log/templeton-events.log\nLog file: /home/vagrant/var/log/templeton-events.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:destro"], "timestamp": 1487973679.045293, "id": 832, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: destro\nProcess group: apm\nDescription: Not started\nError log file: /var/log/supervisor/destro-stderr---supervisor-8J6PW_.log\nStdout log file: /home/vagrant/var/log/destro.log\nLog file: /home/vagrant/var/log/destro.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:loom"], "timestamp": 1487973679.045308, "id": 833, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: loom\nProcess group: apm\nDescription: Not started\nError log file: /var/log/supervisor/loom-stderr---supervisor-m1HrbE.log\nStdout log file: /home/vagrant/var/log/loom.log\nLog file: /home/vagrant/var/log/loom.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:resource-writer"], "timestamp": 1487973679.045323, "id": 834, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: resource-writer\nProcess group: apm\nDescription: Not started\nError log file: /var/log/supervisor/resource-writer-stderr---supervisor-vFnGhB.log\nStdout log file: /home/vagrant/var/log/resource-writer.log\nLog file: /home/vagrant/var/log/resource-writer.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:smelter"], "timestamp": 1487973679.045342, "id": 835, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: smelter\nProcess group: apm\nDescription: Not started\nError log file: /var/log/supervisor/smelter-stderr---supervisor-u5qBr9.log\nStdout log file: /home/vagrant/var/log/smelter.log\nLog file: /home/vagrant/var/log/smelter.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:synthtracer"], "timestamp": 1487973679.045362, "id": 836, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: synthtracer\nProcess group: apm\nDescription: Not started\nError log file: /var/log/supervisor/synthtracer-stderr---supervisor-A3Ury3.log\nStdout log file: /home/vagrant/var/log/synthtracer.log\nLog file: /home/vagrant/var/log/synthtracer.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:trace-agent"], "timestamp": 1487973679.045379, "id": 837, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: trace-agent\nProcess group: apm\nDescription: Not started\nError log file: /var/log/supervisor/trace-agent-stderr---supervisor-tYPQha.log\nStdout log file: /home/vagrant/var/log/trace-agent.log\nLog file: /home/vagrant/var/log/trace-agent.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:trace-api"], "timestamp": 1487973679.045394, "id": 838, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: trace-api\nProcess group: apm\nDescription: Not started\nError log file: /var/log/supervisor/trace-api-stderr---supervisor-uObQrp.log\nStdout log file: /home/vagrant/var/log/trace-api.log\nLog file: /home/vagrant/var/log/trace-api.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:trace-writer"], "timestamp": 1487973679.045409, "id": 839, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: trace-writer\nProcess group: apm\nDescription: Not started\nError log file: /var/log/supervisor/trace-writer-stderr---supervisor-v_By67.log\nStdout log file: /home/vagrant/var/log/trace-writer.log\nLog file: /home/vagrant/var/log/trace-writer.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 0, "tags": ["supervisord_server:server0", "supervisord_process:cassandra"], "timestamp": 1487973679.045426, "id": 840, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: cassandra\nProcess group: datastore\nDescription: pid 2302, uptime 1:41:28\nError log file: /var/log/supervisor/cassandra-stderr---supervisor-fB3IFT.log\nStdout log file: /home/vagrant/var/log/cassandra.log\nLog file: /home/vagrant/var/log/cassandra.log\nState: RUNNING\nStart time: 2017-02-24 20:19:50\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 0, "tags": ["supervisord_server:server0", "supervisord_process:consul"], "timestamp": 1487973679.045442, "id": 841, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: consul\nProcess group: datastore\nDescription: pid 2287, uptime 1:41:29\nError log file: /var/log/supervisor/consul-stderr---supervisor-gKfLc9.log\nStdout log file: /home/vagrant/var/log/consul.log\nLog file: /home/vagrant/var/log/consul.log\nState: RUNNING\nStart time: 2017-02-24 20:19:49\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 0, "tags": ["supervisord_server:server0", "supervisord_process:elasticsearch"], "timestamp": 1487973679.045459, "id": 842, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: elasticsearch\nProcess group: datastore\nDescription: pid 2299, uptime 1:41:28\nError log file: /var/log/supervisor/elasticsearch-stderr---supervisor-uUfOUk.log\nStdout log file: /home/vagrant/var/log/elasticsearch-supervisor.log\nLog file: /home/vagrant/var/log/elasticsearch-supervisor.log\nState: RUNNING\nStart time: 2017-02-24 20:19:50\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 0, "tags": ["supervisord_server:server0", "supervisord_process:kafka"], "timestamp": 1487973679.045479, "id": 843, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: kafka\nProcess group: datastore\nDescription: pid 2291, uptime 1:41:28\nError log file: /var/log/supervisor/kafka-stderr---supervisor-Cpvwdq.log\nStdout log file: /home/vagrant/var/log/kafka.log\nLog file: /home/vagrant/var/log/kafka.log\nState: RUNNING\nStart time: 2017-02-24 20:19:50\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:kafka09"], "timestamp": 1487973679.045495, "id": 844, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: kafka09\nProcess group: datastore\nDescription: Not started\nError log file: /var/log/supervisor/kafka09-stderr---supervisor-VAOhm6.log\nStdout log file: /home/vagrant/var/log/kafka09.log\nLog file: /home/vagrant/var/log/kafka09.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 0, "tags": ["supervisord_server:server0", "supervisord_process:pgbouncer-ddgo"], "timestamp": 1487973679.045511, "id": 845, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: pgbouncer-ddgo\nProcess group: datastore\nDescription: pid 2301, uptime 1:41:28\nError log file: /var/log/supervisor/pgbouncer-ddgo-stderr---supervisor-Mib4dR.log\nStdout log file: /home/vagrant/var/log/pgbouncer-ddgo.log\nLog file: /home/vagrant/var/log/pgbouncer-ddgo.log\nState: RUNNING\nStart time: 2017-02-24 20:19:50\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 0, "tags": ["supervisord_server:server0", "supervisord_process:pgbouncer-ddgo-test"], "timestamp": 1487973679.045526, "id": 846, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: pgbouncer-ddgo-test\nProcess group: datastore\nDescription: pid 2269, uptime 1:41:29\nError log file: /var/log/supervisor/pgbouncer-ddgo-test-stderr---supervisor-RoNKhn.log\nStdout log file: /home/vagrant/var/log/pgbouncer-ddgo-test.log\nLog file: /home/vagrant/var/log/pgbouncer-ddgo-test.log\nState: RUNNING\nStart time: 2017-02-24 20:19:49\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 0, "tags": ["supervisord_server:server0", "supervisord_process:pgbouncer-dogweb"], "timestamp": 1487973679.045542, "id": 847, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: pgbouncer-dogweb\nProcess group: datastore\nDescription: pid 2277, uptime 1:41:29\nError log file: /var/log/supervisor/pgbouncer-dogweb-stderr---supervisor-XwPoj2.log\nStdout log file: /home/vagrant/var/log/pgbouncer-dogweb.log\nLog file: /home/vagrant/var/log/pgbouncer-dogweb.log\nState: RUNNING\nStart time: 2017-02-24 20:19:49\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 0, "tags": ["supervisord_server:server0", "supervisord_process:postgres"], "timestamp": 1487973679.045557, "id": 848, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: postgres\nProcess group: datastore\nDescription: pid 2284, uptime 1:41:29\nError log file: /var/log/supervisor/postgres-stderr---supervisor-TOaKSR.log\nStdout log file: /home/vagrant/var/log/postgres.log\nLog file: /home/vagrant/var/log/postgres.log\nState: RUNNING\nStart time: 2017-02-24 20:19:49\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:rate-limiter"], "timestamp": 1487973679.045571, "id": 849, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: rate-limiter\nProcess group: datastore\nDescription: Not started\nError log file: /var/log/supervisor/rate-limiter-stderr---supervisor-FqyB4l.log\nStdout log file: /home/vagrant/var/log/rate-limiter.log\nLog file: /home/vagrant/var/log/rate-limiter.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 0, "tags": ["supervisord_server:server0", "supervisord_process:redis"], "timestamp": 1487973679.045586, "id": 850, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: redis\nProcess group: datastore\nDescription: pid 2289, uptime 1:41:29\nError log file: /var/log/supervisor/redis-stderr---supervisor-FG6FlN.log\nStdout log file: /home/vagrant/var/log/redis.log\nLog file: /home/vagrant/var/log/redis.log\nState: RUNNING\nStart time: 2017-02-24 20:19:49\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 0, "tags": ["supervisord_server:server0", "supervisord_process:redis-cache"], "timestamp": 1487973679.045604, "id": 851, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: redis-cache\nProcess group: datastore\nDescription: pid 2300, uptime 1:41:28\nError log file: /var/log/supervisor/redis-cache-stderr---supervisor-pda2JW.log\nStdout log file: /home/vagrant/var/log/redis-cache.log\nLog file: /home/vagrant/var/log/redis-cache.log\nState: RUNNING\nStart time: 2017-02-24 20:19:50\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 0, "tags": ["supervisord_server:server0", "supervisord_process:redis-crawler-backend"], "timestamp": 1487973679.045621, "id": 852, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: redis-crawler-backend\nProcess group: datastore\nDescription: pid 2290, uptime 1:41:28\nError log file: /var/log/supervisor/redis-crawler-backend-stderr---supervisor-zOdRXw.log\nStdout log file: /home/vagrant/var/log/redis-crawler-backend.log\nLog file: /home/vagrant/var/log/redis-crawler-backend.log\nState: RUNNING\nStart time: 2017-02-24 20:19:50\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 0, "tags": ["supervisord_server:server0", "supervisord_process:redis-index"], "timestamp": 1487973679.045637, "id": 853, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: redis-index\nProcess group: datastore\nDescription: pid 2286, uptime 1:41:29\nError log file: /var/log/supervisor/redis-index-stderr---supervisor-4KaR9O.log\nStdout log file: /home/vagrant/var/log/redis-index.log\nLog file: /home/vagrant/var/log/redis-index.log\nState: RUNNING\nStart time: 2017-02-24 20:19:49\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 0, "tags": ["supervisord_server:server0", "supervisord_process:redis-localcache"], "timestamp": 1487973679.045651, "id": 854, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: redis-localcache\nProcess group: datastore\nDescription: pid 2275, uptime 1:41:29\nError log file: /var/log/supervisor/redis-localcache-stderr---supervisor-ErTjAF.log\nStdout log file: /home/vagrant/var/log/redis-localcache.log\nLog file: /home/vagrant/var/log/redis-localcache.log\nState: RUNNING\nStart time: 2017-02-24 20:19:49\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 0, "tags": ["supervisord_server:server0", "supervisord_process:redis-queue"], "timestamp": 1487973679.045666, "id": 855, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: redis-queue\nProcess group: datastore\nDescription: pid 2294, uptime 1:41:28\nError log file: /var/log/supervisor/redis-queue-stderr---supervisor-wi41Oi.log\nStdout log file: /home/vagrant/var/log/redis-queue.log\nLog file: /home/vagrant/var/log/redis-queue.log\nState: RUNNING\nStart time: 2017-02-24 20:19:50\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 0, "tags": ["supervisord_server:server0", "supervisord_process:redis-queue-backup"], "timestamp": 1487973679.045681, "id": 856, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: redis-queue-backup\nProcess group: datastore\nDescription: pid 2292, uptime 1:41:28\nError log file: /var/log/supervisor/redis-queue-backup-stderr---supervisor-745F0L.log\nStdout log file: /home/vagrant/var/log/redis-queue-backup.log\nLog file: /home/vagrant/var/log/redis-queue-backup.log\nState: RUNNING\nStart time: 2017-02-24 20:19:50\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:trace-elasticsearch"], "timestamp": 1487973679.045696, "id": 857, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: trace-elasticsearch\nProcess group: datastore\nDescription: Not started\nError log file: /var/log/supervisor/trace-elasticsearch-stderr---supervisor-nt3nwz.log\nStdout log file: /home/vagrant/var/log/trace-elasticsearch-supervisor.log\nLog file: /home/vagrant/var/log/trace-elasticsearch-supervisor.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 0, "tags": ["supervisord_server:server0", "supervisord_process:zookeeper"], "timestamp": 1487973679.045711, "id": 858, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: zookeeper\nProcess group: datastore\nDescription: pid 2288, uptime 1:41:29\nError log file: /var/log/supervisor/zookeeper-stderr---supervisor-7SunPo.log\nStdout log file: /home/vagrant/var/log/zookeeper.log\nLog file: /home/vagrant/var/log/zookeeper.log\nState: RUNNING\nStart time: 2017-02-24 20:19:49\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 0, "tags": ["supervisord_server:server0", "supervisord_process:haproxy"], "timestamp": 1487973679.045725, "id": 859, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: haproxy\nProcess group: frontend\nDescription: pid 2266, uptime 1:41:29\nError log file: /var/log/supervisor/haproxy-stderr---supervisor-telVdC.log\nStdout log file: /home/vagrant/var/log/haproxy.log\nLog file: /home/vagrant/var/log/haproxy.log\nState: RUNNING\nStart time: 2017-02-24 20:19:49\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:mcnulty"], "timestamp": 1487973679.04574, "id": 860, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: mcnulty\nProcess group: frontend\nDescription: Not started\nError log file: /var/log/supervisor/mcnulty-stderr---supervisor-RNBbwA.log\nStdout log file: /home/vagrant/var/log/mcnulty.log\nLog file: /home/vagrant/var/log/mcnulty.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 0, "tags": ["supervisord_server:server0", "supervisord_process:nginx"], "timestamp": 1487973679.045753, "id": 861, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: nginx\nProcess group: frontend\nDescription: pid 2267, uptime 1:41:29\nError log file: /var/log/supervisor/nginx-stderr---supervisor-GJHapV.log\nStdout log file: /home/vagrant/var/log/nginx.log\nLog file: /home/vagrant/var/log/nginx.log\nState: RUNNING\nStart time: 2017-02-24 20:19:49\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:delancie-crawler"], "timestamp": 1487973679.045768, "id": 862, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: delancie-crawler\nProcess group: metrics\nDescription: Not started\nError log file: /var/log/supervisor/delancie-crawler-stderr---supervisor-Qc4Dqo.log\nStdout log file: /home/vagrant/var/log/delancie-crawler.log\nLog file: /home/vagrant/var/log/delancie-crawler.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:lamar"], "timestamp": 1487973679.045782, "id": 863, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: lamar\nProcess group: metrics\nDescription: Not started\nError log file: /var/log/supervisor/lamar-stderr---supervisor-xtfUCr.log\nStdout log file: /home/vagrant/var/log/lamar.log\nLog file: /home/vagrant/var/log/lamar.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:lester"], "timestamp": 1487973679.045812, "id": 864, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: lester\nProcess group: metrics\nDescription: Not started\nError log file: /var/log/supervisor/lester-stderr---supervisor-5Jutnl.log\nStdout log file: /home/vagrant/var/log/lester.log\nLog file: /home/vagrant/var/log/lester.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:marlo"], "timestamp": 1487973679.045841, "id": 865, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: marlo\nProcess group: metrics\nDescription: Not started\nError log file: /var/log/supervisor/marlo-stderr---supervisor-Pbk8vT.log\nStdout log file: /home/vagrant/var/log/marlo.log\nLog file: /home/vagrant/var/log/marlo.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:marlo-backfill"], "timestamp": 1487973679.04586, "id": 866, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: marlo-backfill\nProcess group: metrics\nDescription: Not started\nError log file: /var/log/supervisor/marlo-backfill-stderr---supervisor-EmwD_9.log\nStdout log file: /home/vagrant/var/log/marlo-backfill.log\nLog file: /home/vagrant/var/log/marlo-backfill.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:mouzone"], "timestamp": 1487973679.045875, "id": 867, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: mouzone\nProcess group: metrics\nDescription: Not started\nError log file: /var/log/supervisor/mouzone-stderr---supervisor-dcfw0d.log\nStdout log file: /home/vagrant/var/log/mouzone.log\nLog file: /home/vagrant/var/log/mouzone.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:nicky"], "timestamp": 1487973679.04589, "id": 868, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: nicky\nProcess group: metrics\nDescription: Not started\nError log file: /var/log/supervisor/nicky-stderr---supervisor-NVxgWu.log\nStdout log file: /home/vagrant/var/log/nicky.log\nLog file: /home/vagrant/var/log/nicky.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:propjoe"], "timestamp": 1487973679.045907, "id": 869, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: propjoe\nProcess group: metrics\nDescription: Not started\nError log file: /var/log/supervisor/propjoe-stderr---supervisor-dBx6W8.log\nStdout log file: /home/vagrant/var/log/propjoe.log\nLog file: /home/vagrant/var/log/propjoe.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:reese"], "timestamp": 1487973679.045923, "id": 870, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: reese\nProcess group: metrics\nDescription: Not started\nError log file: /var/log/supervisor/reese-stderr---supervisor-MlvdMP.log\nStdout log file: /home/vagrant/var/log/reese.log\nLog file: /home/vagrant/var/log/reese.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:royce"], "timestamp": 1487973679.045937, "id": 871, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: royce\nProcess group: metrics\nDescription: Not started\nError log file: /var/log/supervisor/royce-stderr---supervisor-8LuzBp.log\nStdout log file: /home/vagrant/var/log/royce.log\nLog file: /home/vagrant/var/log/royce.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:sobotka"], "timestamp": 1487973679.045951, "id": 872, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: sobotka\nProcess group: metrics\nDescription: Not started\nError log file: /var/log/supervisor/sobotka-stderr---supervisor-KavXYs.log\nStdout log file: /home/vagrant/var/log/sobotka.log\nLog file: /home/vagrant/var/log/sobotka.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:spidly"], "timestamp": 1487973679.045966, "id": 873, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: spidly\nProcess group: metrics\nDescription: Not started\nError log file: /var/log/supervisor/spidly-stderr---supervisor-hTyR92.log\nStdout log file: /home/vagrant/var/log/spidly.log\nLog file: /home/vagrant/var/log/spidly.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:spidly_test"], "timestamp": 1487973679.045981, "id": 874, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: spidly_test\nProcess group: metrics\nDescription: Not started\nError log file: /var/log/supervisor/spidly_test-stderr---supervisor-KEddQY.log\nStdout log file: /home/vagrant/var/log/spidly_test.log\nLog file: /home/vagrant/var/log/spidly_test.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:process-client"], "timestamp": 1487973679.045997, "id": 875, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: process-client\nProcess group: proc\nDescription: Not started\nError log file: /var/log/supervisor/process-client-stderr---supervisor-tO0Q6G.log\nStdout log file: /home/vagrant/var/log/process-client.log\nLog file: /home/vagrant/var/log/process-client.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:process-collector"], "timestamp": 1487973679.046013, "id": 876, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: process-collector\nProcess group: proc\nDescription: Not started\nError log file: /var/log/supervisor/process-collector-stderr---supervisor-FwM_Sx.log\nStdout log file: /home/vagrant/var/log/process-collector.log\nLog file: /home/vagrant/var/log/process-collector.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:process-intake"], "timestamp": 1487973679.046036, "id": 877, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: process-intake\nProcess group: proc\nDescription: Not started\nError log file: /var/log/supervisor/process-intake-stderr---supervisor-67jVok.log\nStdout log file: /home/vagrant/var/log/process-intake.log\nLog file: /home/vagrant/var/log/process-intake.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:process-resolver"], "timestamp": 1487973679.046053, "id": 878, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: process-resolver\nProcess group: proc\nDescription: Not started\nError log file: /var/log/supervisor/process-resolver-stderr---supervisor-NvZPEn.log\nStdout log file: /home/vagrant/var/log/process-resolver.log\nLog file: /home/vagrant/var/log/process-resolver.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:process-writer"], "timestamp": 1487973679.046069, "id": 879, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: process-writer\nProcess group: proc\nDescription: Not started\nError log file: /var/log/supervisor/process-writer-stderr---supervisor-tcdpom.log\nStdout log file: /home/vagrant/var/log/process-writer.log\nLog file: /home/vagrant/var/log/process-writer.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:hucklebuck"], "timestamp": 1487973679.046086, "id": 880, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: hucklebuck\nProcess group: services\nDescription: Exited too quickly (process log may have details)\nError log file: /var/log/supervisor/hucklebuck-stderr---supervisor-6uuDJ9.log\nStdout log file: /home/vagrant/var/log/hucklebuck.log\nLog file: /home/vagrant/var/log/hucklebuck.log\nState: FATAL\nStart time: 2017-02-24 20:19:54\nStop time: 2017-02-24 20:19:54\nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:rate-limiter"], "timestamp": 1487973679.046102, "id": 881, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: rate-limiter\nProcess group: services\nDescription: Not started\nError log file: /var/log/supervisor/rate-limiter-stderr---supervisor-PVUFjk.log\nStdout log file: /home/vagrant/var/log/rate-limiter.log\nLog file: /home/vagrant/var/log/rate-limiter.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 2, "tags": ["supervisord_server:server0", "supervisord_process:toxiproxy"], "timestamp": 1487973679.046116, "id": 882, "host_name": "remi-split-payloads", "message": "Current time: 2017-02-24 22:01:18\nProcess name: toxiproxy\nProcess group: tests\nDescription: Not started\nError log file: /var/log/supervisor/toxiproxy-stderr---supervisor-xAR_Ss.log\nStdout log file: /home/vagrant/var/log/toxiproxy.log\nLog file: /home/vagrant/var/log/toxiproxy.log\nState: STOPPED\nStart time: 1970-01-01 00:00:00\nStop time: \nExit Status: 0", "check": "supervisord.process.status"}, {"status": 0, "tags": ["check:supervisord"], "timestamp": 1487973679.046895, "id": 883, "host_name": "remi-split-payloads", "message": null, "check": "datadog.agent.check_status"}, {"status": 0, "tags": ["check:network"], "timestamp": 1487973679.047384, "id": 884, "host_name": "remi-split-payloads", "message": null, "check": "datadog.agent.check_status"}, {"status": 0, "tags": null, "timestamp": 1487973679.047402, "id": 885, "host_name": "remi-split-payloads", "message": null, "check": "datadog.agent.up"}] \ No newline at end of file diff --git a/tests/core/test_emitter.py b/tests/core/test_emitter.py index 09b9c4f147..a579ed5a5e 100644 --- a/tests/core/test_emitter.py +++ b/tests/core/test_emitter.py @@ -23,7 +23,7 @@ def test_payload_splitter(self): with open(FIXTURE_PATH + '/legacy_payload.json') as f: legacy_payload = json.load(f) - legacy_payload_split, metrics_payload = split_payload(dict(legacy_payload)) + legacy_payload_split, metrics_payload, checkruns_payload = split_payload(dict(legacy_payload)) series = metrics_payload['series'] legacy_payload_split['metrics'] = [] @@ -42,8 +42,14 @@ def test_payload_splitter(self): formatted_sample = [s['metric'], s['points'][0][0], s['points'][0][1], attributes] legacy_payload_split['metrics'].append(formatted_sample) + del legacy_payload['service_checks'] self.assertEqual(legacy_payload, legacy_payload_split) + with open(FIXTURE_PATH + '/sc_payload.json') as f: + expected_sc_payload = json.load(f) + + self.assertEqual(checkruns_payload, expected_sc_payload) + def test_remove_control_chars(self): messages = [ (u'#és9df\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00>\x00\x01\x00\x00\x00\x06@\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00´wer0sf®ré', u'#és9dfELF>@@´wer0sf®ré'),