當前位置: 首頁>>代碼示例>>Java>>正文


Java MetricRegistry.timer方法代碼示例

本文整理匯總了Java中com.codahale.metrics.MetricRegistry.timer方法的典型用法代碼示例。如果您正苦於以下問題:Java MetricRegistry.timer方法的具體用法?Java MetricRegistry.timer怎麽用?Java MetricRegistry.timer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.codahale.metrics.MetricRegistry的用法示例。


在下文中一共展示了MetricRegistry.timer方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: configureMetrics

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
private void configureMetrics(MetricRegistry metrics) {
  saveNamespaceTimer = metrics.timer(MetricRegistry.name(DefaultGroupService.class,
      "saveNamespaceTimer"));
  saveOwnerTimer = metrics.timer(MetricRegistry.name(DefaultGroupService.class,
      "saveOwnerTimer"));
  saveServiceTimer = metrics.timer(MetricRegistry.name(DefaultGroupService.class,
      "saveServiceTimer"));
  saveMemberTimer = metrics.timer(MetricRegistry.name(DefaultGroupService.class,
      "saveMemberTimer"));
  readNamespaceTimer = metrics.timer(MetricRegistry.name(DefaultGroupService.class,
      "readNamespaceTimer"));
  removeRelationTimer = metrics.timer(MetricRegistry.name(DefaultGroupService.class,
      "removeRelationTimer"));
  readCacheTimer = metrics.timer(MetricRegistry.name(DefaultGroupService.class,
      "readCacheTimer"));
  addToCacheTimer = metrics.timer(MetricRegistry.name(DefaultGroupService.class,
      "addToCacheTimer"));
  loadCacheMissMeter = metrics.meter(MetricRegistry.name(DefaultGroupService.class,
      "loadCacheMissMeter"));
  loadCacheHitMeter = metrics.meter(MetricRegistry.name(DefaultGroupService.class,
      "loadCacheHitMeter"));
}
 
開發者ID:dehora,項目名稱:outland,代碼行數:23,代碼來源:DefaultGroupService.java

示例2: DynamoDbCommand

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
public DynamoDbCommand(
    String commandName,
    Supplier<R> storageAction,
    Supplier<R> fallbackAction,
    HystrixConfiguration hystrixConfiguration,
    MetricRegistry metrics
) {
  super(hystrixConfiguration.getHystrixCommandSetter());
  this.commandName = commandName;
  this.storageAction = storageAction;
  this.fallbackAction = fallbackAction;
  this.timer = metrics.timer(MetricRegistry.name(this.getClass(), commandName + ".timer"));
  this.meter = metrics.meter(MetricRegistry.name(this.getClass(), commandName + ".meter"));
  this.failMeter =
      metrics.meter(MetricRegistry.name(this.getClass(), commandName + ".failMeter"));
  this.throughputFailMeter =
      metrics.meter(MetricRegistry.name(this.getClass(), commandName + ".throughputFailMeter"));
}
 
開發者ID:dehora,項目名稱:outland,代碼行數:19,代碼來源:DynamoDbCommand.java

示例3: configureMetrics

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
private void configureMetrics(MetricRegistry metrics) {
  saveFeatureTimer = metrics.timer(MetricRegistry.name(DefaultFeatureService.class,
      "saveFeatureTimer"));
  updateFeatureTimer = metrics.timer(MetricRegistry.name(DefaultFeatureService.class,
      "updateFeatureTimer"));
  addToCacheTimer = metrics.timer(MetricRegistry.name(DefaultFeatureService.class,
      "addToCacheTimer"));
  loadFeaturesTimer = metrics.timer(MetricRegistry.name(DefaultFeatureService.class,
      "loadFeaturesTimer"));
  loadFeaturesCacheTimer = metrics.timer(MetricRegistry.name(DefaultFeatureService.class,
      "loadFeaturesCacheTimer"));
  loadFeaturesCacheHitMeter = metrics.meter(MetricRegistry.name(DefaultFeatureService.class,
      "loadFeaturesCacheHitMeter"));
  loadFeaturesCacheMissMeter = metrics.meter(MetricRegistry.name(DefaultFeatureService.class,
      "loadFeaturesCacheMissMeter"));
  loadFeatureByKeyTimer = metrics.timer(MetricRegistry.name(DefaultFeatureService.class,
      "loadFeatureByKeyTimer"));
  loadFeatureCacheTimer = metrics.timer(MetricRegistry.name(DefaultFeatureService.class,
      "loadFeatureCacheTimer"));
  loadFeatureCacheHitMeter = metrics.meter(MetricRegistry.name(DefaultFeatureService.class,
      "loadFeatureCacheHitMeter"));
  loadFeatureCacheMissMeter = metrics.meter(MetricRegistry.name(DefaultFeatureService.class,
      "loadFeatureCacheMissMeter"));
}
 
開發者ID:dehora,項目名稱:outland,代碼行數:25,代碼來源:DefaultFeatureService.java

示例4: RedisCacheCommand

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
public RedisCacheCommand(
    String commandName,
    Supplier<T> cacheAction,
    Supplier<T> fallbackAction,
    HystrixConfiguration hystrixConfiguration,
    MetricRegistry metrics
) {
  super(hystrixConfiguration.getHystrixCommandSetter());
  this.commandName = commandName;
  this.cacheAction = cacheAction;
  this.fallbackAction = fallbackAction;
  this.timer = metrics.timer(MetricRegistry.name(this.getClass(), commandName + ".timer"));
  this.meter = metrics.meter(MetricRegistry.name(this.getClass(), commandName + ".meter"));
  this.failMeter =
      metrics.meter(MetricRegistry.name(this.getClass(), commandName + ".failMeter"));
}
 
開發者ID:dehora,項目名稱:outland,代碼行數:17,代碼來源:RedisCacheCommand.java

示例5: PGFactStore

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
@Autowired
public PGFactStore(JdbcTemplate jdbcTemplate, PGSubscriptionFactory subscriptionFactory,
        MetricRegistry registry) {
    this.jdbcTemplate = jdbcTemplate;
    this.subscriptionFactory = subscriptionFactory;
    this.registry = registry;

    publishFailedCounter = registry.counter(names.factPublishingFailed());
    publishLatency = registry.timer(names.factPublishingLatency());
    publishMeter = registry.meter(names.factPublishingMeter());

    fetchLatency = registry.timer(names.fetchLatency());
    seqLookupLatency = registry.timer(names.seqLookupLatency());

    subscriptionCatchupMeter = registry.meter(names.subscribeCatchup());
    subscriptionFollowMeter = registry.meter(names.subscribeFollow());
}
 
開發者ID:uweschaefer,項目名稱:factcast,代碼行數:18,代碼來源:PGFactStore.java

示例6: GoalOptimizer

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
/**
 * Constructor for Goal Optimizer takes the goals as input. The order of the list determines the priority of goals
 * in descending order.
 *
 * @param config The Kafka Cruise Control Configuration.
 */
public GoalOptimizer(KafkaCruiseControlConfig config,
                     LoadMonitor loadMonitor,
                     Time time,
                     MetricRegistry dropwizardMetricRegistry) {
  _goalsByPriority = AnalyzerUtils.getGoalMapByPriority(config);
  _defaultModelCompletenessRequirements = MonitorUtils.combineLoadRequirementOptions(_goalsByPriority.values());
  _requirementsWithAvailableValidWindows = new ModelCompletenessRequirements(
      1,
      _defaultModelCompletenessRequirements.minMonitoredPartitionsPercentage(),
      _defaultModelCompletenessRequirements.includeAllTopics());
  _goalByPriorityForPrecomputing = new ArrayList<>();
  _numPrecomputingThreads = config.getInt(KafkaCruiseControlConfig.NUM_PROPOSAL_PRECOMPUTE_THREADS_CONFIG);
  for (int i = 0; i < _numPrecomputingThreads; i++) {
    _goalByPriorityForPrecomputing.add(AnalyzerUtils.getGoalMapByPriority(config));
  }
  LOG.info("{}", _goalsByPriority);
  LOG.info("{}", _goalByPriorityForPrecomputing);
  _balancingConstraint = new BalancingConstraint(config);
  _excludedTopics = Pattern.compile(config.getString(KafkaCruiseControlConfig.TOPICS_EXCLUDED_FROM_PARTITION_MOVEMENT_CONFIG));
  _maxProposalCandidates = config.getInt(KafkaCruiseControlConfig.MAX_PROPOSAL_CANDIDATES_CONFIG);
  _proposalExpirationMs = config.getLong(KafkaCruiseControlConfig.PROPOSAL_EXPIRATION_MS_CONFIG);
      _proposalPrecomputingExecutor =
      Executors.newScheduledThreadPool(_numPrecomputingThreads,
                                       new KafkaCruiseControlThreadFactory("ProposalPrecomputingExecutor", false, LOG));
  _loadMonitor = loadMonitor;
  _time = time;
  _cacheLock = new ReentrantLock();
  _bestProposal = null;
  _totalProposalCandidateComputed = new AtomicInteger(0);
  _proposalComputationTimer = dropwizardMetricRegistry.timer(MetricRegistry.name("GoalOptimizer", "proposal-computation-timer"));
}
 
開發者ID:linkedin,項目名稱:cruise-control,代碼行數:38,代碼來源:GoalOptimizer.java

示例7: init

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
@Before
public void init() {
    MetricRegistry metricRegistry = new MetricRegistry();
    
    this.logReporter = ConsoleReporter
            .forRegistry(metricRegistry)
            .build();
    logReporter.start(1, TimeUnit.MINUTES); 
    timer = metricRegistry.timer("connection");
}
 
開發者ID:PacktPublishing,項目名稱:Spring-5.0-Cookbook,代碼行數:11,代碼來源:TestDbPool.java

示例8: ServiceRateLimiter

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
public ServiceRateLimiter(MetricRegistry metrics, XConfig config) {
  this.reqs = metrics.meter(name(Router.class, "requests", "Rate"));
  this.timer = metrics.timer("Request Latency");
  this.config = config;
  this.globalHardLimiter = RateLimiter.create(config.globalHardReqPerSec());
  this.globalSoftLimiter = RateLimiter.create(config.globalSoftReqPerSec());

  softRateLimitHasher =
      buildHasher(softLimiterMap, config.getRateLimiterPoolSize(), config.softReqPerSec());
  hardRateLimitHasher =
      buildHasher(hardLimiterMap, config.getRateLimiterPoolSize(), config.hardReqPerSec());
}
 
開發者ID:Nordstrom,項目名稱:xrpc,代碼行數:13,代碼來源:ServiceRateLimiter.java

示例9: FeatureStoreMetered

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
FeatureStoreMetered(FeatureStore featureStore, MetricsContext metricsContext) {
  this.featureStore = featureStore;

  MetricRegistry metrics = metricsContext.metrics();
  String context = metricsContext.context();

  this.putTimer = metrics.timer(MetricRegistry.name(
      context + "." + METRICS_PATH, "putTimer"));
  this.putMeter = metrics.meter(MetricRegistry.name(
      context + "." + METRICS_PATH, "putMeter"));
  this.findTimer = metrics.timer(MetricRegistry.name(
      metricsContext + "." + METRICS_PATH, "findTimer"));
  this.findMeter = metrics.meter(MetricRegistry.name(
      context + "." + METRICS_PATH, "findMeter"));
  this.findAllTimer = metrics.timer(MetricRegistry.name(
      context + "." + METRICS_PATH, "findAllTimer"));
  this.findAllMeter = metrics.meter(MetricRegistry.name(
      context + "." + METRICS_PATH, "findAllMeter"));
  this.flushTimer = metrics.timer(MetricRegistry.name(
      context + "." + METRICS_PATH, "flushTimer"));
  this.flushMeter = metrics.meter(MetricRegistry.name(
      context + "." + METRICS_PATH, "flushMeter"));
  this.flushAllTimer = metrics.timer(MetricRegistry.name(
      context + "." + METRICS_PATH, "flushAllTimer"));
  this.flushAllMeter = metrics.meter(MetricRegistry.name(
      context + "." + METRICS_PATH, "flushAllMeter"));
}
 
開發者ID:dehora,項目名稱:outland,代碼行數:28,代碼來源:FeatureStoreMetered.java

示例10: ApptuitReporter

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
protected ApptuitReporter(MetricRegistry registry, MetricFilter filter, TimeUnit rateUnit,
    TimeUnit durationUnit, Map<String, String> globalTags, String key, URL apiUrl,
    ReportingMode reportingMode) {
  super(registry, REPORTER_NAME, filter, rateUnit, durationUnit);

  this.buildReportTimer = registry.timer("apptuit.reporter.report.build");
  this.sendReportTimer = registry.timer("apptuit.reporter.report.send");

  if (reportingMode == null) {
    reportingMode = DEFAULT_REPORTING_MODE;
  }

  switch (reportingMode) {
    case NO_OP:
      this.dataPointsReporter = dataPoints -> {
      };
      break;
    case SYS_OUT:
      this.dataPointsReporter = dataPoints -> {
        dataPoints.forEach(dp -> dp.toTextLine(System.out, globalTags));
      };
      break;
    case API_PUT:
    default:
      ApptuitPutClient putClient = new ApptuitPutClient(key, globalTags, apiUrl);
      this.dataPointsReporter = putClient::put;
      break;
  }
}
 
開發者ID:ApptuitAI,項目名稱:JInsight,代碼行數:30,代碼來源:ApptuitReporter.java

示例11: MonitoredExecutorService

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
public MonitoredExecutorService(ExecutorService delegate, MetricRegistry registry, String
        name) {
    this.delegate = delegate;

    this.submitted = registry.meter(MetricRegistry.name(name, "submitted"));
    this.rejected = registry.meter(MetricRegistry.name(name, "rejected"));
    this.running = registry.counter(MetricRegistry.name(name, "running"));
    this.completed = registry.meter(MetricRegistry.name(name, "completed"));

    this.dispatchDurationTimer = registry.timer(MetricRegistry.name(name, "dispatchDuration"));
    this.durationTimer = registry.timer(MetricRegistry.name(name, "duration"));
}
 
開發者ID:fchenxi,項目名稱:easyhbase,代碼行數:13,代碼來源:MonitoredExecutorService.java

示例12: MetricStore

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
/**
 * Constructor
 *
 * @param client
 *            Riak client
 */
public MetricStore(@Nonnull final RiakClient client) {
    this.client = Objects.requireNonNull(client);

    final MetricRegistry registry = SharedMetricRegistries
            .getOrCreate("default");
    this.queryTimer = registry
            .timer(MetricRegistry.name(MetricStore.class, "query"));
    this.storeTimer = registry
            .timer(MetricRegistry.name(MetricStore.class, "store"));
    this.deleteTimer = registry
            .timer(MetricRegistry.name(MetricStore.class, "delete"));
}
 
開發者ID:smoketurner,項目名稱:graphiak,代碼行數:19,代碼來源:MetricStore.java

示例13: FeatureStoreRocksDb

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
FeatureStoreRocksDb(MetricsContext metricsContext, File dbPath) {

    MetricRegistry metrics = metricsContext.metrics();
    String context = metricsContext.context();

    putTimer = metrics.timer(MetricRegistry.name(
        context + "." + METRICS_PATH, "putTimer"));
    putMeter = metrics.meter(MetricRegistry.name(
        context + "." + METRICS_PATH, "putMeter"));
    this.loadAllTimer = metrics.timer(MetricRegistry.name(
        context + "." + METRICS_PATH, "loadAllTimer"));
    this.loadAllMeter = metrics.meter(MetricRegistry.name(
        context + "." + METRICS_PATH, "loadAllMeter"));

    this.findAllTimer = metrics.timer(MetricRegistry.name(
        context + "." + METRICS_PATH, "findAllTimer"));
    this.findAllMeter = metrics.meter(MetricRegistry.name(
        context + "." + METRICS_PATH, "findAllMeter"));

    BlockBasedTableConfig tableConfig = new BlockBasedTableConfig();
    tableConfig.setBlockCacheSize(BLOCK_CACHE_SIZE);
    tableConfig.setBlockSize(BLOCK_SIZE);

    options = new Options();
    options.setTableFormatConfig(tableConfig);
    options.setWriteBufferSize(WRITE_BUFFER_SIZE);
    options.setCompressionType(COMPRESSION_TYPE);
    options.setCompactionStyle(COMPACTION_STYLE);
    options.setMaxWriteBufferNumber(MAX_WRITE_BUFFER_NUMBER);
    options.setCreateIfMissing(CREATE_IF_MISSING);
    options.setErrorIfExists(ERROR_IF_EXISTS);
    writeOptions = new WriteOptions();
    writeOptions.setDisableWAL(DISABLE_WAL);
    writeOptions.setSync(true);
    readOptions = new ReadOptions();
    readOptions.setVerifyChecksums(true);
    readOptions.setFillCache(true);
    flushOptions = new FlushOptions();
    flushOptions.setWaitForFlush(WAIT_FOR_FLUSH);

    final File parent = new File("/tmp", "outland");
    rocksDir = new File(dbPath, "feature-store");
    //noinspection ResultOfMethodCallIgnored
    rocksDir.getParentFile().mkdirs();
    rocks = initializeRocksDb(); // todo: move this out?
  }
 
開發者ID:dehora,項目名稱:outland,代碼行數:47,代碼來源:FeatureStoreRocksDb.java

示例14: timerMetric

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
private static Timer timerMetric(final MetricRegistry registry, final Method method, final Timed timed) {
    final String name = chooseName(timed.name(), timed.absolute(), method, "Timed");
    return registry.timer(name);
}
 
開發者ID:mwiede,項目名稱:metrics-feign,代碼行數:5,代碼來源:FeignOutboundMetricsDecorator.java

示例15: createTimer

import com.codahale.metrics.MetricRegistry; //導入方法依賴的package包/類
private static Timer createTimer(TagEncodedMetricName name) {
  MetricRegistry metricRegistry = RegistryService.getMetricRegistry();
  return metricRegistry.timer(name.toString());
}
 
開發者ID:ApptuitAI,項目名稱:JInsight,代碼行數:5,代碼來源:JdbcRuleHelper.java


注:本文中的com.codahale.metrics.MetricRegistry.timer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。