当前位置: 首页>>代码示例>>Java>>正文


Java Meter.Id方法代码示例

本文整理汇总了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;
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:21,代码来源:GraphiteHierarchicalNameMapper.java

示例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());
        }
    };
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:19,代码来源:MeterFilter.java

示例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());
        }
    };
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:18,代码来源:MeterFilter.java

示例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());
        }
    };
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:27,代码来源:MeterFilter.java

示例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();
}
 
开发者ID:line,项目名称:armeria,代码行数:21,代码来源:MoreMeters.java

示例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;
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:8,代码来源:MicrometerCollector.java

示例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;
        }
    };
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:9,代码来源:MeterFilter.java

示例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;
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:8,代码来源:StatsdGauge.java

示例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;
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:9,代码来源:CompositeFunctionTimer.java

示例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;
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:8,代码来源:PropertyMeterFilter.java

示例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";
    }
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:16,代码来源:DatadogMetricMetadata.java

示例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());
        }
    };
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:12,代码来源:MeterFilter.java

示例13: DropwizardGauge

import io.micrometer.core.instrument.Meter; //导入方法依赖的package包/类
DropwizardGauge(Meter.Id id, com.codahale.metrics.Gauge<Double> impl) {
    super(id);
    this.impl = impl;
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:5,代码来源:DropwizardGauge.java

示例14: SpectatorCounter

import io.micrometer.core.instrument.Meter; //导入方法依赖的package包/类
SpectatorCounter(Meter.Id id, com.netflix.spectator.api.Counter counter) {
    super(id);
    this.counter = counter;
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:5,代码来源:SpectatorCounter.java

示例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);
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:6,代码来源:PropertyMeterFilterTest.java


注:本文中的io.micrometer.core.instrument.Meter.Id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。