Created
February 6, 2018 18:58
-
-
Save jkschneider/8b54ba8e4351dc84ddd5759a7e3191cb to your computer and use it in GitHub Desktop.
Micrometer 400
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.micrometer.core.samples; | |
import io.micrometer.core.instrument.MeterRegistry; | |
import io.micrometer.core.instrument.Tags; | |
import io.micrometer.core.samples.utils.SampleConfig; | |
import java.util.Collections; | |
import java.util.List; | |
public class GaugeCollection { | |
public static void main(String[] args) throws InterruptedException { | |
MeterRegistry registry = SampleConfig.myMonitoringSystem(); | |
List<Integer> someList = Collections.singletonList(1); | |
registry.gaugeCollectionSize( | |
"gauge.list", | |
Tags.of("sometag", "tag.value"), | |
someList); | |
for(int i = 0; i < 20; i++) { | |
Thread.sleep(1000); | |
} | |
System.out.println("made list null"); | |
someList = null; | |
// at some point, the list gets garbage collected and the metric drops off of Datadog | |
for(;;) { | |
Thread.sleep(100); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment