本文整理汇总了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());
}
示例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;
}
示例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);
}
示例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());
}
示例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());
}
示例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);
}
示例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));
}
示例8: newDistributionSummary
import com.netflix.spectator.api.DistributionSummary; //导入依赖的package包/类
@Override protected DistributionSummary newDistributionSummary(Id id) {
return new AtlasDistributionSummary(id, clock, meterTTL, stepMillis);
}
示例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));
}
示例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();
}
示例11: newDistributionSummary
import com.netflix.spectator.api.DistributionSummary; //导入依赖的package包/类
@Override protected DistributionSummary newDistributionSummary(Id id) {
return new SidecarDistributionSummary(clock(), id);
}
示例12: distributionSummary
import com.netflix.spectator.api.DistributionSummary; //导入依赖的package包/类
@Override
public DistributionSummary distributionSummary(PlaceholderId id) {
return new DefaultPlaceholderDistributionSummary(id, registry);
}
示例13: getAllDistributionSummaryMap
import com.netflix.spectator.api.DistributionSummary; //导入依赖的package包/类
public static Map<String, DistributionSummary> getAllDistributionSummaryMap() {
return distributionSummaryMap;
}
示例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);