com.springframework.boxes.jmetric.starter.pipeline.SystemPipeline Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spring-boxes-metric-starter Show documentation
Show all versions of spring-boxes-metric-starter Show documentation
spring-metric-boxes-boot-starter
package com.springframework.boxes.jmetric.starter.pipeline;
import com.google.common.collect.Maps;
import com.springframework.boxes.jmetric.starter.BoxesMetricCollector;
import com.springframework.boxes.jmetric.starter.BoxesMetricPipeline;
import org.apache.commons.lang3.StringUtils;
import java.util.Map;
import java.util.Optional;
public class SystemPipeline implements BoxesMetricPipeline {
@Override
public void pipeline(BoxesMetricCollector collector, String key, Object value, long milliseconds) {
if (null == collector || StringUtils.isBlank(key) || null == value) {
return;
}
System.out.println("System::pipeline: { host_name: " + getHostIP() + ", metric_key:" + key + ", metric_value:" + value + ", milliseconds:" + milliseconds + "}");
}
@Override
public void pipeline(BoxesMetricCollector collector, Map metrics, long milliseconds) {
Optional.ofNullable(metrics).orElse(Maps.newHashMap()).forEach((k, v) -> {
this.pipeline(collector, k, v, milliseconds);
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy