Stability note: the package is not mature yet, use with caution and pin particular versions
The package provides a simple framework to manage API entities as-code. The framework supports CRUD operations on independent objects.
- Grafana 8 (source): folders, v8 alert groups
The package is available at PyPi:
pip install monitoring-as-codeUntil the project is mature, please pin a particular version. E.g.:
pip install monitoring-as-code==0.0.2People do often configure alerting in the UI because "it is handy", or never configure alerting because "it is difficult". Configuring alerts in UI do not preserve authorship and prone to human errors.
The framework aims to provide a way to setup alerting easy, save configuration in a version control system (and review changes). Since the framework is written in Python, you can compose templates of alerts.
The ultimate goal is for people to use alert templates together with a metric exporter and its dashboard template.
The base framework provides abstractions for a Provider to implement.
The Provider represents a remote system, it can enclose dependency resolution logic within a service (e.g. the processing order).
Providers may use a Handler to handle objects of a single type.
All instrumented objects must inherit MonitoringObject and provide a unique local_id. Once an object is inside the processing, it is encapsulated into a LocalResource.
The following resources are present:
LocalResource[T]: represents an objectTthat is only present locallyMappedResource[T]: a local resource with a known remote identifierSyncedResource[T]: a local object coupled with the corresponding remote stateObsoleteResource[T]: previously known resource that is no longer defined locally
Refer to the demo folder for examples
- Extend Grafana provider:
- integrate more APIs: data sources, notification channels, permissions.
- Extract providers to a separate repository. Users will be able to download only necessary providers.
- Allow to reference fields that are computed by a remote system (e.g.: ids for referencing).
