Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit 9574aa8

Browse files
committed
each on new a separate line
1 parent 44b06b7 commit 9574aa8

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

metrics/Gauge.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@ LabelValue constantLabelValue = LabelValue.create("localhost");
3535

3636
Map<LabelKey, LabelValue> constantLabels = Collections.singletonMap(constantLabelKey, constantLabelValue);
3737

38-
LongGauge gauge = metricRegistry.addLongGauge().toBuilder()
39-
.setName("queue_size").setDescription("The number of jobs")
40-
.setLabelKeys(labelKeys).setConstantLabels(constantLabels).build();
38+
LongGauge gauge = metricRegistry.longGaugeBuilder()
39+
.setName("queue_size")
40+
.setDescription("The number of jobs")
41+
.setLabelKeys(labelKeys)
42+
.setConstantLabels(constantLabels)
43+
.build();
44+
4145
LongPoint point = gauge.getOrCreateTimeSeries(labelValues);
4246

4347
void doSomeWork() {
@@ -78,9 +82,12 @@ LabelValue constantLabelValue = LabelValue.create("localhost");
7882

7983
Map<LabelKey, LabelValue> constantLabels = Collections.singletonMap(constantLabelKey, constantLabelValue);
8084

81-
DerivedDoubleGauge gauge = metricRegistry.addDerivedDoubleGauge().toBuilder()
82-
.setName("vm_cpu_cycles").setDescription("Virtual cycles executed on VM")
83-
.setLabelKeys(labelKeys).setConstantLabels(constantLabels).build();
85+
DerivedDoubleGauge gauge = metricRegistry.derivedDoubleGaugeBuilder()
86+
.setName("vm_cpu_cycles")
87+
.setDescription("Virtual cycles executed on VM")
88+
.setLabelKeys(labelKeys)
89+
.setConstantLabels(constantLabels)
90+
.build();
8491

8592
gauge.createTimeSeries(labelValues, cpuInfo,
8693
new ToDoubleFunction<CpuInfo>() {

0 commit comments

Comments
 (0)