Now I know how I can customize the global registry:
(现在,我知道如何自定义全局注册表了:)
eg to set a custom meter filter:
(例如,设置自定义仪表过滤器:)
@Configuration
public class MetricsConfig {
@Bean
MeterRegistryCustomizer<MeterRegistry> metricsConfig() {
return registry -> registry.config().meterFilter(new CustomRenameFilter());
}
}
However, setting a custom rename filter in the registry only allow to rename the base metric name.
(但是,在注册表中设置自定义重命名过滤器仅允许重命名基本度量标准名称。)
It does not act on the suffixes nor allow to act on specific metric belonging a set eg generated by the summary. (它不作用于后缀,也不允许作用于属于一组(例如,由摘要生成)的特定度量。)
with a custom NamingConvention
I can add suffixes to convention base name ... I could even alter existing suffixes or replace convention base name.
(使用自定义NamingConvention
我可以将后缀添加到约定的基础名称中...甚至可以更改现有后缀或替换约定的基础名称。)
Finally please note that Histogram prometheus metric type expects the creation of
(最后请注意,直方图普罗米修斯度量标准类型期望创建)
<basename>_bucket
<basename>_sum
<basename>_count
with those specific names so it might be incorrect to tweak the component in the way I want because that would be a diferent component.
(使用这些特定的名称,因此按照我想要的方式来调整组件可能是不正确的,因为那将是不同的组件。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…