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

Commit

Permalink
each on new a separate line
Browse files Browse the repository at this point in the history
  • Loading branch information
mayurkale22 committed Mar 19, 2019
1 parent be2cd5e commit 6106cf1
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions metrics/Gauge.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ LabelValue constantLabelValue = LabelValue.create("localhost");

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

LongGauge gauge = metricRegistry.addLongGauge().toBuilder()
.setName("queue_size").setDescription("The number of jobs")
.setLabelKeys(labelKeys).setConstantLabels(constantLabels).build();
LongGauge gauge = metricRegistry.longGaugeBuilder()
.setName("queue_size")
.setDescription("The number of jobs")
.setLabelKeys(labelKeys)
.setConstantLabels(constantLabels)
.build();

LongPoint point = gauge.getOrCreateTimeSeries(labelValues);

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

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

DerivedDoubleGauge gauge = metricRegistry.addDerivedDoubleGauge().toBuilder()
.setName("vm_cpu_cycles").setDescription("Virtual cycles executed on VM")
.setLabelKeys(labelKeys).setConstantLabels(constantLabels).build();
DerivedDoubleGauge gauge = metricRegistry.derivedDoubleGaugeBuilder()
.setName("vm_cpu_cycles")
.setDescription("Virtual cycles executed on VM")
.setLabelKeys(labelKeys)
.setConstantLabels(constantLabels)
.build();

gauge.createTimeSeries(labelValues, cpuInfo,
new ToDoubleFunction<CpuInfo>() {
Expand Down

0 comments on commit 6106cf1

Please sign in to comment.