public HdfsSystemConsumerMetrics(MetricsRegistry metricsRegistry) { this.metricsRegistry = metricsRegistry; this.numEventsCounterMap = new ConcurrentHashMap<>(); this.numTotalEventsCounter = metricsRegistry.newCounter(METRICS_GROUP_NAME, "num-total-events"); }
public void registerSystemStreamPartition(SystemStreamPartition systemStreamPartition) { numEventsCounterMap.putIfAbsent(systemStreamPartition, metricsRegistry.newCounter(METRICS_GROUP_NAME, "num-events-" + systemStreamPartition)); }
public Counter newCounter(String name) { return registry.newCounter(groupName, (prefix + name).toLowerCase()); }
public Counter newCounter(String name) { return registry.newCounter(groupName, (prefix + name).toLowerCase()); }
public BlockingEnvelopeMapMetrics(String group, MetricsRegistry metricsRegistry) { this.group = group; this.metricsRegistry = metricsRegistry; this.noMoreMessageGaugeMap = new ConcurrentHashMap<SystemStreamPartition, Gauge<Boolean>>(); this.blockingPollCountMap = new ConcurrentHashMap<SystemStreamPartition, Counter>(); this.blockingPollTimeoutCountMap = new ConcurrentHashMap<SystemStreamPartition, Counter>(); this.pollCount = metricsRegistry.newCounter(group, "poll-count"); }
public BlockingEnvelopeMapMetrics(String group, MetricsRegistry metricsRegistry) { this.group = group; this.metricsRegistry = metricsRegistry; this.noMoreMessageGaugeMap = new ConcurrentHashMap<SystemStreamPartition, Gauge<Boolean>>(); this.blockingPollCountMap = new ConcurrentHashMap<SystemStreamPartition, Counter>(); this.blockingPollTimeoutCountMap = new ConcurrentHashMap<SystemStreamPartition, Counter>(); this.pollCount = metricsRegistry.newCounter(group, "poll-count"); }
/** * Create a new counter by delegating to the underlying metrics registry * @param name name of the counter * @return newly created counter */ public Counter newCounter(String name) { return metricsRegistry.newCounter(groupName, getMetricFullName(name)); }
/** * Create a new counter by delegating to the underlying metrics registry * @param name name of the counter * @return newly created counter */ public Counter newCounter(String name) { return metricsRegistry.newCounter(groupName, getMetricFullName(name)); }
/** * Create a new counter by delegating to the underlying metrics registry * @param name name of the counter * @return newly created counter */ public Counter newCounter(String name) { return metricsRegistry.newCounter(groupName, getMetricFullName(name)); }
/** * Create a new counter by delegating to the underlying metrics registry * @param name name of the counter * @return newly created counter */ public Counter newCounter(String name) { return metricsRegistry.newCounter(groupName, getMetricFullName(name)); }
/** * Create a new counter by delegating to the underlying metrics registry * @param name name of the counter * @return newly created counter */ public Counter newCounter(String name) { return metricsRegistry.newCounter(groupName, getMetricFullName(name)); }
public void start() { streamIds.forEach(streamId -> { sendCallbackLatency.put(streamId, new SamzaHistogram(metricsRegistry, streamId, SEND_CALLBACK_LATENCY)); sendLatency.put(streamId, new SamzaHistogram(metricsRegistry, streamId, SEND_LATENCY)); sendErrors.put(streamId, metricsRegistry.newCounter(streamId, SEND_ERRORS)); }); if (aggSendLatency == null) { aggSendLatency = new SamzaHistogram(metricsRegistry, AGGREGATE, SEND_LATENCY); aggSendCallbackLatency = new SamzaHistogram(metricsRegistry, AGGREGATE, SEND_CALLBACK_LATENCY); aggSendErrors = metricsRegistry.newCounter(AGGREGATE, SEND_ERRORS); } }
public void initMetrics(SystemStreamPartition systemStreamPartition) { this.noMoreMessageGaugeMap.putIfAbsent(systemStreamPartition, metricsRegistry.<Boolean>newGauge(group, "no-more-messages-" + systemStreamPartition, false)); this.blockingPollCountMap.putIfAbsent(systemStreamPartition, metricsRegistry.newCounter(group, "blocking-poll-count-" + systemStreamPartition)); this.blockingPollTimeoutCountMap.putIfAbsent(systemStreamPartition, metricsRegistry.newCounter(group, "blocking-poll-timeout-count-" + systemStreamPartition)); metricsRegistry.<Integer>newGauge(group, new BufferGauge(systemStreamPartition, "buffered-message-count-" + systemStreamPartition)); metricsRegistry.<Long>newGauge(group, new BufferSizeGauge(systemStreamPartition, "buffered-message-size-" + systemStreamPartition)); }
public void initMetrics(SystemStreamPartition systemStreamPartition) { this.noMoreMessageGaugeMap.putIfAbsent(systemStreamPartition, metricsRegistry.<Boolean>newGauge(group, "no-more-messages-" + systemStreamPartition, false)); this.blockingPollCountMap.putIfAbsent(systemStreamPartition, metricsRegistry.newCounter(group, "blocking-poll-count-" + systemStreamPartition)); this.blockingPollTimeoutCountMap.putIfAbsent(systemStreamPartition, metricsRegistry.newCounter(group, "blocking-poll-timeout-count-" + systemStreamPartition)); metricsRegistry.<Integer>newGauge(group, new BufferGauge(systemStreamPartition, "buffered-message-count-" + systemStreamPartition)); metricsRegistry.<Long>newGauge(group, new BufferSizeGauge(systemStreamPartition, "buffered-message-size-" + systemStreamPartition)); }
/** * initializes the TranslatorOutputMetricsMapFunction before any message is processed * @param context the {@link Context} for this task */ @Override public void init(Context context) { ContainerContext containerContext = context.getContainerContext(); metricsRegistry = containerContext.getContainerMetricsRegistry(); inputEvents = metricsRegistry.newCounter(logicalOpId, TranslatorConstants.INPUT_EVENTS_NAME); inputEvents.clear(); }
@Override public void init(Context context) { this.translatorContext = ((SamzaSqlApplicationContext) context.getApplicationTaskContext()).getTranslatorContexts().get(queryId); this.filter = (LogicalFilter) this.translatorContext.getRelNode(filterId); this.expr = this.translatorContext.getExpressionCompiler().compile(filter.getInputs(), Collections.singletonList(filter.getCondition())); ContainerContext containerContext = context.getContainerContext(); metricsRegistry = containerContext.getContainerMetricsRegistry(); processingTime = new SamzaHistogram(metricsRegistry, logicalOpId, TranslatorConstants.PROCESSING_TIME_NAME); inputEvents = metricsRegistry.newCounter(logicalOpId, TranslatorConstants.INPUT_EVENTS_NAME); inputEvents.clear(); filteredOutEvents = metricsRegistry.newCounter(logicalOpId, TranslatorConstants.FILTERED_EVENTS_NAME); filteredOutEvents.clear(); outputEvents = metricsRegistry.newCounter(logicalOpId, TranslatorConstants.OUTPUT_EVENTS_NAME); outputEvents.clear(); }
/** * initializes the TranslatorOutputMetricsMapFunction before any message is processed * @param context the {@link Context} for this task */ @Override public void init(Context context) { ContainerContext containerContext = context.getContainerContext(); metricsRegistry = containerContext.getContainerMetricsRegistry(); processingTime = new SamzaHistogram(metricsRegistry, logicalOpId, TranslatorConstants.PROCESSING_TIME_NAME); outputEvents = metricsRegistry.newCounter(logicalOpId, TranslatorConstants.OUTPUT_EVENTS_NAME); outputEvents.clear(); }
public static Context getMockContext() { Context context = new MockContext(); MetricsRegistry metricsRegistry = mock(MetricsRegistry.class); doAnswer(args -> new Timer((String) args.getArguments()[0])).when(metricsRegistry).newTimer(anyString(), anyString()); doAnswer(args -> new Counter((String) args.getArguments()[0])).when(metricsRegistry).newCounter(anyString(), anyString()); doAnswer(args -> new Gauge((String) args.getArguments()[0], 0)).when(metricsRegistry).newGauge(anyString(), any()); doReturn(metricsRegistry).when(context.getContainerContext()).getContainerMetricsRegistry(); return context; }
@Override public void init(Context context) { TranslatorContext translatorContext = ((SamzaSqlApplicationContext) context.getApplicationTaskContext()).getTranslatorContexts().get(queryId); this.msgConverter = translatorContext.getMsgConverter(streamName); ContainerContext containerContext = context.getContainerContext(); metricsRegistry = containerContext.getContainerMetricsRegistry(); processingTime = new SamzaHistogram(metricsRegistry, logicalOpId, TranslatorConstants.PROCESSING_TIME_NAME); queryInputEvents = metricsRegistry.newCounter(queryLogicalId, TranslatorConstants.INPUT_EVENTS_NAME); queryInputEvents.clear(); }
private void initTables(boolean isTimerMetricsDisabled, ReadWriteTable ... tables) { Map<String, String> config = new HashMap<>(); if (isTimerMetricsDisabled) { config.put(MetricsConfig.METRICS_TIMER_ENABLED(), "false"); } Context context = new MockContext(); doReturn(new MapConfig(config)).when(context.getJobContext()).getConfig(); metricsRegistry = mock(MetricsRegistry.class); doReturn(mock(Timer.class)).when(metricsRegistry).newTimer(anyString(), anyString()); doReturn(mock(Counter.class)).when(metricsRegistry).newCounter(anyString(), anyString()); doReturn(mock(Gauge.class)).when(metricsRegistry).newGauge(anyString(), any()); doReturn(metricsRegistry).when(context.getContainerContext()).getContainerMetricsRegistry(); Arrays.asList(tables).forEach(t -> t.init(context)); }