当前位置: 首页>>代码示例>>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;未经允许,请勿转载。