use of com.ctrip.xpipe.metric.MetricProxyException in project x-pipe by ctripcorp.
the class HickwallMetric method log.
@Override
public void log(String desc, String metricSub, long delayNanos) {
MetricData metricData = new MetricData(desc, clusterKey, metricSub);
metricData.setTimestampMilli(System.currentTimeMillis());
metricData.setValue(delayNanos);
try {
metricProxy.writeBinMultiDataPoint(Lists.newArrayList(metricData));
} catch (MetricProxyException e) {
logger.error("[log]", e);
}
}
use of com.ctrip.xpipe.metric.MetricProxyException in project x-pipe by ctripcorp.
the class HickwallMetricTest method testHickWall.
@Test
public void testHickWall() throws MetricProxyException, IOException {
int port = 11111;
logger.info("[testHickWall]{}", port);
scheduled.scheduleAtFixedRate(new AbstractExceptionLogTask() {
@Override
protected void doRun() throws Exception {
List<MetricData> data = new LinkedList<>();
HostPort hostPort = new HostPort("127.0.0.1", port);
MetricData metricData = new MetricData("delay", "cluster", "shard");
metricData.setValue(1000);
metricData.setHostPort(hostPort);
metricData.setTimestampMilli(System.currentTimeMillis());
data.add(metricData);
hickwallMetricProxy.writeBinMultiDataPoint(data);
}
}, 0, 2, TimeUnit.SECONDS);
waitForAnyKeyToExit();
}
Aggregations