use of com.nextdoor.bender.monitoring.Tag in project bender by Nextdoor.
the class DataDogReporter method write.
@Override
public void write(ArrayList<Stat> stats, long invokeTimeMs, Set<Tag> tags) {
Set<Tag> allTags = new HashSet<Tag>();
/*
* DataDog only tracks to second precision
*/
long ts = invokeTimeMs / 1000;
for (Stat stat : stats) {
allTags.addAll(tags);
allTags.addAll(stat.getTags());
String tagsString = allTags.stream().map(e -> formatEntry(e.getKey(), e.getValue())).collect(Collectors.joining(","));
/*
* MONITORING|unix_epoch_timestamp|value|metric_type|my.metric.name|#tag1:value,tag2
*/
String[] logParts = { "MONITORING", "" + ts, "" + stat.getValue(), stat.getType().name(), prefix + "." + stat.getName(), "#" + tagsString };
allTags.clear();
System.out.println(String.join("|", logParts));
}
}
Aggregations