我正在尝试按维度/标签功能来了解 spring micromenter 的组。我正在使用 StepMeterRegistry 并增加计数器,但没有看到想要的结果。
创建计数器,
final MeterRegistry myRegistry = new StepMeterRegistry(config, Clock.SYSTEM) {...};
final Counter myCounter1 = myRegistry.counter("myTestCounter", "tag1", "value1");
final Counter myCounter2 = myRegistry.counter("myTestCounter", "tag2", "value2");
final Counter myCounter1n2 = myRegistry.counter("myTestCounter", "tag1", "value1", "tag2", "value2");
递增计数器,
myCounter1.increment();
myCounter2.increment();
myCounter1n2.increment();
当我打印时(在步骤持续时间之后),
myCounter1.measure(); => value=1.0
myCounter2.measure(); => value=1.0
myCounter1n2.measure(); => value=1.0
而我期待(在步骤持续时间之后),
myCounter1.measure(); => value=2.0
myCounter2.measure(); => value=2.0
myCounter1n2.measure(); => value=1.0
我的理解正确吗?或者我怎样才能实现分组(或)按功能选择?