com.clickzetta.platform.metrics.SessionMergeMetrics Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clickzetta-java Show documentation
Show all versions of clickzetta-java Show documentation
The java SDK for clickzetta's Lakehouse
package com.clickzetta.platform.metrics;
import com.codahale.metrics.Meter;
import com.codahale.metrics.Metric;
import com.codahale.metrics.Timer;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public class SessionMergeMetrics extends MetricBase {
private Meter pushDataQPS;
private Meter pushDataFailedQPS;
private Meter pushDataRecordCount;
private Timer pushDataE2ELatency;
private Meter pushDataThroughput;
public SessionMergeMetrics(Map namespaceMap) {
super(namespaceMap);
pushDataQPS = register("pushDataQPS", new Meter());
pushDataFailedQPS = register("pushDataFailedQPS", new Meter());
pushDataRecordCount = register("pushDataRecordCount", new Meter());
pushDataE2ELatency = register("pushDataE2ELatency", new Timer());
pushDataThroughput = register("pushDataThroughput", new Meter());
}
public MetricBase mergeMetricBase(MetricBase metricBase) {
Map metricMap = metricBase.getMetrics();
for (Map.Entry entry : metricMap.entrySet()) {
if (entry.getKey().contains("pushDataQPS")) {
pushDataQPS.mark(((Meter) entry.getValue()).getCount());
} else if (entry.getKey().contains("pushDataFailedQPS")) {
pushDataFailedQPS.mark(((Meter) entry.getValue()).getCount());
} else if (entry.getKey().contains("pushDataRecordCount")) {
pushDataRecordCount.mark(((Meter) entry.getValue()).getCount());
} else if (entry.getKey().contains("pushDataE2ELatency")) {
pushDataE2ELatency.update(new Double(((Timer) entry.getValue()).getOneMinuteRate()).longValue(), TimeUnit.SECONDS);
} else if (entry.getKey().contains("pushDataThroughput")) {
pushDataThroughput.mark(((Meter) entry.getValue()).getCount());
} else {
// ignore.
}
}
return this;
}
public Meter getPushDataQPS() {
return pushDataQPS;
}
public Meter getPushDataFailedQPS() {
return pushDataFailedQPS;
}
public Meter getPushDataRecordCount() {
return pushDataRecordCount;
}
public Timer getPushDataE2ELatency() {
return pushDataE2ELatency;
}
public Meter getPushDataThroughput() {
return pushDataThroughput;
}
@Override
protected void recoveryFromMetrics(List metric) {
pushDataQPS = (Meter) metric.get(0);
pushDataFailedQPS = (Meter) metric.get(1);
pushDataRecordCount = (Meter) metric.get(2);
pushDataE2ELatency = (Timer) metric.get(3);
pushDataThroughput = (Meter) metric.get(4);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy