resilience4j / resilience4j-spring-boot2-demo

A Spring Boot 2 demo which shows how to use the Resilience4j Spring Boot 2 Starter
Apache License 2.0
254 stars 190 forks source link

Query with instance in Prometheus #49

Closed leejongchan closed 3 years ago

leejongchan commented 3 years ago

Hello Resilience4j :)

I got curious when I tried to make monitoring system with Prometheus.

is it possible to query with instance in Prometheus?

sum(resilience4j_circuitbreaker_state{instance="$instance", state="closed"})

I can see some query using instance in dashboard.json file. but I can not find any datas using instance in Prometheus.

# HELP resilience4j_circuitbreaker_state The states of the circuit breaker
# TYPE resilience4j_circuitbreaker_state gauge
resilience4j_circuitbreaker_state{application="resilience4j-jc",name="testCircuitBreaker",state="disabled",} 0.0
resilience4j_circuitbreaker_state{application="resilience4j-jc",name="testCircuitBreaker",state="closed",} 1.0
resilience4j_circuitbreaker_state{application="resilience4j-jc",name="testCircuitBreaker",state="open",} 0.0
resilience4j_circuitbreaker_state{application="resilience4j-jc",name="testCircuitBreaker",state="half_open",} 0.0
resilience4j_circuitbreaker_state{application="resilience4j-jc",name="testCircuitBreaker",state="forced_open",} 0.0
resilience4j_circuitbreaker_state{application="resilience4j-jc",name="testCircuitBreaker",state="metrics_only",} 0.0

is there any option to use instance?

leejongchan commented 3 years ago

I found the way to use instance in Spring Boot.

management.metrics.tags.instance: ${value}