use of com.alibaba.jstorm.metric.MetaType in project jstorm by alibaba.
the class RefreshEvent method syncMetaFromRemote.
private void syncMetaFromRemote(String topologyId, TopologyMetricContext tmContext) {
try {
int memSize = tmContext.getMemMeta().size();
//Integer zkSize = (Integer) context.getStormClusterState().get_topology_metric(topologyId);
Set<String> added = new HashSet<>();
List<Pair<MetricMeta, Long>> pairsToCheck = new ArrayList<>();
ConcurrentMap<String, Long> memMeta = tmContext.getMemMeta();
for (MetaType metaType : MetaType.values()) {
List<MetricMeta> metaList = context.getMetricQueryClient().getMetricMeta(context.getClusterName(), topologyId, metaType);
if (metaList != null) {
LOG.debug("get remote metric meta, topology:{}, metaType:{}, local mem:{}, remote:{}", topologyId, metaType, memSize, metaList.size());
for (MetricMeta meta : metaList) {
String fqn = meta.getFQN();
if (added.contains(fqn)) {
Long existingId = memMeta.get(fqn);
if (existingId != null && existingId != meta.getId()) {
LOG.warn("duplicate remote metric meta:{}, will double-check...", fqn);
pairsToCheck.add(new Pair<>(meta, existingId));
}
} else {
// force remote to overwrite local meta
LOG.debug("overwrite local from remote:{}", fqn);
added.add(fqn);
memMeta.put(fqn, meta.getId());
}
}
}
}
context.getMetricCache().putMeta(topologyId, memMeta);
if (pairsToCheck.size() > 0) {
CheckMetricEvent.pushEvent(topologyId, tmContext, pairsToCheck);
}
} catch (Exception ex) {
LOG.error("failed to sync remote meta", ex);
}
}
use of com.alibaba.jstorm.metric.MetaType in project jstorm by alibaba.
the class MetricMeta method getFQN.
public String getFQN() {
MetaType meta = MetaType.parse(metaType);
MetricType metric = MetricType.parse(metricType);
String types = meta.getV() + metric.getV();
if (isWorkerMetric()) {
return MetricUtils.concat2(types, topologyId, host, port, metricGroup, metricName);
}
return MetricUtils.concat2(types, topologyId, component, taskId, streamId, metricGroup, metricName);
}
Aggregations