Java Code Examples for com.codahale.metrics.MetricRegistry#meter()
The following examples show how to use
com.codahale.metrics.MetricRegistry#meter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FeedRefreshUpdater.java From commafeed with Apache License 2.0 | 6 votes |
@Inject public FeedRefreshUpdater(SessionFactory sessionFactory, FeedUpdateService feedUpdateService, PubSubService pubSubService, FeedQueues queues, CommaFeedConfiguration config, MetricRegistry metrics, FeedSubscriptionDAO feedSubscriptionDAO, CacheService cache) { this.sessionFactory = sessionFactory; this.feedUpdateService = feedUpdateService; this.pubSubService = pubSubService; this.queues = queues; this.config = config; this.feedSubscriptionDAO = feedSubscriptionDAO; this.cache = cache; ApplicationSettings settings = config.getApplicationSettings(); int threads = Math.max(settings.getDatabaseUpdateThreads(), 1); pool = new FeedRefreshExecutor("feed-refresh-updater", threads, Math.min(50 * threads, 1000), metrics); locks = Striped.lazyWeakLock(threads * 100000); entryCacheMiss = metrics.meter(MetricRegistry.name(getClass(), "entryCacheMiss")); entryCacheHit = metrics.meter(MetricRegistry.name(getClass(), "entryCacheHit")); feedUpdated = metrics.meter(MetricRegistry.name(getClass(), "feedUpdated")); entryInserted = metrics.meter(MetricRegistry.name(getClass(), "entryInserted")); }
Example 2
Source File: VcrMetrics.java From ambry with Apache License 2.0 | 6 votes |
public VcrMetrics(MetricRegistry registry) { this.registry = registry; blobEncryptionCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobEncryptionCount")); blobDecryptionCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobDecryptionCount")); blobEncryptionErrorCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobEncryptionErrorCount")); blobDecryptionErrorCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobDecryptionErrorCount")); blobEncryptionTime = registry.timer(MetricRegistry.name(CloudBlobStore.class, "BlobEncryptionTime")); blobDecryptionTime = registry.timer(MetricRegistry.name(CloudBlobStore.class, "BlobDecryptionTime")); blobUploadSkippedCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobUploadSkippedCount")); updateTtlNotSetError = registry.counter(MetricRegistry.name(CloudBlobStore.class, "UpdateTtlNotSetError")); blobCacheLookupCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobCacheLookupCount")); blobCacheHitCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "BlobCacheHitCount")); retryCount = registry.counter(MetricRegistry.name(CloudBlobStore.class, "RetryCount")); retryWaitTimeMsec = registry.counter(MetricRegistry.name(CloudBlobStore.class, "RetryWaitTimeMsec")); blobCompactionRate = registry.meter(MetricRegistry.name(CloudStorageCompactor.class, "BlobCompactionRate")); compactionFailureCount = registry.counter(MetricRegistry.name(CloudStorageCompactor.class, "CompactionFailureCount")); compactionShutdownTimeoutCount = registry.counter(MetricRegistry.name(CloudStorageCompactor.class, "CompactionShutdownTimeoutCount")); addPartitionErrorCount = registry.counter(MetricRegistry.name(VcrReplicationManager.class, "AddPartitionErrorCount")); removePartitionErrorCount = registry.counter(MetricRegistry.name(VcrReplicationManager.class, "RemovePartitionErrorCount")); tokenReloadWarnCount = registry.counter(MetricRegistry.name(VcrReplicationManager.class, "TokenReloadWarnCount")); }
Example 3
Source File: AstyanaxDataWriterDAO.java From emodb with Apache License 2.0 | 6 votes |
@Inject public AstyanaxDataWriterDAO(@AstyanaxWriterDAODelegate DataWriterDAO delegate, AstyanaxKeyScanner keyScanner, FullConsistencyTimeProvider fullConsistencyTimeProvider, HistoryStore historyStore, HintsConsistencyTimeProvider rawConsistencyTimeProvider, ChangeEncoder changeEncoder, MetricRegistry metricRegistry, DAOUtils daoUtils, @BlockSize int deltaBlockSize, @PrefixLength int deltaPrefixLength) { _cqlWriterDAO = checkNotNull(delegate, "delegate"); _keyScanner = checkNotNull(keyScanner, "keyScanner"); _fullConsistencyTimeProvider = checkNotNull(fullConsistencyTimeProvider, "fullConsistencyTimeProvider"); _rawConsistencyTimeProvider = checkNotNull(rawConsistencyTimeProvider, "rawConsistencyTimeProvider"); _historyStore = checkNotNull(historyStore, "historyStore"); _changeEncoder = checkNotNull(changeEncoder, "changeEncoder"); _updateMeter = metricRegistry.meter(getMetricName("updates")); _oversizeUpdateMeter = metricRegistry.meter(getMetricName("oversizeUpdates")); _daoUtils = daoUtils; _deltaPrefix = StringUtils.repeat('0', deltaPrefixLength); _deltaPrefixLength = deltaPrefixLength; }
Example 4
Source File: FeedQueues.java From commafeed with Apache License 2.0 | 6 votes |
@Inject public FeedQueues(SessionFactory sessionFactory, FeedDAO feedDAO, CommaFeedConfiguration config, MetricRegistry metrics) { this.sessionFactory = sessionFactory; this.config = config; this.feedDAO = feedDAO; refill = metrics.meter(MetricRegistry.name(getClass(), "refill")); metrics.register(MetricRegistry.name(getClass(), "addQueue"), new Gauge<Integer>() { @Override public Integer getValue() { return addQueue.size(); } }); metrics.register(MetricRegistry.name(getClass(), "takeQueue"), new Gauge<Integer>() { @Override public Integer getValue() { return takeQueue.size(); } }); metrics.register(MetricRegistry.name(getClass(), "giveBackQueue"), new Gauge<Integer>() { @Override public Integer getValue() { return giveBackQueue.size(); } }); }
Example 5
Source File: SupervisorMetricsImpl.java From helios with Apache License 2.0 | 5 votes |
public SupervisorMetricsImpl(final String group, final MetricRegistry registry) { final String prefix = MetricRegistry.name(group, TYPE) + "."; containerStartedCounter = registry.counter(prefix + "container_started_counter"); containersExitedCounter = registry.counter(prefix + "containers_exited_counter"); containersRunningCounter = registry.counter(prefix + "containers_running_counter"); containersThrewExceptionCounter = registry.counter( prefix + "containers_threw_exception_counter"); imageCacheHitCounter = registry.counter(prefix + "image_cache_hit_counter"); supervisorClosedCounter = registry.counter(prefix + "supervisor_closed_counter"); supervisorStartedCounter = registry.counter(prefix + "supervisors_created_counter"); supervisorStoppedCounter = registry.counter(prefix + "supervisor_stopped_counter"); supervisorRunCounter = registry.counter(prefix + "supervisor_run_counter"); dockerTimeoutCounter = registry.counter(prefix + "docker_timeout_counter"); containerStartedMeter = registry.meter(prefix + "container_started_meter"); containersExitedMeter = registry.meter(prefix + "containers_exited_meter"); containersRunningMeter = registry.meter(prefix + "containers_running_meter"); containersThrewExceptionMeter = registry.meter(prefix + "containers_threw_exception_meter"); imageCacheHitMeter = registry.meter(prefix + "image_cache_hit_meter"); supervisorClosedMeter = registry.meter(prefix + "supervisor_closed_meter"); supervisorStartedMeter = registry.meter(prefix + "supervisors_created_meter"); supervisorStoppedMeter = registry.meter(prefix + "supervisor_stopped_meter"); supervisorRunMeter = registry.meter(prefix + "supervisor_run_meter"); dockerTimeoutMeter = registry.meter(prefix + "docker_timeout_meter"); imagePull = new RequestMetrics(group, TYPE, "image_pull", registry); }
Example 6
Source File: EventTypeMetrics.java From nakadi with MIT License | 5 votes |
public EventTypeMetrics(final String eventTypeName, final MetricRegistry metricRegistry) { this.eventTypeName = eventTypeName; this.metricRegistry = metricRegistry; eventCountMeter = metricRegistry.meter(metricNameFor(eventTypeName, "publishing.events")); eventsPerBatchHistogram = metricRegistry.histogram(metricNameFor(eventTypeName, "publishing.eventsPerBatch")); averageEventSizeInBytesHistogram = metricRegistry.histogram( metricNameFor(eventTypeName, "publishing.averageEventSizeInBytes")); publishingTimer = metricRegistry.timer(metricNameFor(eventTypeName, "publishing")); }
Example 7
Source File: RestRequestMetrics.java From ambry with Apache License 2.0 | 5 votes |
/** * Creates an instance of RestRequestMetrics for {@code requestType} and attaches all the metrics related to the * request to the given {@code ownerClass}. The metrics are also registered in the provided {@code metricRegistry}. * @param ownerClass the {@link Class} that is supposed to own the metrics created by this tracker. * @param requestType the type of request for which a tracker is being created. * @param metricRegistry the {@link MetricRegistry} to use to register the created metrics. */ public RestRequestMetrics(Class ownerClass, String requestType, MetricRegistry metricRegistry) { if (ownerClass == null || requestType == null || metricRegistry == null) { throw new IllegalArgumentException( "Null arg(s) during instantiation. Owner class - [" + ownerClass + "]. Request type - [" + requestType + "]. Metric registry - [" + metricRegistry + "]"); } nioRequestProcessingTimeInMs = metricRegistry.histogram(MetricRegistry.name(ownerClass, requestType + NIO_REQUEST_PROCESSING_TIME_SUFFIX)); nioResponseProcessingTimeInMs = metricRegistry.histogram(MetricRegistry.name(ownerClass, requestType + NIO_RESPONSE_PROCESSING_TIME_SUFFIX)); nioRoundTripTimeInMs = metricRegistry.histogram(MetricRegistry.name(ownerClass, requestType + NIO_ROUND_TRIP_TIME_SUFFIX)); nioTimeToFirstByteInMs = metricRegistry.histogram(MetricRegistry.name(ownerClass, requestType + NIO_TIME_TO_FIRST_BYTE_SUFFIX)); scRequestProcessingTimeInMs = metricRegistry.histogram(MetricRegistry.name(ownerClass, requestType + SC_REQUEST_PROCESSING_TIME_SUFFIX)); scRequestProcessingWaitTimeInMs = metricRegistry.histogram(MetricRegistry.name(ownerClass, requestType + SC_REQUEST_PROCESSING_WAIT_TIME_SUFFIX)); scResponseProcessingTimeInMs = metricRegistry.histogram(MetricRegistry.name(ownerClass, requestType + SC_RESPONSE_PROCESSING_TIME_SUFFIX)); scResponseProcessingWaitTimeInMs = metricRegistry.histogram( MetricRegistry.name(ownerClass, requestType + SC_RESPONSE_PROCESSING_WAIT_TIME_SUFFIX)); scRoundTripTimeInMs = metricRegistry.histogram(MetricRegistry.name(ownerClass, requestType + SC_ROUND_TRIP_TIME_SUFFIX)); operationRate = metricRegistry.meter(MetricRegistry.name(ownerClass, requestType + OPERATION_RATE_SUFFIX)); operationError = metricRegistry.counter(MetricRegistry.name(ownerClass, requestType + OPERATION_ERROR_SUFFIX)); operationCount = metricRegistry.counter(MetricRegistry.name(ownerClass, requestType + OPERATION_COUNT_SUFFIX)); unsatisfiedRequestCount = metricRegistry.counter(MetricRegistry.name(ownerClass, requestType + UNSATISFIED_REQUEST_COUNT_SUFFIX)); satisfiedRequestCount = metricRegistry.counter(MetricRegistry.name(ownerClass, requestType + SATISFIED_REQUEST_COUNT_SUFFIX)); }
Example 8
Source File: DiagnosticsImpl.java From hawkular-agent with Apache License 2.0 | 5 votes |
public DiagnosticsImpl( AgentCoreEngineConfiguration.DiagnosticsConfiguration config, MetricRegistry registry, String feedId) { // we don't need config now, but maybe in future - so keep "config" param here for future API consistency this.dmrDiagnostics = newDiagnostics("dmr", feedId, registry); this.jmxDiagnostics = newDiagnostics("jmx", feedId, registry); this.platformDiagnostics = newDiagnostics("platform", feedId, registry); storageError = registry.meter(name(feedId, "storage.error-rate")); inventoryRate = registry.meter(name(feedId, "inventory.rate")); inventoryStorageRequestTimer = registry.timer(name(feedId, "inventory.storage-request-timer")); this.metricsRegistry = registry; }
Example 9
Source File: MasterRequestMetrics.java From helios with Apache License 2.0 | 5 votes |
public MasterRequestMetrics(String group, String type, String requestName, final MetricRegistry registry) { final String prefix = name(group, type, requestName); successCounter = registry.counter(prefix + "_count_success"); failureCounter = registry.counter(prefix + "_count_failures"); userErrorCounter = registry.counter(prefix + "_count_usererror"); successMeter = registry.meter(prefix + "_meter_success"); failureMeter = registry.meter(prefix + "_meter_failures"); userErrorMeter = registry.meter(prefix + "_meter_usererror"); }
Example 10
Source File: AstyanaxStorageProvider.java From emodb with Apache License 2.0 | 5 votes |
@Inject public AstyanaxStorageProvider(@BlobReadConsistency ConsistencyLevel readConsistency, MetricRegistry metricRegistry) { _readConsistency = Objects.requireNonNull(readConsistency, "readConsistency"); _tokenFactory = new ByteOrderedPartitioner().getTokenFactory(); _blobReadMeter = metricRegistry.meter(getMetricName("blob-read")); _blobWriteMeter = metricRegistry.meter(getMetricName("blob-write")); _blobDeleteMeter = metricRegistry.meter(getMetricName("blob-delete")); _blobCopyMeter = metricRegistry.meter(getMetricName("blob-copy")); _blobMetadataReadMeter = metricRegistry.meter(getMetricName("blob-metadata-read")); _blobMetadataWriteMeter = metricRegistry.meter(getMetricName("blob-metadata-write")); _blobMetadataDeleteMeter = metricRegistry.meter(getMetricName("blob-metadata-delete")); _blobMetadataCopyMeter = metricRegistry.meter(getMetricName("blob-metadata-copy")); _scanBatchTimer = metricRegistry.timer(getMetricName("scan-batch")); _scanReadMeter = metricRegistry.meter(getMetricName("scan-reads")); }
Example 11
Source File: FeedRefreshTaskGiver.java From commafeed with Apache License 2.0 | 5 votes |
@Inject public FeedRefreshTaskGiver(FeedQueues queues, FeedDAO feedDAO, FeedRefreshWorker worker, CommaFeedConfiguration config, MetricRegistry metrics) { this.queues = queues; this.worker = worker; executor = Executors.newFixedThreadPool(1); feedRefreshed = metrics.meter(MetricRegistry.name(getClass(), "feedRefreshed")); threadWaited = metrics.meter(MetricRegistry.name(getClass(), "threadWaited")); }
Example 12
Source File: GossipCore.java From incubator-retired-gossip with Apache License 2.0 | 5 votes |
public GossipCore(GossipManager manager, MetricRegistry metrics){ this.gossipManager = manager; requests = new ConcurrentHashMap<>(); perNodeData = new ConcurrentHashMap<>(); sharedData = new ConcurrentHashMap<>(); eventManager = new DataEventManager(metrics); metrics.register(PER_NODE_DATA_SIZE, (Gauge<Integer>)() -> perNodeData.size()); metrics.register(SHARED_DATA_SIZE, (Gauge<Integer>)() -> sharedData.size()); metrics.register(REQUEST_SIZE, (Gauge<Integer>)() -> requests.size()); messageSerdeException = metrics.meter(MESSAGE_SERDE_EXCEPTION); transmissionException = metrics.meter(MESSAGE_TRANSMISSION_EXCEPTION); transmissionSuccess = metrics.meter(MESSAGE_TRANSMISSION_SUCCESS); }
Example 13
Source File: MegabusRefProducer.java From emodb with Apache License 2.0 | 5 votes |
@VisibleForTesting MegabusRefProducer(MegabusRefProducerConfiguration configuration, DatabusEventStore eventStore, RateLimitedLogFactory logFactory, MetricRegistry metricRegistry, @Nullable ScheduledExecutorService executor, Producer<String, JsonNode> producer, ObjectMapper objectMapper, Topic topic, String subscriptionName, String partitionIdentifer, Clock clock) { _log = LoggerFactory.getLogger(MegabusRefProducer.class.getName() + "-" + partitionIdentifer); checkArgument(configuration.getPollIntervalMs() > 0); checkArgument(configuration.getBatchSize() > 0); checkArgument(configuration.getSkipWaitThreshold() >= 0 && configuration.getSkipWaitThreshold() <= configuration.getBatchSize()); _pollIntervalMs = configuration.getPollIntervalMs(); _eventsLimit = configuration.getBatchSize(); _skipWaitThreshold = configuration.getSkipWaitThreshold(); _eventStore = requireNonNull(eventStore, "eventStore"); _timers = new MetricsGroup(metricRegistry); _timerName = newTimerName("megabusPoll-" + partitionIdentifer); _rateLimitedLog = logFactory.from(_log); _executor = executor; _producer = requireNonNull(producer, "producer"); _clock = firstNonNull(clock, Clock.systemUTC()); _eventMeter = metricRegistry.meter(MetricRegistry.name("bv.emodb.megabus", "MegabusRefProducer", "events")); _errorMeter = metricRegistry.meter(MetricRegistry.name("bv.emodb.megabus", "MegabusRefProducer", "errors")); // TODO: We should ideally make the megabus poller also the dedup leader, which should allow consistent polling and deduping, as well as cluster updates to the same key // NOTE: megabus subscriptions currently avoid dedup queues by starting with "__" _subscriptionName = requireNonNull(subscriptionName, "subscriptionName"); _objectMapper = requireNonNull(objectMapper, "objectMapper"); _topic = requireNonNull(topic, "topic"); ServiceFailureListener.listenTo(this, metricRegistry); }
Example 14
Source File: SQLExceptionLogger.java From tenacity with Apache License 2.0 | 4 votes |
public SQLExceptionLogger(MetricRegistry registry) { this.SQL_ERROR = registry.meter(MetricRegistry.name(SQLExceptionLogger.class, "sql-errors", "error")); }
Example 15
Source File: LogbackSlowQueryLog.java From emodb with Apache License 2.0 | 4 votes |
public LogbackSlowQueryLog(Logger logger, int tooManyDeltasThreshold, MetricRegistry metricRegistry) { _logger = logger; _tooManyDeltasThreshold = tooManyDeltasThreshold; _meter = metricRegistry.meter(MetricRegistry.name("bv.emodb.sor", "SlowQueryLog", "too_many_deltas")); }
Example 16
Source File: UnitTestProtocolManager.java From incubator-retired-gossip with Apache License 2.0 | 4 votes |
public UnitTestProtocolManager(GossipSettings settings, String id, MetricRegistry registry) { meter = settings.isSignMessages() ? registry.meter(PassiveGossipConstants.SIGNED_MESSAGE) : registry.meter(PassiveGossipConstants.UNSIGNED_MESSAGE); }
Example 17
Source File: SimpleTextInFwsTest.java From hermes with Apache License 2.0 | 4 votes |
@Test public void simpleTextMessageTest() throws IOException { String topic = "test.hermes.kafka"; String group = "group.test.hermes.kafka"; MetricRegistry metrics = HermesMetricsRegistry.getMetricRegistryByT(topic); final Meter sent = metrics.meter("sent"); final Meter received = metrics.meter("received"); Producer producer = Producer.getInstance(); ConsumerHolder consumer = Consumer.getInstance().start(topic, group, new BaseMessageListener<String>() { @Override protected void onMessage(ConsumerMessage<String> msg) { String body = msg.getBody(); System.out.println("Receive: " + body); received.mark(); } }); System.out.println("Starting consumer..."); int count = 1; try (BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) { while (true) { String line = in.readLine(); if ("q".equals(line)) { break; } String proMsg = "Hello Ctrip " + count++; MessageHolder holder = producer.message(topic, String.valueOf(System.currentTimeMillis()), proMsg); holder.send(); System.out.println("Sent: " + proMsg); sent.mark(); } } consumer.close(); System.out.println(MetricsUtils.printMeter("sent", sent)); System.out.println(MetricsUtils.printMeter("received", received)); }
Example 18
Source File: SpringConfig.java From FATE-Serving with Apache License 2.0 | 4 votes |
@Bean public Meter requestMeter(MetricRegistry metrics) { return metrics.meter("request"); }
Example 19
Source File: DBIExceptionLogger.java From tenacity with Apache License 2.0 | 4 votes |
public DBIExceptionLogger(MetricRegistry registry, SQLExceptionLogger sqlExceptionLogger) { this.sqlExceptionLogger = sqlExceptionLogger; this.DBI_ERRORS = registry.meter(MetricRegistry.name(DBIExceptionLogger.class, "dbi-errors", "error")); }
Example 20
Source File: ServerErrorResponseMetricsFilter.java From emodb with Apache License 2.0 | 4 votes |
public ServerErrorResponseMetricsFilter(MetricRegistry metricRegistry) { _meter500 = metricRegistry.meter(MetricRegistry.name("bv.emodb.web", "500-responses")); _meter503 = metricRegistry.meter(MetricRegistry.name("bv.emodb.web", "503-responses")); _meterOther = metricRegistry.meter(MetricRegistry.name("bv.emodb.web", "5xx-other-responses")); }