本文整理了Java中com.netflix.spectator.api.Utils.normalize()
方法的一些代码示例,展示了Utils.normalize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.normalize()
方法的具体详情如下:
包路径:com.netflix.spectator.api.Utils
类名称:Utils
方法名:normalize
[英]Returns a new id with the tag list sorted by key and with no duplicate keys.
[中]返回一个新id,标记列表按键排序,没有重复键。
代码示例来源:origin: Netflix/spectator
/** Create a new instance. */
public MetricsRegistry(Clock clock, com.codahale.metrics.MetricRegistry impl) {
this(clock, impl, id -> {
Id normalized = Utils.normalize(id);
StringBuilder buf = new StringBuilder();
buf.append(normalized.name());
for (Tag t : normalized.tags()) {
buf.append('.').append(t.key()).append('-').append(t.value());
}
return buf.toString();
});
}
代码示例来源:origin: com.netflix.spectator/spectator-reg-metrics3
/** Create a new instance. */
public MetricsRegistry(Clock clock, com.codahale.metrics.MetricRegistry impl) {
this(clock, impl, id -> {
Id normalized = Utils.normalize(id);
StringBuilder buf = new StringBuilder();
buf.append(normalized.name());
for (Tag t : normalized.tags()) {
buf.append('.').append(t.key()).append('-').append(t.value());
}
return buf.toString();
});
}
代码示例来源:origin: Netflix/spectator
private void assertEquals(Id expected, Id actual) {
Assertions.assertEquals(Utils.normalize(expected), Utils.normalize(actual));
}
内容来源于网络,如有侵权,请联系作者删除!