本文整理汇总了Java中io.micrometer.core.instrument.Meter.Id方法的典型用法代码示例。如果您正苦于以下问题:Java Meter.Id方法的具体用法?Java Meter.Id怎么用?Java Meter.Id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.micrometer.core.instrument.Meter
的用法示例。
在下文中一共展示了Meter.Id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toHierarchicalName
import io.micrometer.core.instrument.Meter; //导入方法依赖的package包/类
@Override
public String toHierarchicalName(Meter.Id id, NamingConvention convention) {
StringBuilder prefix = new StringBuilder();
StringBuilder tags = new StringBuilder();
if (id.getTags().iterator().hasNext()) {
conventionTags: for (Tag tag : id.getConventionTags(convention)) {
for (String tagPrefix : tagsAsPrefix) {
if (tag.getKey().equals(tagPrefix)) {
prefix.append(tag.getValue()).append(".");
continue conventionTags;
}
}
tags.append(("." + tag.getKey() + "." + tag.getValue()).replace(" ", "_"));
}
}
return prefix.toString() + id.getConventionName(convention) + tags;
}
示例2: renameTag
import io.micrometer.core.instrument.Meter; //导入方法依赖的package包/类
static MeterFilter renameTag(String metricPrefix, String fromTagKey, String toTagKey) {
return new MeterFilter() {
@Override
public Meter.Id map(Meter.Id id) {
if (!id.getName().startsWith(metricPrefix))
return id;
List<Tag> tags = new ArrayList<>();
for (Tag tag : id.getTags()) {
if (tag.getKey().equals(fromTagKey))
tags.add(Tag.of(toTagKey, tag.getValue()));
else tags.add(tag);
}
return new Meter.Id(id.getName(), tags, id.getBaseUnit(), id.getDescription(), id.getType());
}
};
}
示例3: ignoreTags
import io.micrometer.core.instrument.Meter; //导入方法依赖的package包/类
static MeterFilter ignoreTags(String... tagKeys) {
return new MeterFilter() {
@Override
public Meter.Id map(Meter.Id id) {
List<Tag> tags = stream(id.getTags().spliterator(), false)
.filter(t -> {
for (String tagKey : tagKeys) {
if (t.getKey().equals(tagKey))
return false;
}
return true;
}).collect(Collectors.toList());
return new Meter.Id(id.getName(), tags, id.getBaseUnit(), id.getDescription(), id.getType());
}
};
}
示例4: replaceTagValues
import io.micrometer.core.instrument.Meter; //导入方法依赖的package包/类
/**
* @param tagKey The tag key for which replacements should be made
* @param replacement The value to replace with
* @param exceptions All a matching tag with this value to retain its original value
* @author Clint Checketts
*/
static MeterFilter replaceTagValues(String tagKey, Function<String, String> replacement, String... exceptions) {
return new MeterFilter() {
@Override
public Meter.Id map(Meter.Id id) {
List<Tag> tags = stream(id.getTags().spliterator(), false)
.map(t -> {
if (!t.getKey().equals(tagKey))
return t;
for (String exception : exceptions) {
if (t.getValue().equals(exception))
return t;
}
return Tag.of(tagKey, replacement.apply(t.getValue()));
})
.collect(Collectors.toList());
return new Meter.Id(id.getName(), tags, id.getBaseUnit(), id.getDescription(), id.getType());
}
};
}
示例5: measurementName
import io.micrometer.core.instrument.Meter; //导入方法依赖的package包/类
private static String measurementName(Meter.Id id, Measurement measurement) {
final StringBuilder buf = new StringBuilder();
// Append name.
buf.append(id.getName());
// Append statistic.
buf.append('#');
buf.append(CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, measurement.getStatistic().name()));
// Append tags if there are any.
final Iterator<Tag> tagsIterator = id.getTags().iterator();
if (tagsIterator.hasNext()) {
buf.append('{');
tagsIterator.forEachRemaining(tag -> buf.append(tag.getKey()).append('=')
.append(tag.getValue()).append(','));
buf.setCharAt(buf.length() - 1, '}');
}
return buf.toString();
}
示例6: MicrometerCollector
import io.micrometer.core.instrument.Meter; //导入方法依赖的package包/类
public MicrometerCollector(Meter.Id id, Type type, NamingConvention convention, PrometheusConfig config) {
this.id = id;
this.type = type;
this.conventionName = id.getConventionName(convention);
this.tagKeys = id.getConventionTags(convention).stream().map(Tag::getKey).collect(toList());
this.config = config;
}
示例7: deny
import io.micrometer.core.instrument.Meter; //导入方法依赖的package包/类
static MeterFilter deny(Predicate<Meter.Id> iff) {
return new MeterFilter() {
@Override
public MeterFilterReply accept(Meter.Id id) {
return iff.test(id) ? MeterFilterReply.DENY : MeterFilterReply.NEUTRAL;
}
};
}
示例8: StatsdGauge
import io.micrometer.core.instrument.Meter; //导入方法依赖的package包/类
StatsdGauge(Meter.Id id, StatsdLineBuilder lineBuilder, Subscriber<String> publisher, T obj, ToDoubleFunction<T> value) {
super(id);
this.lineBuilder = lineBuilder;
this.publisher = publisher;
this.ref = new WeakReference<>(obj);
this.value = value;
}
示例9: CompositeFunctionTimer
import io.micrometer.core.instrument.Meter; //导入方法依赖的package包/类
CompositeFunctionTimer(Meter.Id id, T obj, ToLongFunction<T> countFunction,
ToDoubleFunction<T> totalTimeFunction, TimeUnit totalTimeFunctionUnits) {
super(id);
this.ref = new WeakReference<>(obj);
this.countFunction = countFunction;
this.totalTimeFunction = totalTimeFunction;
this.totalTimeFunctionUnits = totalTimeFunctionUnits;
}
示例10: accept
import io.micrometer.core.instrument.Meter; //导入方法依赖的package包/类
@Override
public MeterFilterReply accept(Meter.Id id) {
Boolean enabled = getMostSpecific(id.getName(), "enabled", Boolean.class);
if(enabled == null)
return MeterFilterReply.NEUTRAL;
return enabled ? MeterFilterReply.ACCEPT : MeterFilterReply.DENY;
}
示例11: DatadogMetricMetadata
import io.micrometer.core.instrument.Meter; //导入方法依赖的package包/类
DatadogMetricMetadata(Meter.Id id, Statistic statistic, boolean descriptionsEnabled, String overrideBaseUnit) {
this.id = id;
this.descriptionsEnabled = descriptionsEnabled;
this.overrideBaseUnit = overrideBaseUnit;
switch (statistic) {
case Count:
case Total:
case TotalTime:
this.type = "count";
break;
default:
this.type = "gauge";
}
}
示例12: commonTags
import io.micrometer.core.instrument.Meter; //导入方法依赖的package包/类
static MeterFilter commonTags(Iterable<Tag> tags) {
return new MeterFilter() {
@Override
public Meter.Id map(Meter.Id id) {
List<Tag> allTags = new ArrayList<>();
id.getTags().forEach(allTags::add);
tags.forEach(allTags::add);
return new Meter.Id(id.getName(), allTags, id.getBaseUnit(), id.getDescription(), id.getType());
}
};
}
示例13: DropwizardGauge
import io.micrometer.core.instrument.Meter; //导入方法依赖的package包/类
DropwizardGauge(Meter.Id id, com.codahale.metrics.Gauge<Double> impl) {
super(id);
this.impl = impl;
}
示例14: SpectatorCounter
import io.micrometer.core.instrument.Meter; //导入方法依赖的package包/类
SpectatorCounter(Meter.Id id, com.netflix.spectator.api.Counter counter) {
super(id);
this.counter = counter;
}
示例15: newDistributionSummary
import io.micrometer.core.instrument.Meter; //导入方法依赖的package包/类
@Override
protected DistributionSummary newDistributionSummary(Meter.Id id, HistogramConfig conf) {
histogramConfig = conf;
return super.newDistributionSummary(id, conf);
}