All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.springframework.boxes.jmetric.starter.pipeline.SystemPipeline Maven / Gradle / Ivy

There is a newer version: 2.0.9
Show newest version
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