Prometheus doesn't scrap custom metrics from Spring Boot

Hello, I have Spring Boot application on internal port 8080, and I expose metrics on endpoint /actuator/prometheus which look like this:

# HELP jvm_threads_states_threads The current number of threads
# TYPE jvm_threads_states_threads gauge
jvm_threads_states_threads{state="runnable",} 10.0
jvm_threads_states_threads{state="blocked",} 0.0
jvm_threads_states_threads{state="waiting",} 11.0
jvm_threads_states_threads{state="timed-waiting",} 10.0
...

my toml.yaml looks like on below:

[metrics]
  port = 8080
  path = "/actuator/prometheus"

Buuut… I don’t see any datasource or metrics in Grafana. What I missed or what I’m doing wrong?
Thanks for the help!

I’ve made it working :smiley: I had to add prometheus.yml to the application with the configuration as below:

global:
  scrape_interval: 15s
  evaluation_interval: 15s

scrape_configs:
  - job_name: 'spring boot scrape'
    metrics_path: '/actuator/prometheus'
    scrape_interval: 5s
    static_configs:
      - targets: [ '0.0.0.0:8080' ]

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.