Search in sources :

Example 1 with SwitchMeterStats

use of org.openkilda.wfm.topology.stats.model.SwitchMeterStats in project open-kilda by telstra.

the class KildaEntryCacheService method completeAndForwardMeterStats.

/**
 * Process the provided {@link MeterStatsData} by completing it with cached data and forwarding it.
 *
 * @param data the data to process.
 */
public void completeAndForwardMeterStats(MeterStatsData data) {
    SwitchMeterStats stats = new SwitchMeterStats(data.getSwitchId());
    for (MeterStatsEntry entry : data.getStats()) {
        MeterCacheKey key = new MeterCacheKey(data.getSwitchId(), entry.getMeterId());
        stats.add(entry, switchAndMeterToFlow.get(key));
    }
    carrier.emitMeterStats(stats);
}
Also used : MeterCacheKey(org.openkilda.wfm.topology.stats.model.MeterCacheKey) SwitchMeterStats(org.openkilda.wfm.topology.stats.model.SwitchMeterStats) MeterStatsEntry(org.openkilda.messaging.info.stats.MeterStatsEntry)

Example 2 with SwitchMeterStats

use of org.openkilda.wfm.topology.stats.model.SwitchMeterStats in project open-kilda by telstra.

the class MeterStatsMetricGenBolt method handleInput.

@Override
protected void handleInput(Tuple input) throws Exception {
    SwitchMeterStats stats = pullValue(input, STATS_FIELD, SwitchMeterStats.class);
    log.debug("Received meter statistics: {}.", stats);
    long timestamp = getCommandContext().getCreateTime();
    SwitchId switchId = stats.getSwitchId();
    for (MeterStatsAndDescriptor entry : stats.getStatsEntries()) {
        handleStatsData(entry.getData(), timestamp, switchId, entry.getDescriptor());
    }
}
Also used : MeterStatsAndDescriptor(org.openkilda.wfm.topology.stats.model.MeterStatsAndDescriptor) SwitchMeterStats(org.openkilda.wfm.topology.stats.model.SwitchMeterStats) SwitchId(org.openkilda.model.SwitchId)

Aggregations

SwitchMeterStats (org.openkilda.wfm.topology.stats.model.SwitchMeterStats)2 MeterStatsEntry (org.openkilda.messaging.info.stats.MeterStatsEntry)1 SwitchId (org.openkilda.model.SwitchId)1 MeterCacheKey (org.openkilda.wfm.topology.stats.model.MeterCacheKey)1 MeterStatsAndDescriptor (org.openkilda.wfm.topology.stats.model.MeterStatsAndDescriptor)1