com.netflix.spectator.api.Registry.distributionSummary()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中com.netflix.spectator.api.Registry.distributionSummary方法的一些代码示例,展示了Registry.distributionSummary的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Registry.distributionSummary方法的具体详情如下:
包路径:com.netflix.spectator.api.Registry
类名称:Registry
方法名:distributionSummary

Registry.distributionSummary介绍

[英]Measures the sample distribution of events.
[中]测量事件的样本分布。

代码示例

代码示例来源:origin: Netflix/servo

private DistributionSummary get() {
 DistributionSummary s = summary;
 if (s == null) {
  s = registry.distributionSummary(id);
  summary = s;
 }
 return s;
}

代码示例来源:origin: Netflix/concurrency-limits

@Override
public SampleListener registerDistribution(String id, String... tagNameValuePairs) {
  DistributionSummary summary = registry.distributionSummary(suffixBaseId(id).withTags(tagNameValuePairs));
  return value -> summary.record(value.longValue());
}

代码示例来源:origin: Netflix/Priam

@Inject
public BackupMetrics(Registry registry) {
  this.registry = registry;
  validDownloads = registry.counter(Metrics.METRIC_PREFIX + "download.valid");
  invalidDownloads = registry.counter(Metrics.METRIC_PREFIX + "download.invalid");
  validUploads = registry.counter(Metrics.METRIC_PREFIX + "upload.valid");
  invalidUploads = registry.counter(Metrics.METRIC_PREFIX + "upload.invalid");
  uploadRate = registry.distributionSummary(Metrics.METRIC_PREFIX + "upload.rate");
  downloadRate = registry.distributionSummary(Metrics.METRIC_PREFIX + "download.rate");
  snsNotificationSuccess =
      registry.counter(Metrics.METRIC_PREFIX + "sns.notification.success");
  snsNotificationFailure =
      registry.counter(Metrics.METRIC_PREFIX + "sns.notification.failure");
  forgottenFiles = registry.counter(Metrics.METRIC_PREFIX + "forgotten.files");
}

代码示例来源:origin: Netflix/EVCache

public static DistributionSummary getDistributionSummary(String name, String appName, String serverGroup) {
  final String metricName = getMetricName(appName, serverGroup, name);
  final DistributionSummary _ds = distributionSummaryMap.get(metricName);
  if(_ds != null) return _ds;
  final Registry registry = Spectator.globalRegistry(); //_poolManager.getRegistry();
  if (registry != null) {
    Id id = registry.createId(name);
    id = id.withTag("owner", "evcache");
    id = id.withTag("APP", appName);
    if(serverGroup != null) id = id.withTag("ServerGroup", serverGroup);
    final DistributionSummary ds = registry.distributionSummary(id);
    if (!Monitors.isObjectRegistered(ds)) Monitors.registerObject(ds);
    distributionSummaryMap.put(metricName, ds);
    return ds;
  }
  return null;
}

代码示例来源:origin: com.netflix.servo/servo-core

private DistributionSummary get() {
 DistributionSummary s = summary;
 if (s == null) {
  s = registry.distributionSummary(id);
  summary = s;
 }
 return s;
}

代码示例来源:origin: org.springframework.metrics/spring-metrics

@Override
public DistributionSummary distributionSummary(Id id) {
  return composite.distributionSummary(id);
}

代码示例来源:origin: Netflix/spectator

/**
 * Measures the sample distribution of events.
 *
 * @param name
 *     Description of the measurement that is being collected.
 * @return
 *     Summary instance with the corresponding id.
 */
default DistributionSummary distributionSummary(String name) {
 return distributionSummary(createId(name));
}

代码示例来源:origin: com.netflix.spectator/spectator-api

/** Create a new instance. */
PercentileDistributionSummary(Registry registry, Id id, long min, long max) {
 this.registry = registry;
 this.id = id;
 this.summary = registry.distributionSummary(id);
 this.min = min;
 this.max = max;
 this.counters = new AtomicReferenceArray<>(PercentileBuckets.length());
}

代码示例来源:origin: Netflix/spectator

/**
 * Measures the sample distribution of events.
 *
 * @param name
 *     Description of the measurement that is being collected.
 * @param tags
 *     Other dimensions that can be used to classify the measurement.
 * @return
 *     Summary instance with the corresponding id.
 */
default DistributionSummary distributionSummary(String name, Iterable<Tag> tags) {
 return distributionSummary(createId(name, tags));
}

代码示例来源:origin: Netflix/spectator

/** Create a new instance. */
PercentileDistributionSummary(Registry registry, Id id, long min, long max) {
 this.registry = registry;
 this.id = id;
 this.summary = registry.distributionSummary(id);
 this.min = min;
 this.max = max;
 this.counters = new AtomicReferenceArray<>(PercentileBuckets.length());
}

代码示例来源:origin: Netflix/spectator

/**
 * Measures the sample distribution of events.
 *
 * @param name
 *     Description of the measurement that is being collected.
 * @param tags
 *     Other dimensions that can be used to classify the measurement.
 * @return
 *     Summary instance with the corresponding id.
 */
default DistributionSummary distributionSummary(String name, String... tags) {
 return distributionSummary(createId(name, Utils.toIterable(tags)));
}

代码示例来源:origin: Netflix/spectator

private DistributionSummary newDistributionSummary() {
 List<DistributionSummary> ds = registries.stream()
   .map(r -> r.distributionSummary(id))
   .collect(Collectors.toList());
 return new CompositeDistributionSummary(id, ds);
}

代码示例来源:origin: Netflix/spectator

@Test
public void globalIteratorDistSummary() {
 globalIterator(r -> r.distributionSummary("servo.testDistSummary"));
}

代码示例来源:origin: Netflix/spectator

@Test
public void correctTypeForDistSummariesStream() {
 Registry r = newRegistry(5, false);
 r.distributionSummary("a").record(1);
 r.distributionSummary("b").record(1);
 Assertions.assertEquals(2, r.distributionSummaries().count());
 Assertions.assertEquals(2, r.stream().filter(m -> m instanceof DistributionSummary).count());
}

代码示例来源:origin: Netflix/spectator

private void assertCountEquals(DistributionSummary t, long expected) {
 Assertions.assertEquals(t.count(), expected);
 for (Registry r : registries) {
  Assertions.assertEquals(r.distributionSummary(id).count(), expected);
 }
}

代码示例来源:origin: Netflix/spectator

@Test
public void testDistributionSummary() {
 Registry r = newRegistry(5, true);
 DistributionSummary t = r.distributionSummary(r.createId("foo"));
 t.record(42L);
 Assertions.assertEquals(t.count(), 1L);
 DistributionSummary t2 = r.distributionSummary(r.createId("foo"));
 Assertions.assertEquals(t.totalAmount(), t2.totalAmount());
}

代码示例来源:origin: Netflix/spectator

@Test
public void inflightRequests() {
 Registry registry = new DefaultRegistry();
 DistributionSummary summary = registry.distributionSummary("ipc.client.inflight");
 IpcLogger logger = new IpcLogger(registry, clock, LoggerFactory.getLogger(getClass()));
 IpcLogEntry logEntry = logger.createClientEntry();
 Assertions.assertEquals(0L, summary.totalAmount());
 logEntry.markStart();
 Assertions.assertEquals(1L, summary.totalAmount());
 logEntry.markEnd();
 Assertions.assertEquals(1L, summary.totalAmount());
}

代码示例来源:origin: Netflix/spectator

@Test
public void testDistributionSummaryBadTypeAccess() {
 Assertions.assertThrows(IllegalStateException.class, () -> {
  Registry r = newRegistry(5, true);
  r.distributionSummary(r.createId("foo")).count();
  r.timer(r.createId("foo")).count();
 });
}

代码示例来源:origin: Netflix/spectator

@Test
public void testCounterBadTypeAccess() {
 Assertions.assertThrows(IllegalStateException.class, () -> {
  Registry r = newRegistry(5, true);
  r.counter(r.createId("foo")).count();
  r.distributionSummary(r.createId("foo")).count();
 });
}

代码示例来源:origin: Netflix/spectator

@Test
public void testCounterBadTypeAccessNoThrow() {
 Registry r = newRegistry(5, false);
 r.counter(r.createId("foo")).count();
 Counter c = r.counter("foo");
 DistributionSummary ds = r.distributionSummary(r.createId("foo"));
 ds.record(42);
 Assertions.assertEquals(ds.count(), 0L);
}

相关文章