当前位置: 首页>>代码示例>>Java>>正文


Java DistributionSummary类代码示例

本文整理汇总了Java中com.netflix.spectator.api.DistributionSummary的典型用法代码示例。如果您正苦于以下问题:Java DistributionSummary类的具体用法?Java DistributionSummary怎么用?Java DistributionSummary使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DistributionSummary类属于com.netflix.spectator.api包,在下文中一共展示了DistributionSummary类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testRecord

import com.netflix.spectator.api.DistributionSummary; //导入依赖的package包/类
@Test
public void testRecord() {
  String[] tagValue = new String[] { "default" };
  DistributionSummary summary = factory.distributionSummary(factory.createId("testRecord",
          Collections.singleton(new TestTagFactory(tagValue))));

  summary.record(42L);
  Assert.assertEquals("testRecord:tag=default", summary.id().toString());
  Assert.assertEquals(summary.count(), 1L);
  Assert.assertEquals(42L, summary.totalAmount());

  tagValue[0] = "value2";
  Assert.assertEquals("testRecord:tag=value2", summary.id().toString());
  Assert.assertEquals(0L, summary.count());
  Assert.assertEquals(0L, summary.totalAmount());
}
 
开发者ID:Netflix,项目名称:spectator,代码行数:17,代码来源:DefaultPlaceholderDistributionSummaryTest.java

示例2: getDistributionSummary

import com.netflix.spectator.api.DistributionSummary; //导入依赖的package包/类
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;
}
 
开发者ID:Netflix,项目名称:EVCache,代码行数:18,代码来源:EVCacheMetricsFactory.java

示例3: record

import com.netflix.spectator.api.DistributionSummary; //导入依赖的package包/类
private static void record(DistributionSummary s) {
  long startingCount = s.count();
  long startingAmount = s.totalAmount();
  s.record(42);
  s.record(42L);
  s.record(Integer.valueOf(42));
  s.record(Long.valueOf(42));
  s.record(0);
  assert s.count() == startingCount + 5;
  assert s.totalAmount() == startingAmount + (4 * 42);
}
 
开发者ID:brharrington,项目名称:spectator-examples,代码行数:12,代码来源:Main.java

示例4: testInit

import com.netflix.spectator.api.DistributionSummary; //导入依赖的package包/类
@Test
public void testInit() {
  DistributionSummary summary = new DefaultPlaceholderDistributionSummary(new DefaultPlaceholderId("testInit", registry), registry);

  Assert.assertEquals(0L, summary.count());
  Assert.assertEquals(0L, summary.totalAmount());
}
 
开发者ID:Netflix,项目名称:spectator,代码行数:8,代码来源:DefaultPlaceholderDistributionSummaryTest.java

示例5: testRecordNegative

import com.netflix.spectator.api.DistributionSummary; //导入依赖的package包/类
@Test
public void testRecordNegative() {
  DistributionSummary summary = factory.distributionSummary(factory.createId("testRecordNegative"));

  summary.record(-42L);
  Assert.assertEquals(summary.count(), 0L);
  Assert.assertEquals(0L, summary.totalAmount());
}
 
开发者ID:Netflix,项目名称:spectator,代码行数:9,代码来源:DefaultPlaceholderDistributionSummaryTest.java

示例6: testRecordZero

import com.netflix.spectator.api.DistributionSummary; //导入依赖的package包/类
@Test
public void testRecordZero() {
  DistributionSummary summary = factory.distributionSummary(factory.createId("testRecordNegative"));

  summary.record(0);
  Assert.assertEquals(summary.count(), 1L);
  Assert.assertEquals(summary.totalAmount(), 0L);
}
 
开发者ID:Netflix,项目名称:spectator,代码行数:9,代码来源:DefaultPlaceholderDistributionSummaryTest.java

示例7: newDistributionSummary

import com.netflix.spectator.api.DistributionSummary; //导入依赖的package包/类
@Override protected DistributionSummary newDistributionSummary(Id id) {
  final String name = toMetricName(id);
  return new MetricsDistributionSummary(clock(), id, impl.histogram(name));
}
 
开发者ID:Netflix,项目名称:spectator,代码行数:5,代码来源:MetricsRegistry.java

示例8: newDistributionSummary

import com.netflix.spectator.api.DistributionSummary; //导入依赖的package包/类
@Override protected DistributionSummary newDistributionSummary(Id id) {
  return new AtlasDistributionSummary(id, clock, meterTTL, stepMillis);
}
 
开发者ID:Netflix,项目名称:spectator,代码行数:4,代码来源:AtlasRegistry.java

示例9: distributionSummary

import com.netflix.spectator.api.DistributionSummary; //导入依赖的package包/类
/** Return the distribution summary for a given bucket. */
DistributionSummary distributionSummary(String bucket) {
  return registry.distributionSummary(id.withTag("bucket", bucket));
}
 
开发者ID:Netflix,项目名称:spectator,代码行数:5,代码来源:BucketDistributionSummary.java

示例10: sum

import com.netflix.spectator.api.DistributionSummary; //导入依赖的package包/类
private long sum(Registry r, String name) {
  return r.distributionSummaries()
      .filter(Functions.nameEquals(name))
      .mapToLong(DistributionSummary::count)
      .sum();
}
 
开发者ID:Netflix,项目名称:spectator,代码行数:7,代码来源:BucketDistributionSummaryTest.java

示例11: newDistributionSummary

import com.netflix.spectator.api.DistributionSummary; //导入依赖的package包/类
@Override protected DistributionSummary newDistributionSummary(Id id) {
  return new SidecarDistributionSummary(clock(), id);
}
 
开发者ID:Netflix,项目名称:spectator,代码行数:4,代码来源:SidecarRegistry.java

示例12: distributionSummary

import com.netflix.spectator.api.DistributionSummary; //导入依赖的package包/类
@Override
public DistributionSummary distributionSummary(PlaceholderId id) {
  return new DefaultPlaceholderDistributionSummary(id, registry);
}
 
开发者ID:Netflix,项目名称:spectator,代码行数:5,代码来源:DefaultPlaceholderFactory.java

示例13: getAllDistributionSummaryMap

import com.netflix.spectator.api.DistributionSummary; //导入依赖的package包/类
public static Map<String, DistributionSummary> getAllDistributionSummaryMap() {
    return distributionSummaryMap;
}
 
开发者ID:Netflix,项目名称:EVCache,代码行数:4,代码来源:EVCacheMetricsFactory.java

示例14: distributionSummary

import com.netflix.spectator.api.DistributionSummary; //导入依赖的package包/类
/**
 * Measures the rate and variation in amount for some activity. For example, it could be used to
 * get insight into the variation in response sizes for requests to a server.
 *
 * @param id
 *     Identifier created by a call to {@link #createId}
 */
DistributionSummary distributionSummary(PlaceholderId id);
 
开发者ID:Netflix,项目名称:spectator,代码行数:9,代码来源:PlaceholderFactory.java


注:本文中的com.netflix.spectator.api.DistributionSummary类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。