本文整理汇总了Java中com.netflix.servo.monitor.MonitorConfig.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java MonitorConfig.Builder方法的具体用法?Java MonitorConfig.Builder怎么用?Java MonitorConfig.Builder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.netflix.servo.monitor.MonitorConfig
的用法示例。
在下文中一共展示了MonitorConfig.Builder方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stripCommonTags
import com.netflix.servo.monitor.MonitorConfig; //导入方法依赖的package包/类
private List<Metric> stripCommonTags(List<Metric> metrics) {
Map<String, String> commonTags = NetflixTagKey.tagsFromEnvironment();
List<Metric> result = Lists.newArrayListWithCapacity(metrics.size());
for (Metric metric : metrics) {
TagList origTags = metric.getConfig().getTags();
MonitorConfig.Builder builder = MonitorConfig.builder(metric.getConfig().getName());
for (Tag tag : origTags) {
if (!commonTags.containsKey(tag.getKey())) {
builder.withTag(tag);
}
}
Metric noCommonTags = new Metric(builder.build(), metric.getTimestamp(), metric.getValue());
result.add(noCommonTags);
}
return result;
}
示例2: toValidValue
import com.netflix.servo.monitor.MonitorConfig; //导入方法依赖的package包/类
/**
* Return a new metric where the name and all tags are using the valid character
* set.
*/
public static Metric toValidValue(Metric metric) {
MonitorConfig cfg = metric.getConfig();
MonitorConfig.Builder cfgBuilder = MonitorConfig.builder(toValidCharset(cfg.getName()));
for (Tag orig : cfg.getTags()) {
cfgBuilder.withTag(toValidCharset(orig.getKey()), toValidCharset(orig.getValue()));
}
cfgBuilder.withPublishingPolicy(cfg.getPublishingPolicy());
return new Metric(cfgBuilder.build(), metric.getTimestamp(), metric.getValue());
}
示例3: getCounter
import com.netflix.servo.monitor.MonitorConfig; //导入方法依赖的package包/类
public static Counter getCounter(String name, String... tags) {
MonitorConfig.Builder cfgBuilder = MonitorConfig.builder(name);
if (tags.length > 0) {
cfgBuilder.withTags(BasicTagList.of(tags));
}
return getCounter(cfgBuilder.build());
}
示例4: getTimer
import com.netflix.servo.monitor.MonitorConfig; //导入方法依赖的package包/类
public static Timer getTimer(String name, String... tags) {
MonitorConfig.Builder cfgBuilder = MonitorConfig.builder(name);
if (tags.length > 0) {
cfgBuilder.withTags(BasicTagList.of(tags));
}
return getTimer(cfgBuilder.build());
}
示例5: withTags
import com.netflix.servo.monitor.MonitorConfig; //导入方法依赖的package包/类
@Override public Id withTags(Iterable<Tag> ts) {
MonitorConfig.Builder builder = new MonitorConfig.Builder(config);
for (Tag t : ts) {
builder.withTag(t.key(), t.value());
}
return new ServoId(builder.build());
}
示例6: addMetric
import com.netflix.servo.monitor.MonitorConfig; //导入方法依赖的package包/类
private void addMetric(KafkaMetric metric) {
MetricName metricName = metric.metricName();
MonitorConfig.Builder builder = MonitorConfig.builder(metricName.name())
.withTag("group", metricName.group());
for(Map.Entry<String, String> tag : metricName.tags().entrySet()) {
builder.withTag(tag.getKey(), tag.getValue());
}
MonitorConfig monitorConfig = builder.build();
gauges.put(Servo.getDoubleGauge(monitorConfig), metric);
}
示例7: getMonitorConfig
import com.netflix.servo.monitor.MonitorConfig; //导入方法依赖的package包/类
public MonitorConfig getMonitorConfig(final String metricName, final Tag tag, final TagList tagList) {
MonitorConfig mc = monitorConfigMap.get(metricName);
if (mc != null) return mc;
final MonitorConfig.Builder monitorConfig = MonitorConfig.builder(metricName);
if (tagList != null) monitorConfig.withTags(tagList);
if (tag != null) monitorConfig.withTag(tag);
mc = monitorConfig.build();
monitorConfigMap.put(metricName, mc);
return mc;
}