16 package org.openkilda.wfm.topology.stats.metrics;
31 import com.google.common.collect.ImmutableMap;
32 import org.apache.storm.tuple.Tuple;
33 import org.slf4j.Logger;
34 import org.slf4j.LoggerFactory;
36 import java.util.HashMap;
40 private static final Logger LOGGER = LoggerFactory.getLogger(
PortMetricGenBolt.class);
42 private Map<SwitchId, SwitchId> switchNameCache =
new HashMap<>();
54 LOGGER.debug(
"Port stats message: {}={}, component={}, stream={}", CORRELATION_ID, message.
getCorrelationId(),
60 SwitchId switchId = switchNameCache.get(
data.getSwitchId());
61 if (switchId == null) {
62 switchId =
data.getSwitchId();
63 switchNameCache.put(
data.getSwitchId(), switchId);
68 emit(entry, timestamp, switchId);
78 Map<String, String> tags = ImmutableMap.of(
97 }
catch (JsonEncodeException e) {
98 LOGGER.error(
"Error during serialization of datapoint", e);
static final String MESSAGE_FIELD
void execute(Tuple input)
OutputCollector collector
static List< Object > tuple(String metric, long timestamp, Number value, Map< String, String > tag)
static final String CORRELATION_ID
Destination getDestination()
String getCorrelationId()