abstractOwl / hystrix-demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hystrix-demo

Demo-ing Hystrix fault-tolerance features. Sets up Spring boot microservice that publishes metrics to Prometheus, as well as a Graphene container to view the metrics.

Getting Started

To get started, run bash start.sh.

Setting up Grafene

  1. Go to http://localhost:3000
  2. Log in with default username and password admin.
  3. Click "Add your first data source" -> "Prometheus"
  4. Under "HTTP" -> "URL", input <prometheus container ip>:9090
  5. Click "Save & Test" at the bottom
  6. To start exploring metrics, click "Explore" on the sidebar on the left

hystrix-demo endpoints

Metrics endpoint

There is also a separate non-Hystrix endpoint (http://localhost:8080/non-hystrix) to demonstrate logging metrics using @Timed and @Counted. This is separate because it doesn't seem possible to use these annotations simultaneously with the @HystrixCommand annotation.

Metrics generated by @Timed should show up as NonHystrixService:GetResult:Count_total while metrics generated by @Counted should show up as NonHystrixService:GetResult:Time_*.

Query to graph error rate:

sum(rate(NonHystrixService:GetResult:Count_total{result="success"}[$__interval])) / sum(rate(NonHystrixService:GetResult:Count_total{}[$__interval]))

About


Languages

Language:Java 84.7%Language:Shell 13.6%Language:Dockerfile 1.7%