Java Code Examples for com.codahale.metrics.MetricRegistry#histogram()

The following examples show how to use com.codahale.metrics.MetricRegistry#histogram() . 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: NonBlockingRouterMetrics.java    From ambry with Apache License 2.0 6 votes vote down vote up
/**
 * Instantiates {@link CryptoJobMetrics} for {@code requestType} and attaches all the metrics related to the
 * cryptoJob 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.
 */
CryptoJobMetrics(Class ownerClass, String requestType, MetricRegistry metricRegistry) {
  jobQueuingTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(ownerClass, requestType + JOB_QUEUING_TIME_SUFFIX));
  jobProcessingTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(ownerClass, requestType + JOB_PROCESSING_TIME_SUFFIX));
  jobCallbackProcessingTimeMs =
      metricRegistry.histogram(MetricRegistry.name(ownerClass, requestType + JOB_CALLBACK_PROCESSING_TIME_SUFFIX));
  jobResultProcessingWaitTimeMs =
      metricRegistry.histogram(MetricRegistry.name(ownerClass, requestType + JOB_RESULT_PROCESSING_WAIT_TIME_SUFFIX));
  jobResultProcessingTimeMs =
      metricRegistry.histogram(MetricRegistry.name(ownerClass, requestType + JOB_RESULT_PROCESSING_TIME_SUFFIX));
  roundTripTimeInMs = metricRegistry.histogram(MetricRegistry.name(ownerClass, requestType + ROUND_TRIP_TIME_SUFFIX));

  operationRate = metricRegistry.meter(MetricRegistry.name(ownerClass, requestType + OPERATION_RATE_SUFFIX));
  operationErrorRate = metricRegistry.meter(
      MetricRegistry.name(ownerClass, requestType + OPERATION_ERROR_SUFFIX + OPERATION_RATE_SUFFIX));
}
 
Example 2
Source File: DatabusResourcePoller.java    From emodb with Apache License 2.0 6 votes vote down vote up
@Inject
public DatabusResourcePoller(Optional<LongPollingExecutorServices> longPollingExecutorServices,
                             MetricRegistry metricRegistry) {
    checkNotNull(longPollingExecutorServices, "longPollingExecutorServices");
    if (longPollingExecutorServices.isPresent()) {
        _keepAliveExecutorService = longPollingExecutorServices.get().getKeepAlive();
        _pollingExecutorService = longPollingExecutorServices.get().getPoller();

        addThreadPoolMonitoring(_keepAliveExecutorService, "inactiveKeepAliveThreads", metricRegistry);
        addThreadPoolMonitoring(_pollingExecutorService, "inactivePollingThreads", metricRegistry);
    } else {
        _keepAliveExecutorService = null;
        _pollingExecutorService = null;
    }

    _keepAliveThreadDelayHistogram = metricRegistry.histogram(MetricRegistry.name("bv.emodb.databus", "DatabusResource1", "keepAliveThreadDelay"));
    _pollingThreadDelayHistogram = metricRegistry.histogram(MetricRegistry.name("bv.emodb.databus", "DatabusResource1", "pollingThreadDelay"));

    _pollTimer = buildPollTimer(metricRegistry);
}
 
Example 3
Source File: MegabusRefResolver.java    From emodb with Apache License 2.0 6 votes vote down vote up
@Inject
public MegabusRefResolver(DataProvider dataProvider, Topic megabusRefTopic,
                          Topic megabusResolvedTopic,
                          Topic retryRefTopic,
                          Topic missingRefTopic,
                          KafkaCluster kafkaCluster, Clock clock,
                          HostAndPort hostAndPort,
                          String refResolverConsumerGroup,
                          MetricRegistry metricRegistry) {
    super(SERVICE_NAME, kafkaCluster, hostAndPort.toString(),
            refResolverConsumerGroup, megabusRefTopic.getPartitions(), metricRegistry);

    _dataProvider = requireNonNull(dataProvider, "dataProvider");
    _megabusRefTopic = requireNonNull(megabusRefTopic, "megabusRefTopic");
    _megabusResolvedTopic = requireNonNull(megabusResolvedTopic, "megabusResolvedTopic");
    _retryRefTopic = requireNonNull(retryRefTopic, "retryRefTopic");
    _missingRefTopic = requireNonNull(missingRefTopic, "missingRefTopic");

    _clock = requireNonNull(clock, "clock");

    _redundantMeter = metricRegistry.meter(getMetricName("redundantUpdates"));
    _discardedMeter = metricRegistry.meter(getMetricName("discardedUpdates"));
    _pendingMeter = metricRegistry.meter(getMetricName("pendingUpdates"));
    _errorProcessingMeter = metricRegistry.meter(getMetricName("errors"));
    _processingLatencyHisto = metricRegistry.histogram(getMetricName("processing-latency-ms"));
}
 
Example 4
Source File: StatsManagerMetrics.java    From ambry with Apache License 2.0 5 votes vote down vote up
StatsManagerMetrics(MetricRegistry registry) {
  statsAggregationFailureCount =
      registry.counter(MetricRegistry.name(StatsManager.class, "StatsAggregationFailureCount"));
  totalFetchAndAggregateTimeMs =
      registry.histogram(MetricRegistry.name(StatsManager.class, "TotalFetchAndAggregateTimeMs"));
  fetchAndAggregateTimePerStoreMs =
      registry.histogram(MetricRegistry.name(StatsManager.class, "FetchAndAggregateTimePerStoreMs"));
}
 
Example 5
Source File: PerfNioServerFactory.java    From ambry with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an instance of PerfNioServerMetrics.
 * @param metricRegistry the {@link MetricRegistry} instance to use.
 */
PerfNioServerMetrics(MetricRegistry metricRegistry) {
  requestRate = metricRegistry.meter(MetricRegistry.name(PerfNioServer.class, "RequestRate"));

  requestRoundTripTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(PerfNioServer.class, "RequestRoundTripTimeInMs"));

  requestResponseError = metricRegistry.counter(MetricRegistry.name(PerfNioServer.class, "RequestResponseError"));
}
 
Example 6
Source File: MetricsConnection.java    From hbase with Apache License 2.0 5 votes vote down vote up
public RunnerStats(MetricRegistry registry) {
  this.normalRunners = registry.counter(
    name(MetricsConnection.class, "normalRunnersCount"));
  this.delayRunners = registry.counter(
    name(MetricsConnection.class, "delayRunnersCount"));
  this.delayIntevalHist = registry.histogram(
    name(MetricsConnection.class, "delayIntervalHist"));
}
 
Example 7
Source File: MetricsConnection.java    From hbase with Apache License 2.0 5 votes vote down vote up
public RegionStats(MetricRegistry registry, String name) {
  this.name = name;
  this.memstoreLoadHist = registry.histogram(name(MetricsConnection.class,
      MEMLOAD_BASE + this.name));
  this.heapOccupancyHist = registry.histogram(name(MetricsConnection.class,
      HEAP_BASE + this.name));
}
 
Example 8
Source File: MasterMetricsImpl.java    From helios with Apache License 2.0 5 votes vote down vote up
public MasterMetricsImpl(final String group,
                         final MetricRegistry registry) {
  this.group = group;
  this.registry = registry;

  eventsInJobHistoryHist = registry.histogram(name(group, TYPE + "_events_in_job_history"));
  jobsInJobListHist = registry.histogram(name(group, TYPE + "_jobs_in_job_list"));
}
 
Example 9
Source File: AccountServiceMetrics.java    From ambry with Apache License 2.0 5 votes vote down vote up
public AccountServiceMetrics(MetricRegistry metricRegistry) {
  // Histogram
  startupTimeInMs = metricRegistry.histogram(MetricRegistry.name(HelixAccountService.class, "StartupTimeInMs"));
  updateAccountTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(HelixAccountService.class, "UpdateAccountTimeInMs"));
  fetchRemoteAccountTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(HelixAccountService.class, "FetchRemoteAccountTimeInMs"));
  accountUpdateConsumerTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(HelixAccountService.class, "AccountUpdateConsumerTimeInMs"));
  accountUpdateToAmbryTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(HelixAccountService.class, "AccountUpdateToAmbryTimeInMs"));
  accountFetchFromAmbryTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(HelixAccountService.class, "AccountFetchFromAmbryTimeInMs"));
  backupWriteTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(HelixAccountService.class, "BackupWriteTimeInMs"));
  backupReadTimeInMs = metricRegistry.histogram(MetricRegistry.name(HelixAccountService.class, "BackupReadTimeInMs"));

  // Counter
  unrecognizedMessageErrorCount =
      metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "UnrecognizedMessageErrorCount"));
  notifyAccountDataChangeErrorCount =
      metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "NotifyAccountDataChangeErrorCount"));
  updateAccountErrorCount =
      metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "UpdateAccountErrorCount"));
  fetchRemoteAccountErrorCount =
      metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "FetchRemoteAccountErrorCount"));
  remoteDataCorruptionErrorCount =
      metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "RemoteDataCorruptionErrorCount"));
  backupErrorCount = metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "BackupErrorCount"));
  nullNotifierCount = metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "NullNotifierCount"));
  accountUpdatesCapturedByScheduledUpdaterCount = metricRegistry.counter(
      MetricRegistry.name(HelixAccountService.class, "AccountUpdatesCapturedByScheduledUpdaterCount"));
  accountUpdatesToAmbryServerErrorCount =
      metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "AccountUpdatesToAmbryServerErrorCount"));
  accountDeletesToAmbryServerErrorCount =
      metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "AccountDeletesToAmbryServerErrorCount"));
  accountFetchFromAmbryServerErrorCount =
      metricRegistry.counter(MetricRegistry.name(HelixAccountService.class, "AccountFetchFromAmbryServerErrorCount"));
}
 
Example 10
Source File: EventTypeMetrics.java    From nakadi with MIT License 5 votes vote down vote up
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 11
Source File: RestServer.java    From ambry with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an instance of RestServerMetrics using the given {@code metricRegistry}.
 * @param metricRegistry the {@link MetricRegistry} to use for the metrics.
 * @param restServerState the {@link RestServerState} object used to track the state of the {@link RestServer}.
 */
public RestServerMetrics(MetricRegistry metricRegistry, final RestServerState restServerState) {
  // Errors
  restServerInstantiationError =
      metricRegistry.counter(MetricRegistry.name(RestServer.class, "InstantiationError"));

  // Others
  restRequestServiceShutdownTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(RestServer.class, "RestRequestServiceShutdownTimeInMs"));
  restRequestServiceStartTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(RestServer.class, "RestRequestServiceStartTimeInMs"));
  jmxReporterShutdownTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(RestServer.class, "JmxShutdownTimeInMs"));
  jmxReporterStartTimeInMs = metricRegistry.histogram(MetricRegistry.name(RestServer.class, "JmxStartTimeInMs"));
  nioServerShutdownTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(RestServer.class, "NioServerShutdownTimeInMs"));
  nioServerStartTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(RestServer.class, "NioServerStartTimeInMs"));
  restRequestHandlerShutdownTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(RestServer.class, "RestRequestHandlerShutdownTimeInMs"));
  restRequestHandlerStartTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(RestServer.class, "RestRequestHandlerStartTimeInMs"));
  restResponseHandlerShutdownTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(RestServer.class, "RestResponseHandlerShutdownTimeInMs"));
  restResponseHandlerStartTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(RestServer.class, "RestResponseHandlerStartTimeInMs"));
  restServerShutdownTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(RestServer.class, "RestServerShutdownTimeInMs"));
  restServerStartTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(RestServer.class, "RestServerStartTimeInMs"));
  routerCloseTimeInMs = metricRegistry.histogram(MetricRegistry.name(RestServer.class, "RouterCloseTimeInMs"));
  accountServiceCloseTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(RestServer.class, "AccountServiceCloseTimeInMs"));

  Gauge<Integer> restServerStatus = () -> restServerState.isServiceUp() ? 1 : 0;
  metricRegistry.register(MetricRegistry.name(RestServer.class, "RestServerState"), restServerStatus);
}
 
Example 12
Source File: MultipartUploader.java    From nexus-blobstore-google-cloud with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public MultipartUploader(final MetricRegistry metricRegistry,
                         @Named("${"+CHUNK_SIZE_PROPERTY +":-0}") final int chunkSize) {
  checkArgument(chunkSize >= 0, CHUNK_SIZE_PROPERTY + " cannot be negative");
  this.chunkSize = chunkSize;
  this.executorService = MoreExecutors.listeningDecorator(
      new InstrumentedExecutorService(
        Executors.newCachedThreadPool(
          new NexusThreadFactory("multipart-upload", "nexus-blobstore-google-cloud")),
        metricRegistry, format("%s.%s", MultipartUploader.class.getName(), "executor-service")));
  this.numberOfChunks = metricRegistry.histogram(MetricRegistry.name(MultipartUploader.class, "chunks"));
  this.composeLimitHitCounter = metricRegistry.counter(MetricRegistry.name(MultipartUploader.class, "composeLimitHits"));
}
 
Example 13
Source File: Http2ServerMetrics.java    From ambry with Apache License 2.0 5 votes vote down vote up
public Http2ServerMetrics(MetricRegistry registry) {
  requestEnqueueTime = registry.histogram(MetricRegistry.name(Http2ServerMetrics.class, "RequestEnqueueTime"));
  requestQueuingTime = registry.histogram(MetricRegistry.name(Http2ServerMetrics.class, "RequestQueuingTime"));
  requestTotalProcessingTime =
      registry.histogram(MetricRegistry.name(Http2ServerMetrics.class, "RequestTotalProcessingTime"));

  requestResponseChannelErrorCount =
      registry.counter(MetricRegistry.name(Http2ServerMetrics.class, "RequestResponseChannelErrorCount"));
  http2ParentExceptionCount =
      registry.counter(MetricRegistry.name(Http2ServerMetrics.class, "Http2ParentExceptionCount"));
  http2StreamExceptionCount =
      registry.counter(MetricRegistry.name(Http2ServerMetrics.class, "Http2StreamExceptionCount"));
}
 
Example 14
Source File: AsyncOperationTracker.java    From ambry with Apache License 2.0 5 votes vote down vote up
/**
 * Add the async operation tracking metrics to a metric registry.
 * @param ownerClass the owning class for the metrics.
 * @param operationType the type of async operation.
 * @param metricRegistry the {@link MetricRegistry} to register the metrics in.
 */
public Metrics(Class ownerClass, String operationType, MetricRegistry metricRegistry) {
  this.operationType = operationType;
  this.operationTimeInMs = metricRegistry.histogram(MetricRegistry.name(ownerClass, operationType + "TimeInMs"));
  this.callbackProcessingTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(ownerClass, operationType + "CallbackProcessingTimeInMs"));
  this.callbackProcessingError = metricRegistry.counter(MetricRegistry.name(ownerClass, "CallbackProcessingError"));
}
 
Example 15
Source File: NonBlockingRouterMetrics.java    From ambry with Apache License 2.0 5 votes vote down vote up
NodeLevelMetrics(MetricRegistry registry, String dataNodeName) {
  // Request rate.
  putRequestRate = registry.meter(MetricRegistry.name(PutOperation.class, dataNodeName, "PutRequestRate"));
  getBlobInfoRequestRate =
      registry.meter(MetricRegistry.name(GetBlobInfoOperation.class, dataNodeName, "GetBlobInfoRequestRate"));
  getRequestRate = registry.meter(MetricRegistry.name(GetBlobOperation.class, dataNodeName, "GetRequestRate"));
  deleteRequestRate = registry.meter(MetricRegistry.name(DeleteOperation.class, dataNodeName, "DeleteRequestRate"));
  undeleteRequestRate =
      registry.meter(MetricRegistry.name(UndeleteOperation.class, dataNodeName, "UndeleteRequestRate"));
  ttlUpdateRequestRate =
      registry.meter(MetricRegistry.name(TtlUpdateOperation.class, dataNodeName, "TtlUpdateRequestRate"));

  // Request latency.
  putRequestLatencyMs =
      registry.histogram(MetricRegistry.name(PutOperation.class, dataNodeName, "PutRequestLatencyMs"));
  getBlobInfoRequestLatencyMs = registry.histogram(
      MetricRegistry.name(GetBlobInfoOperation.class, dataNodeName, "GetBlobInfoRequestLatencyMs"));
  getRequestLatencyMs =
      registry.histogram(MetricRegistry.name(GetBlobOperation.class, dataNodeName, "GetRequestLatencyMs"));
  deleteRequestLatencyMs =
      registry.histogram(MetricRegistry.name(DeleteOperation.class, dataNodeName, "DeleteRequestLatencyMs"));
  undeleteRequestLatencyMs =
      registry.histogram(MetricRegistry.name(UndeleteOperation.class, dataNodeName, "UndeleteRequestLatencyMs"));
  ttlUpdateRequestLatencyMs =
      registry.histogram(MetricRegistry.name(TtlUpdateOperation.class, dataNodeName, "TtlUpdateRequestLatencyMs"));

  // Request error count.
  putRequestErrorCount =
      registry.counter(MetricRegistry.name(PutOperation.class, dataNodeName, "PutRequestErrorCount"));
  getBlobInfoRequestErrorCount = registry.counter(
      MetricRegistry.name(GetBlobInfoOperation.class, dataNodeName, "GetBlobInfoRequestErrorCount"));
  getRequestErrorCount =
      registry.counter(MetricRegistry.name(GetBlobOperation.class, dataNodeName, "GetRequestErrorCount"));
  deleteRequestErrorCount =
      registry.counter(MetricRegistry.name(DeleteOperation.class, dataNodeName, "DeleteRequestErrorCount"));
  undeleteRequestErrorCount =
      registry.counter(MetricRegistry.name(UndeleteOperation.class, dataNodeName, "UndeleteRequestErrorCount"));
  ttlUpdateRequestErrorCount =
      registry.counter(MetricRegistry.name(TtlUpdateOperation.class, dataNodeName, "TtlUpdateRequestErrorCount"));
}
 
Example 16
Source File: CompareHistogramsWithOtherLibraries.java    From micrometer with Apache License 2.0 5 votes vote down vote up
@Setup(Level.Iteration)
public void setup() {
    registry = new MetricRegistry();
    histogram = registry.histogram("histogram");
    histogramSlidingTimeWindow =
            registry.register("slidingTimeWindowHistogram",
                    new Histogram(new SlidingTimeWindowReservoir(10, TimeUnit.SECONDS)));
    histogramUniform =
            registry.register("uniformHistogram",
                    new Histogram(new UniformReservoir()));
}
 
Example 17
Source File: SummaryBenchmark.java    From client_java with Apache License 2.0 5 votes vote down vote up
@Setup
public void setup() {
  prometheusSummary = io.prometheus.client.metrics.Summary.newBuilder()
    .name("name")
    .documentation("some description..")
    .build();
  prometheusSummaryChild = prometheusSummary.newPartial().apply();

  prometheusSimpleSummary = io.prometheus.client.Summary.build()
    .name("name")
    .help("some description..")
    .labelNames("some", "group").create();
  prometheusSimpleSummaryChild = prometheusSimpleSummary.labels("test", "group");

  prometheusSimpleSummaryNoLabels = io.prometheus.client.Summary.build()
    .name("name")
    .help("some description..")
    .create();

  prometheusSimpleHistogram = io.prometheus.client.Histogram.build()
    .name("name")
    .help("some description..")
    .labelNames("some", "group").create();
  prometheusSimpleHistogramChild = prometheusSimpleHistogram.labels("test", "group");

  prometheusSimpleHistogramNoLabels = io.prometheus.client.Histogram.build()
    .name("name")
    .help("some description..")
    .create();

  registry = new MetricRegistry();
  codahaleHistogram = registry.histogram("name");
}
 
Example 18
Source File: SingularityMainModule.java    From Singularity with Apache License 2.0 4 votes vote down vote up
@Provides
@Singleton
@Named(STATUS_UPDATE_DELTAS)
public Histogram provideUpdateDeltasMap(MetricRegistry registry) {
  return registry.histogram("status update delta");
}
 
Example 19
Source File: AsyncRequestResponseHandlerFactory.java    From ambry with Apache License 2.0 4 votes vote down vote up
/**
 * Creates an instance of RequestResponseHandlerMetrics using the given {@code metricRegistry}.
 * @param metricRegistry the {@link MetricRegistry} to use for the metrics.
 */
public RequestResponseHandlerMetrics(MetricRegistry metricRegistry) {
  this.metricRegistry = metricRegistry;

  // Rates
  // AsyncRequestWorker
  requestArrivalRate = metricRegistry.meter(MetricRegistry.name(AsyncRequestWorker.class, "RequestArrivalRate"));
  requestDequeuingRate = metricRegistry.meter(MetricRegistry.name(AsyncRequestWorker.class, "RequestDequeuingRate"));
  requestQueuingRate = metricRegistry.meter(MetricRegistry.name(AsyncRequestWorker.class, "RequestQueuingRate"));
  // AsyncResponseHandler
  responseArrivalRate = metricRegistry.meter(MetricRegistry.name(AsyncResponseHandler.class, "ResponseArrivalRate"));
  responseCompletionRate =
      metricRegistry.meter(MetricRegistry.name(AsyncResponseHandler.class, "ResponseCompletionRate"));

  // Latencies
  // AsyncRequestWorker
  requestPreProcessingTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(AsyncRequestWorker.class, "RequestPreProcessingTimeInMs"));
  // AsyncResponseHandler
  responseCallbackProcessingTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(AsyncResponseHandler.class, "ResponseCallbackProcessingTimeInMs"));
  responseCallbackWaitTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(AsyncResponseHandler.class, "ResponseCallbackWaitTimeInMs"));
  responsePreProcessingTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(AsyncResponseHandler.class, "ResponsePreProcessingTimeInMs"));
  // AsyncRequestResponseHandler
  requestWorkerSelectionTimeInMs = metricRegistry.histogram(
      MetricRegistry.name(AsyncRequestResponseHandler.class, "RequestWorkerSelectionTimeInMs"));

  // Errors
  // AsyncRequestWorker
  requestProcessingError =
      metricRegistry.counter(MetricRegistry.name(AsyncRequestWorker.class, "RequestProcessingError"));
  requestQueueAddError =
      metricRegistry.counter(MetricRegistry.name(AsyncRequestWorker.class, "RequestQueueAddError"));
  unknownRestMethodError =
      metricRegistry.counter(MetricRegistry.name(AsyncRequestWorker.class, "UnknownRestMethodError"));
  // AsyncResponseHandler
  resourceReleaseError =
      metricRegistry.counter(MetricRegistry.name(AsyncResponseHandler.class, "ResourceReleaseError"));
  responseAlreadyInFlightError =
      metricRegistry.counter(MetricRegistry.name(AsyncResponseHandler.class, "ResponseAlreadyInFlightError"));
  responseCompleteTasksError =
      metricRegistry.counter(MetricRegistry.name(AsyncResponseHandler.class, "ResponseCompleteTasksError"));
  // AsyncRequestResponseHandler
  requestResponseHandlerShutdownError =
      metricRegistry.counter(MetricRegistry.name(AsyncRequestResponseHandler.class, "ShutdownError"));
  requestResponseHandlerUnavailableError =
      metricRegistry.counter(MetricRegistry.name(AsyncRequestResponseHandler.class, "UnavailableError"));

  // Others
  // AsyncResponseHandler
  responseExceptionCount =
      metricRegistry.counter(MetricRegistry.name(AsyncResponseHandler.class, "ResponseExceptionCount"));
  responseHandlerCloseTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(AsyncResponseHandler.class, "CloseTimeInMs"));
  // AsyncRequestResponseHandler
  requestWorkerShutdownTimeInMs = metricRegistry.histogram(
      MetricRegistry.name(AsyncRequestResponseHandler.class, "RequestWorkerShutdownTimeInMs"));
  requestWorkerStartTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(AsyncRequestResponseHandler.class, "RequestWorkerStartTimeInMs"));
  requestResponseHandlerShutdownTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(AsyncRequestResponseHandler.class, "ShutdownTimeInMs"));
  requestResponseHandlerStartTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(AsyncRequestResponseHandler.class, "StartTimeInMs"));
  // AsyncRequestWorker
  residualRequestQueueSize =
      metricRegistry.counter(MetricRegistry.name(AsyncRequestWorker.class, "ResidualRequestQueueSize"));
  residualResponseSetSize =
      metricRegistry.counter(MetricRegistry.name(AsyncRequestWorker.class, "ResidualResponseSetSize"));
}
 
Example 20
Source File: PerfRouterFactory.java    From ambry with Apache License 2.0 4 votes vote down vote up
/**
 * Creates an instance of PerfRouterMetrics.
 * @param metricRegistry the {@link MetricRegistry} instance to use.
 */
PerfRouterMetrics(MetricRegistry metricRegistry) {
  putSizeInBytes = metricRegistry.histogram(MetricRegistry.name(PerfRouter.class, "PostSizeInBytes"));
  putContentConsumeTimeInMs =
      metricRegistry.histogram(MetricRegistry.name(PerfRouter.class, "PostContentConsumeTimeInMs"));
}