use of com.alibaba.jstorm.common.metric.AsmMeter in project jstorm by alibaba.
the class NettyClient method registerMetrics.
public void registerMetrics() {
if (this.enableNettyMetrics) {
sendTimer = (AsmHistogram) JStormMetrics.registerNettyMetric(MetricUtils.nettyMetricName(AsmMetric.mkName(MetricDef.NETTY_CLI_SEND_TIME, nettyConnection), MetricType.HISTOGRAM), new AsmHistogram());
sendSpeed = (AsmMeter) JStormMetrics.registerNettyMetric(MetricUtils.nettyMetricName(AsmMetric.mkName(MetricDef.NETTY_CLI_SEND_SPEED, nettyConnection), MetricType.METER), new AsmMeter());
CacheGaugeHealthCheck cacheGauge = new CacheGaugeHealthCheck(messageBuffer, MetricDef.NETTY_CLI_CACHE_SIZE + ":" + nettyConnection.toString());
JStormMetrics.registerNettyMetric(MetricUtils.nettyMetricName(AsmMetric.mkName(MetricDef.NETTY_CLI_CACHE_SIZE, nettyConnection), MetricType.GAUGE), new AsmGauge(cacheGauge));
JStormMetrics.registerNettyMetric(MetricUtils.nettyMetricName(AsmMetric.mkName(MetricDef.NETTY_CLI_SEND_PENDING, nettyConnection), MetricType.GAUGE), new AsmGauge(new com.codahale.metrics.Gauge<Double>() {
@Override
public Double getValue() {
return ((Long) pendings.get()).doubleValue();
}
}));
JStormHealthCheck.registerWorkerHealthCheck(MetricDef.NETTY_CLI_CACHE_SIZE + ":" + nettyConnection.toString(), cacheGauge);
}
JStormHealthCheck.registerWorkerHealthCheck(MetricDef.NETTY_CLI_CONNECTION + ":" + nettyConnection.toString(), new HealthCheck() {
HealthCheck.Result healthy = HealthCheck.Result.healthy();
HealthCheck.Result unhealthy = HealthCheck.Result.unhealthy("NettyConnection " + nettyConnection.toString() + " is broken.");
@Override
protected Result check() throws Exception {
if (isChannelReady() == null) {
return unhealthy;
} else {
return healthy;
}
}
});
}
use of com.alibaba.jstorm.common.metric.AsmMeter in project jstorm by alibaba.
the class NettyMetricInstance method register.
public static synchronized void register() {
if (alreadyRegister.compareAndSet(false, true)) {
nettyServerRecvSpeed = (AsmMeter) JStormMetrics.registerWorkerTopologyMetric(JStormMetrics.workerMetricName(MetricDef.NETTY_SRV_RECV_SPEED, MetricType.METER), new AsmMeter());
networkWorkerTransmitTime = (AsmHistogram) JStormMetrics.registerWorkerMetric(MetricUtils.workerMetricName(MetricDef.NETTY_SRV_MSG_TRANS_TIME, MetricType.HISTOGRAM), new AsmHistogram());
totalSendSpeed = (AsmMeter) JStormMetrics.registerWorkerTopologyMetric(JStormMetrics.workerMetricName(MetricDef.NETTY_CLI_SEND_SPEED, MetricType.METER), new AsmMeter());
batchSizeWorkerHistogram = (AsmHistogram) JStormMetrics.registerWorkerMetric(MetricUtils.workerMetricName(MetricDef.NETTY_CLI_BATCH_SIZE, MetricType.HISTOGRAM), new AsmHistogram());
LOG.info("Successfully register netty metrics {}, {}, {}, {}", nettyServerRecvSpeed.getMetricName(), networkWorkerTransmitTime.getMetricName(), totalSendSpeed.getMetricName(), batchSizeWorkerHistogram.getMetricName());
}
}
Aggregations