Spring Actuator

  • An actuator is an additional feature of Spring that helps you to monitor and manage your application when you push it to production.
  • These actuators include auditing, health, CPU usage, HTTP hits, and metric gathering, and many more that are automatically applied to your application.

Endpoints

  • An endpoint is considered to be available when it is both enabled and exposed.
  • An endpoint can be exposed via HTTP or JMX (Java Management Extension)
  • Some examples of endpoints:
    • Health
    • Info
    • Beans
    • Mappings
    • Configprops
    • Httptrace
    • Heapdump
    • Threaddump
    • Shutdown

Examples:

  • Spring Boot actuator /Beans is used to get the list of all the spring beans in your application.
  • Spring Boot actuator /env returns the list of all the environment properties of running the spring boot application

Integrations

  • Actuator integrates with external systems using micrometer
  • Easily integrates with:
    • Prometheus
    • Datadog
    • New Relic etc.

Properties

management:  
  endpoint:  
    health:
      show-details: always # show extra info
      probes.enabled: true
    metrics.enabled: true   
    prometheus.enabled: true  
  endpoints:
    # Use * for everything
    web.exposure.include: env,health,info,loggers,metrics,prometheus 

Spring boot admin

Example Setup

  • Use micrometer-registry-prometheus to store the metrics in prometheus format
  • The metrics will be accessible at /actuator/prometheus
  • Use metricbeat to collect metrics from prometheus regularly
  • Use Kibana and elasticsearch to pull back data from metricbeat