stephenyeargin / hubot-grafana

📈🤖 Query Grafana dashboards
http://docs.grafana.org/tutorials/hubot_howto/
MIT License
154 stars 48 forks source link

Let's do some big refactoring #177

Closed KeesCBakker closed 3 months ago

KeesCBakker commented 3 months ago

So, I'm currently working at a feature where I need to respond with multiple dashboards from multiple places. I don't have to option to just create that dashboard and return it. The "easiest way" to implement the feature is to do some rewriting of the package into 4 components: the bot, an adapter, a service and a client.

┌────────────────────────────┐   ┌────────────────────────┐    ┌────────────────────────┐ 
│ BOT                        │   │ ADAPTER                │    │ CUSTOM RESPONDER       │ 
│                            │   │                        │    │                        │ 
│ handles request from Hubot ├───► respond to a specific  ├────► influence the way the  │ 
│ responsible for response   │   │ chat platform          │    │ response is written    │ 
│ formatting                 │   │                        │    │                        │ 
└──────────────┬─────────────┘   └────────────────────────┘    └────────────────────────┘ 
               │                                                                          
┌──────────────▼─────────────┐                                                            
│ SERVICE                    │                                                            
│                            │                                                            
│ business rules for         │                                                            
│ querying of dashboards     │                                                            
└──────────────┬─────────────┘                                                            
               │                                                                          
┌──────────────▼─────────────┐                                                            
│  CLIENT                    │                                                            
│                            │                                                            
│  interaction with the      │                                                            
│  Grafana API over HTTP     │                                                            
└────────────────────────────┘                                                                          

The service should return small DTOs so we can build these new types of integrations.

Way forward

I think we should do the following: