Search in sources :

Example 1 with MetricsConsumerMetaTable

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

the class DefaultMetricDatasetFactory method createConsumerMeta.

@Override
public MetricsConsumerMetaTable createConsumerMeta() {
    String tableName = cConf.get(Constants.Metrics.KAFKA_META_TABLE);
    MetricsTable table = getOrCreateMetricsTable(tableName, DatasetProperties.EMPTY);
    return new MetricsConsumerMetaTable(table);
}
Also used : MetricsConsumerMetaTable(co.cask.cdap.metrics.process.MetricsConsumerMetaTable) CombinedHBaseMetricsTable(co.cask.cdap.data2.dataset2.lib.table.hbase.CombinedHBaseMetricsTable) MetricsTable(co.cask.cdap.data2.dataset2.lib.table.MetricsTable)

Example 2 with MetricsConsumerMetaTable

use of co.cask.cdap.metrics.process.MetricsConsumerMetaTable 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

MetricsConsumerMetaTable (co.cask.cdap.metrics.process.MetricsConsumerMetaTable)2 MetricsMessageId (co.cask.cdap.api.metrics.MetricsMessageId)1 MetricsProcessorStatus (co.cask.cdap.api.metrics.MetricsProcessorStatus)1 MetricsTable (co.cask.cdap.data2.dataset2.lib.table.MetricsTable)1 CombinedHBaseMetricsTable (co.cask.cdap.data2.dataset2.lib.table.hbase.CombinedHBaseMetricsTable)1 MessageId (co.cask.cdap.messaging.data.MessageId)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