Temps de lecture estimé : 5 minute(s)
OVH relies extensively on metrics to effectively monitor its entire stack. Whether they are low-level or business centric, they allow teams to gain insight into how our services are operating on a daily basis. The need to store millions of datapoints per second has produced the need to create a dedicated team to build a operate a product to handle that load: Metrics Data Platform. By relying on Apache Hbase, Apache Kafka and Warp 10, we succeeded in creating a fully distributed platform that is handling all our metrics… and yours!
Meet OMNI, our alerting layer
OMNI is our code name for a fully distributed, as-code, alerting system that we developed on top of Metrics. It is split into components:
- The management part, taking your alerts definitions defined in a Git repository, and represent them as continuous queries,
- The query executor, scheduling your queries in a distributed way.
The query executor is pushing the query results into Kafka, ready to be handled! We now need to perform all the tasks that an alerting system does:
- Handling alerts deduplication and grouping, to avoid alert fatigue.
- Handling escalation steps, acknowledgement or snooze.
- Notify the end user, through differents channels: SMS, mail, Push notifications, …
Handling alerts as streams of data,
moving from operators to another.
We embraced it, and decided to leverage Apache Flink to create Beacon. In the next section we are going to describe the architecture of Beacon, and how we built and operate it.
If you want some more information on Apache Flink, we suggest to read the introduction article on the official website: What is Apache Flink?
- One that is running the aggregations, and triggering notifications based on customer’s rules.
- One that is handling the escalation steps.
Then everything is merged to generate a notification, that is going to be forward to the right person. A notification message is pushed into Kafka, that will be consumed by another component called beacon-notifier.
If you are new to streaming architecture, I recommend reading Dataflow Programming Model from Flink official documentation.
Everything is merged into a dataStream, partitionned (keyed by in Flink API) by users. Here’s an example:
- SetSinceOnSelector, which is setting since when the alert is triggered
- SetStateAndTrend, which is setting the state (ONGOING, RECOVERY or OK) and the trend(do we have more or less metrics in errors).
Each of this class is under 120 lines of codes because Flink is handling all the difficulties. Most of the pipeline are only composed of classic transformations such as Map, FlatMap, Reduce, including their Rich and Keyed version. We have a few Process Functions, which are very handy to develop, for example, the escalation timer.
As the number of classes was growing, we needed to test our pipeline. Because it is only wired to Kafka, we wrapped consumer and producer to create what we call scenari: a series of integration tests running different scenarios.
Thanks to this, we easily developed an API over the queryable state, that is powering our alerting view in Metrics Studio, our codename for the Web UI of the Metrics Data Platform.
Apache Flink deployment
We are using RockDB as a state backend, backed by OpenStack Swift storage provided by OVH Public Cloud.
In short, we love Apache Flink!
If you are used to work with stream related software, you may have realized that we did not used any rocket science or tricks. We may be relying on basics streaming features offered by Apache Flink, but they allowed us to tackle many business and scalability problems with ease.
As such, we highly recommend that any developers should have a look to Apache Flink. I encourage you to go through Apache Flink Training, written by Data Artisans. Furthermore, the community has put a lot of effort to easily deploy Apache Flink to Kubernetes, so you can easily try Flink using our Managed Kubernetes!
Next week we come back to Kubernetes, as we will expose how we deal with ETCD in our OVH Managed Kubernetes service.