Skip to content

Commit

Permalink
Display the service check in the JsonReporter
Browse files Browse the repository at this point in the history
We can add the service check in the output that we produce, that will
make it available in end to end testing.
  • Loading branch information
therve committed Feb 21, 2020
1 parent 75a78f6 commit c3bd5cd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/org/datadog/jmxfetch/reporter/JsonReporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,19 @@ protected void sendMetricPoint(

/** Use the service check callback to display the JSON. */
public void doSendServiceCheck(String checkName, String status, String message, String[] tags) {
Map<String, Object> sc = new HashMap<String, Object>();
sc.put("check", checkName);
sc.put("host_name", "default");
sc.put("timestamp", System.currentTimeMillis() / 1000);
sc.put("status", status);
sc.put("message", message);
sc.put("tags", tags);

Map<String, Object> aggregator = new HashMap<String, Object>();
aggregator.put("metrics", metrics);
List<Object> serviceChecks = new ArrayList<Object>();
serviceChecks.add(sc);
aggregator.put("service_checks", serviceChecks);
Map<String, Object> serie = new HashMap<String, Object>();
serie.put("aggregator", aggregator);
List<Map<String, Object>> series = new ArrayList<Map<String, Object>>(1);
Expand Down

0 comments on commit c3bd5cd

Please sign in to comment.