/** * Get name of the timer that tracks incoming HTTP connections */ protected String httpConnections() { return name(HttpConnectionFactory.class, bindHost, Integer.toString(port), "connections"); }
@Override public void initialize() { metricRegistry.register(MetricRegistry.name(IndexFailuresPeriodical.class, "queueSize"), new Gauge<Integer>() { @Override public Integer getValue() { return messages.getIndexFailureQueue().size(); } }); }
protected String chooseName(String explicitName, boolean absolute, Method method, String... suffixes) { if (explicitName != null && !explicitName.isEmpty()) { if (absolute) { return explicitName; } return name(method.getDeclaringClass(), explicitName); } return name(name(method.getDeclaringClass(), method.getName()), suffixes); }
@Inject public DnsLookupDataAdapter(@Assisted("id") String id, @Assisted("name") String name, @Assisted LookupDataAdapterConfiguration config, MetricRegistry metricRegistry) { super(id, name, config, metricRegistry); this.config = (Config) config; this.errorCounter = metricRegistry.counter(MetricRegistry.name(getClass(), id, ERROR_COUNTER)); this.resolveDomainNameTimer = metricRegistry.timer(MetricRegistry.name(getClass(), id, TIMER_RESOLVE_DOMAIN_NAME)); this.reverseLookupTimer = metricRegistry.timer(MetricRegistry.name(getClass(), id, TIMER_REVERSE_LOOKUP)); this.textLookupTimer = metricRegistry.timer(MetricRegistry.name(getClass(), id, TIMER_TEXT_LOOKUP)); }
private Meter getExceptionMeter(String streamId) { Meter meter = this.streamExceptionMeters.get(streamId); if (meter == null) { meter = metricRegistry.meter(MetricRegistry.name(Stream.class, streamId, "matchingExceptions")); this.streamExceptionMeters.put(streamId, meter); } return meter; }
@Inject public JournallingMessageHandler(MetricRegistry metrics, Journal journal, @Named("JournalSignal") Semaphore journalFilled) { this.journal = journal; this.journalFilled = journalFilled; byteCounter = metrics.counter(MetricRegistry.name(JournallingMessageHandler.class, "written_bytes")); }
@Inject public DiscardMessageOutput(final Journal journal, final MetricRegistry metricRegistry) { this.journal = journal; this.messagesDiscarded = metricRegistry.meter(name(this.getClass(), "messagesDiscarded")); isRunning.set(true); }
@Inject public WidgetResultCache(MetricRegistry metricRegistry, WidgetStrategyFactory widgetStrategyFactory) { this.metricRegistry = metricRegistry; this.widgetStrategyFactory = widgetStrategyFactory; this.cache = Maps.newConcurrentMap(); this.counter = metricRegistry.counter(name(getClass(), "cacheEntries")); }
@Inject public Messages(MetricRegistry metricRegistry, JestClient client) { invalidTimestampMeter = metricRegistry.meter(name(Messages.class, "invalid-timestamps")); outputByteCounter = metricRegistry.counter(GlobalMetricNames.OUTPUT_TRAFFIC); systemTrafficCounter = metricRegistry.counter(GlobalMetricNames.SYSTEM_OUTPUT_TRAFFIC); this.client = client; // TODO: Magic number this.indexFailureQueue = new LinkedBlockingQueue<>(1000); }
@AssistedInject public ProcessBufferProcessor(MetricRegistry metricRegistry, OrderedMessageProcessors orderedMessageProcessors, OutputBuffer outputBuffer, @Assisted DecodingProcessor decodingProcessor, @DefaultStream Provider<Stream> defaultStreamProvider) { this.orderedMessageProcessors = orderedMessageProcessors; this.outputBuffer = outputBuffer; this.decodingProcessor = decodingProcessor; this.defaultStreamProvider = defaultStreamProvider; incomingMessages = metricRegistry.meter(name(ProcessBufferProcessor.class, "incomingMessages")); outgoingMessages = metricRegistry.meter(name(ProcessBufferProcessor.class, "outgoingMessages")); processTime = metricRegistry.timer(name(ProcessBufferProcessor.class, "processTime")); }
private ScheduledExecutorService executorService(final MetricRegistry metricRegistry) { final ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("systemjob-executor-%d").build(); return new InstrumentedScheduledExecutorService( Executors.newScheduledThreadPool(THREAD_POOL_SIZE, threadFactory), metricRegistry, name(this.getClass(), "executor-service")); }
private ThreadFactory threadFactory(String name, MetricRegistry metricRegistry) { final String threadFactoryMetricName = MetricRegistry.name(name, "thread-factory"); final ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("netty-transport-%d").build(); return new InstrumentedThreadFactory(threadFactory, metricRegistry, threadFactoryMetricName); }
/** * Register the metrics attached to this stage. * * @param metricRegistry the registry to add the metrics to */ public void registerMetrics(MetricRegistry metricRegistry, String pipelineId) { meterName = name(Pipeline.class, pipelineId, "stage", String.valueOf(stage()), "executed"); executed = metricRegistry.meter(meterName); }
private ExecutorService executorService(int nThreads) { final ThreadFactory threadFactory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat("eventbus-handler-%d").build(); return new InstrumentedExecutorService( Executors.newFixedThreadPool(nThreads, threadFactory), metricRegistry, name(this.getClass(), "executor-service")); } }
private ExecutorService executorService(final MetricRegistry metricRegistry, final String nameFormat, final int corePoolSize, final int maxPoolSize, final int keepAliveTime) { final ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat(nameFormat).build(); return new InstrumentedExecutorService( new ThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTime, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), threadFactory), metricRegistry, name(this.getClass(), "executor-service")); }
private ExecutorService executorService(MetricRegistry metricRegistry) { final ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("buffer-synchronizer-%d").build(); return new InstrumentedExecutorService( Executors.newSingleThreadExecutor(threadFactory), metricRegistry, name(this.getClass(), "executor-service")); } }
private ExecutorService executorService(int nThreads) { final ThreadFactory threadFactory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat("cluster-eventbus-handler-%d").build(); return new InstrumentedExecutorService( Executors.newFixedThreadPool(nThreads, threadFactory), metricRegistry, name("cluster-eventbus", "executor-service")); } }
@Subscribe public void handlePipelineChanges(PipelinesChangedEvent event) { event.deletedPipelineIds().forEach(id -> { log.debug("Invalidated pipeline {}", id); metricRegistry.removeMatching((name, metric) -> name.startsWith(name(Pipeline.class, id))); }); event.updatedPipelineIds().forEach(id -> log.debug("Refreshing pipeline {}", id)); scheduler.schedule(() -> serverEventBus.post(reloadAndSave()), 0, TimeUnit.SECONDS); }
/** * Register the metrics attached to this pipeline. * * @param metricRegistry the registry to add the metrics to */ public void registerMetrics(MetricRegistry metricRegistry) { if (id() != null) { metricName = MetricRegistry.name(Pipeline.class, id(), "executed"); executed = metricRegistry.meter(metricName); } }