Search in sources :

Example 1 with TopicProcessMeta

use of co.cask.cdap.metrics.process.TopicProcessMeta in project cdap by caskdata.

the class DefaultMetricStore method getMetricsProcessorStats.

/**
 * Read the metrics processing stats from meta table and return the map of topic information to stats
 * @return Map of topic to metrics processing stats
 * @throws Exception
 */
@Override
public Map<String, MetricsProcessorStatus> getMetricsProcessorStats() throws Exception {
    MetricsConsumerMetaTable metaTable = metaTableSupplier.get();
    Map<String, MetricsProcessorStatus> processMap = new HashMap<>();
    for (TopicId topicId : metricsTopics) {
        TopicProcessMeta topicProcessMeta = metaTable.getTopicProcessMeta(new TopicIdMetaKey(topicId));
        if (topicProcessMeta != null) {
            MessageId messageId = new MessageId(topicProcessMeta.getMessageId());
            MetricsMessageId metricsMessageId = new MetricsMessageId(messageId.getPublishTimestamp(), messageId.getSequenceId(), messageId.getPayloadWriteTimestamp(), messageId.getPayloadSequenceId());
            processMap.put(topicId.getTopic(), new MetricsProcessorStatus(metricsMessageId, topicProcessMeta.getOldestMetricsTimestamp(), topicProcessMeta.getLatestMetricsTimestamp(), topicProcessMeta.getMessagesProcessed(), topicProcessMeta.getLastProcessedTimestamp()));
        }
    }
    return processMap;
}
Also used : MetricsConsumerMetaTable(co.cask.cdap.metrics.process.MetricsConsumerMetaTable) TopicProcessMeta(co.cask.cdap.metrics.process.TopicProcessMeta) TopicIdMetaKey(co.cask.cdap.metrics.process.TopicIdMetaKey) HashMap(java.util.HashMap) TopicId(co.cask.cdap.proto.id.TopicId) MetricsProcessorStatus(co.cask.cdap.api.metrics.MetricsProcessorStatus) MetricsMessageId(co.cask.cdap.api.metrics.MetricsMessageId) MetricsMessageId(co.cask.cdap.api.metrics.MetricsMessageId) MessageId(co.cask.cdap.messaging.data.MessageId)

Aggregations

MetricsMessageId (co.cask.cdap.api.metrics.MetricsMessageId)1 MetricsProcessorStatus (co.cask.cdap.api.metrics.MetricsProcessorStatus)1 MessageId (co.cask.cdap.messaging.data.MessageId)1 MetricsConsumerMetaTable (co.cask.cdap.metrics.process.MetricsConsumerMetaTable)1 TopicIdMetaKey (co.cask.cdap.metrics.process.TopicIdMetaKey)1 TopicProcessMeta (co.cask.cdap.metrics.process.TopicProcessMeta)1 TopicId (co.cask.cdap.proto.id.TopicId)1 HashMap (java.util.HashMap)1