bolshakov/stoplight-admin

Add more details to circuits (threshold, cool off time, etc.)

Opened this issue · 1 comments

We just implemented stoplight-admin to manage Stoplight circuit breakers (thanks for creating it!) and noticed that the UI does not show details about each circuit, like threshold values, cool off time, notifiers, etc.

All these configs can be set per circuit with Stoplight but, currently, the only way for anybody to get them is by querying Redis (or any other data store) for each circuit.

We would like to be able to view and also change those configs whenever necessary through the UI.

I'm willing to work to include this feature and can create a PR for it if it's something that the community would also like to use. Please let me know your opinions and if you need more details about it.
It's something that my team needs ASAP so I'm planning to start working on it this week.

This is a valid question. However, currently, we don't store this data in Redis and, therefore, cannot display them in the UI. Moreover, nothing stops you from having two circuit breakers with the same name but different other parameters:

light1 = Stoplight('example-zero').with_threshold(1) { 1 / 0 }
light2 = Stoplight('example-zero').with_threshold(2) { 1 / 0 }

In the example above, Stoplight stores only names (example-zero), and the rest of the parameters exist only in the code. So today, displaying such data is not possible.

We would like to be able to view and also change those configs whenever necessary through the UI.

I like this idea and would love to hear opinions and suggestions.

On the other hand, I see drawbacks in storing such parameters in the database, and there are valid questions:

  • It's still possible to configure two circuit breakers with the same name but different parameters. It's not obvious how to display them in the UI.
  • Shall we read parameters from Redis before every execution of the code protected with the circuit breaker? Or maybe it's better to cache them for a while. What are the expectations here?
  • Configuring parameters, the code, and overriding in the Redis could be confusing. I imagine someone trying to tune circuit breakers in the code while they're overridden in the Redis.

A decent alternative could be configuring circuit breakers using a config file or environment variables. This way, you still don't have to change your code to tune parameters.

If you have any particular use cases, I appreciate it if you can share them. Also consider filing an issue into Stoplight itself https://github.com/bolshakov/stoplight/issues/new