0

How can we disable actuator completely? If we disable the actuator endpoint does it mean that actuator has disabled that functionality as well? I doubt that. I have nothing defined in my application.properties which means only /health and /info should be exposed. But in my code

package com.rbc.rbc.controllers;

import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.Measurement;
import io.micrometer.core.instrument.Meter;
import io.micrometer.core.instrument.Metrics;
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class RestController1 {

    SimpleMeterRegistry sm;

    @GetMapping("/welcome")
    public void test(){
        SimpleMeterRegistry m=(SimpleMeterRegistry)(Metrics.globalRegistry.getRegistries().toArray())[0];
        List<Meter> met=m.getMeters();
        for (Meter mtr:met) {
            System.out.println(mtr.getId().getName());
            if(mtr.getId().getName().equals("http.server.requests")){
            mtr.measure().forEach(mi -> {
                System.out.println(mi.getStatistic());
                System.out.println(mi.getValue());
            });
        }}
    }

}

I am still able to see the metrics programmatically. Does that mean that only the endpoint is disabled but the metrics are still collected? Is there a way to disable it completely. I am saying so because I do not want the metrics to be collected I need only the health endpoint for now.

Vy Do
  • 46,709
  • 59
  • 215
  • 313
Jeets
  • 3,189
  • 8
  • 34
  • 50
  • Does this answer your question? [Spring Boot Actuator/Micrometer Metrics Disable Some](https://stackoverflow.com/questions/48451381/spring-boot-actuator-micrometer-metrics-disable-some) – 0x1C1B Sep 05 '22 at 08:53
  • Even if you do that it only disables the web endpoint,if you run the above program in my question with those settings in the link you provided, you will notice that the metrics are still getting recorded. – Jeets Sep 05 '22 at 08:59

0 Answers0