public EventHubReceiverImpl(EventHubSpoutConfig config, String partitionId) { this.connectionString = config.getConnectionString(); this.entityName = config.getEntityPath(); this.partitionId = partitionId; this.consumerGroupName = config.getConsumerGroupName(); receiveApiLatencyMean = new ReducedMetric(new MeanReducer()); receiveApiCallCount = new CountMetric(); receiveMessageCount = new CountMetric(); }
/** * Registers a metric that averages its values with the configured interval for it (if any). * * @param name The name of the metric to register. * @param context The {@link TopologyContext} to register the metric for. * @return The registered {@link ReducedMetric} that is averaging. */ protected ReducedMetric registerAveragingMetric(String name, TopologyContext context) { return registerMetric(new ReducedMetric(new MeanReducer()), name, context); }
/** * Registers a metric that averages its values with the configured interval for it (if any). * * @param name The name of the metric to register. * @param context The {@link TopologyContext} to register the metric for. * @return The registered {@link ReducedMetric} that is averaging. */ protected ReducedMetric registerAveragingMetric(String name, TopologyContext context) { return registerMetric(new ReducedMetric(new MeanReducer()), name, context); }
@Override public void open(final Map<String, Object> spoutConfig, final TopologyContext topologyContext) { // Load configuration items. // Determine our time bucket window, in seconds, defaulted to 60. int timeBucketSeconds = 60; if (spoutConfig.containsKey(SpoutConfig.METRICS_RECORDER_TIME_BUCKET)) { final Object timeBucketCfgValue = spoutConfig.get(SpoutConfig.METRICS_RECORDER_TIME_BUCKET); if (timeBucketCfgValue instanceof Number) { timeBucketSeconds = ((Number) timeBucketCfgValue).intValue(); } } // Conditionally enable prefixing with taskId if (spoutConfig.containsKey(SpoutConfig.METRICS_RECORDER_ENABLE_TASK_ID_PREFIX)) { final Object taskIdCfgValue = spoutConfig.get(SpoutConfig.METRICS_RECORDER_ENABLE_TASK_ID_PREFIX); if (taskIdCfgValue instanceof Boolean && (Boolean) taskIdCfgValue) { this.metricPrefix = "task-" + topologyContext.getThisTaskIndex(); } } this.keyBuilder = new KeyBuilder(this.metricPrefix); // Log how we got configured. logger.info("Configured with time window of {} seconds and using taskId prefixes?: {}", timeBucketSeconds, Boolean.toString(metricPrefix.isEmpty())); // Register the top level metrics. assignedValues = topologyContext.registerMetric("GAUGES", new MultiAssignableMetric(), timeBucketSeconds); timers = topologyContext.registerMetric("TIMERS", new MultiReducedMetric(new MeanReducer()), timeBucketSeconds); counters = topologyContext.registerMetric("COUNTERS", new MultiCountMetric(), timeBucketSeconds); }
_fetchAPILatencyMean = new ReducedMetric(new MeanReducer()); _fetchAPICallCount = new CountMetric(); _fetchAPIMessageCount = new CountMetric();
public TridentKafkaEmitter(Map conf, TopologyContext context, TridentKafkaConfig config, String topologyInstanceId) { _config = config; _topologyInstanceId = topologyInstanceId; _connections = new DynamicPartitionConnections(_config, KafkaUtils.makeBrokerReader(conf, _config)); _topologyName = (String) conf.get(Config.TOPOLOGY_NAME); _kafkaOffsetMetric = new KafkaUtils.KafkaOffsetMetric(_connections); context.registerMetric("kafkaOffset", _kafkaOffsetMetric, _config.metricsTimeBucketSizeInSecs); _kafkaMeanFetchLatencyMetric = context.registerMetric("kafkaFetchAvg", new MeanReducer(), _config.metricsTimeBucketSizeInSecs); _kafkaMaxFetchLatencyMetric = context.registerMetric("kafkaFetchMax", new MaxMetric(), _config.metricsTimeBucketSizeInSecs); }
@Override @SuppressWarnings({ "rawtypes", "unchecked" }) public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) { super.prepare(stormConf, context, collector); parser = new SiteMapParser(false); sniffWhenNoSMKey = ConfUtils.getBoolean(stormConf, "sitemap.sniffContent", false); filterHoursSinceModified = ConfUtils.getInt(stormConf, "sitemap.filter.hours.since.modified", -1); parseFilters = ParseFilters.fromConf(stormConf); maxOffsetGuess = ConfUtils.getInt(stormConf, "sitemap.offset.guess", 300); averagedMetrics = context.registerMetric( "sitemap_average_processing_time", new ReducedMetric( new MeanReducer()), 30); scheduleSitemapsWithDelay = ConfUtils.getInt(stormConf, "sitemap.schedule.delay", scheduleSitemapsWithDelay); }
new MultiReducedMetric(new MeanReducer()), metricsTimeBucketSecs);
private void initializeAndRegisterAllMetrics(TopologyContext context, int timeBucketSize) { this.failureMetric = new CombinedMetric(new MaxMetric()); this.successCountMetric = new CountMetric(); this.sidelineCountMetric = new CountMetric(); this.internalBufferSize = new CombinedMetric(new MaxMetric()); this.pendingMessageSize = new CombinedMetric(new MaxMetric()); this.currentBinLogFileNumber = new CombinedMetric(new MaxMetric()); this.currentBinLogFilePosition = new CombinedMetric(new MaxMetric()); this.txEventProcessTime = new ReducedMetric(new MeanReducer()); this.txEventFailTimeInTopology = new ReducedMetric(new MeanReducer()); context.registerMetric(SpoutConstants.METRIC_FAILURECOUNT, this.failureMetric, timeBucketSize); context.registerMetric(SpoutConstants.METRIC_SUCCESSCOUNT, this.successCountMetric, timeBucketSize); context.registerMetric(SpoutConstants.METRIC_SIDELINECOUNT, this.sidelineCountMetric, timeBucketSize); context.registerMetric(SpoutConstants.METRIC_BUFFER_SIZE, this.internalBufferSize, timeBucketSize); context.registerMetric(SpoutConstants.METRIC_PENDING_MESSAGES, this.pendingMessageSize, timeBucketSize); context.registerMetric(SpoutConstants.METRIC_TXPROCESSTIME, this.txEventProcessTime, timeBucketSize); context.registerMetric(SpoutConstants.METRIC_BINLOG_FILE_NUM, this.currentBinLogFileNumber, timeBucketSize); context.registerMetric(SpoutConstants.METRIC_BIN_LOG_FILE_POS, this.currentBinLogFilePosition, timeBucketSize); context.registerMetric(SpoutConstants.METRIC_FAIL_MSG_IN_TOPOLOGY, this.txEventFailTimeInTopology, timeBucketSize); }
new MultiReducedMetric(new MeanReducer()), metricsTimeBucketSecs);