當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。