So I tried to use Micrometer on Spring Boot 2.X to log metrics to Prometheus. I added the dependency into gradle:

```
implementation 'io.micrometer:micrometer-registry-prometheus:latest.release'

```

and then I tried to add any Metrics like:

```
CompositeMeterRegistry compositeRegistry = new CompositeMeterRegistry();
PrometheusMeterRegistry prometheusMeterRegistry =
    new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
compositeRegistry.add(prometheusMeterRegistry);
long start = System.currentTimeMillis();

doSomething();

long duration = System.currentTimeMillis() - start;

Timer timer =
    Timer.builder("test.times")
        .publishPercentiles(0.5, 0.75, 0.95)
        .maximumExpectedValue(Duration.ofSeconds(15))
        .minimumExpectedValue(Duration.ofSeconds(15))
        .register(compositeRegistry);
timer.record(duration, TimeUnit.MILLISECONDS);
compositeRegistry.timer("test.times.new").record(duration, TimeUnit.MILLISECONDS);
AtomicInteger test = compositeRegistry.gauge("custom.gauge", new AtomicInteger(8));
test.set(30);
Counter counter = compositeRegistry.counter("custom.counter");
counter.increment();

```

when I go to localhost:port/actuator/prometheus i can see some metrics like:

```
# HELP jvm_gc_pause_seconds Time spent in GC pause
# TYPE jvm_gc_pause_seconds summary
jvm_gc_pause_seconds_count{action="end of minor GC",cause="Metadata GC Threshold",} 1.0
jvm_gc_pause_seconds_sum{action="end of minor GC",cause="Metadata GC Threshold",} 0.045
jvm_gc_pause_seconds_count{action="end of minor GC",cause="G1 Evacuation Pause",} 2.0
jvm_gc_pause_seconds_sum{action="end of minor GC",cause="G1 Evacuation Pause",} 0.036

```

but there is nothing about the Timer, Gauge or Counter I added. I debugged myself through the code and I can see that it is executed and when i look into the compositeRegistry-Object, i can see that something is available even if I dont see any result of any metrics in the values:

[![enter image description here](https://i.stack.imgur.com/MNH32.png)](https://i.stack.imgur.com/MNH32.png)

Am I missing something I need to configure? Or any implementation problems?