Closed Bug 1598438 Opened 6 years ago Closed 6 years ago

Decide on storage for events

Categories

(Cloud Services :: Operations: Metrics/Monitoring, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: brian, Assigned: brian)

References

Details

In the monitoring taskforce, we've decided that one of our gaps is an agreed upon place to store "events". By events, we mean a record with details of something operationally significant that happened. A good example of this is a deployment for an application.

The primary use we have for events is for overlaying them on dashboards. We also want a way to search and list matching events. We are using Grafana for dashboarding now, and it supports both of these via what it calls annotations (https://grafana.com/docs/reference/annotations/). It can overlay events on dashboards and display them in a table panel

Grafana has an API for submitting annotation that it will store in its own database. It can also display annotations by querying InfluxDB, Elasticsearch, Prometheus, MySQL, Postgres, and Loki.

We should investigate which of InfluxDB or Grafana we should recommend people use for storing events. Only if neither seems suitable should we look at one of the other datastores Grafana supports.

Assignee: nobody → dhouse

Dhouse is going to dig into this deeper and make a recommendation. Some differences I noticed when looking at this earlier

Authentication:
influxdb: applications can use the existing influxdb credentials we've provisioned
grafana: i think we'd generate grafana api keys for this

Data model
influxdb: events have a single timestamp plus an arbitrary number of key:value pairs (as tags or fields)
grafana: events have start and end timestamps, a description, and an arbitrary number of tag keys

Ease of annotating dashboard:
influxdb: a little painful, you have to write the query by hand
grafana: pretty easy, you just need to choose what tags to filter by

Dhouse has too much competing work to dig into this further, so I'm going to take a stab at it.

Assignee: dhouse → bpitts
See Also: → 1604314

After some chatting, the general recommendation is going to be Grafana's built in annotations storage, due to the ease of creating and displaying them. This handles the most common use case of tracking deploys or other events that just have a description and metadata very well.

For "events" that need to have a numeric payload (e.g. "cron job foo completed successfully after running for N seconds") people can just treat them as normal metrics in InflxuDB and then query their values, alert on them, etc. They can always be used as annotations on dashboards too with a little more work.

Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED

Oremj, per your comment on https://github.com/mozilla-services/cloudops-infra-deploylib/pull/106 I wanted to pull you in here to review the above and see what you think. Conceptually I like using InflxuDB, but that has a big con that it's quite a bit harder to add the query for annotations to your dashboard using InfluxDB as the source instead of Grafana.

Flags: needinfo?(oremj)

Looking at this fresh, the main downside of Grafana storage is reporting. That was unaddressed before because it wasn't a requirement at the time, but for deployment events specifically I think it may be soon. Grafana's annotations are fine for getting the chronology of events that happened for a service, but not for anything else.

So I think we'd also have to record deploys to InfluxDB or BigQuery to track deploy frequency per service and environment over time. I suspect that BigQuery will be preferred for that in order to

  1. display it in Data Studio
  2. join deploy data with other datasets that are there, e.g. cost and SLOs

However, BigQuery can't be used as an annotation source in Grafana, so maybe we should continue to ignore reporting in our general "record an event" recommendation. For our own implementation for deploy events in bug 1604314, we can always tack on sending the data to additional sources later.

Is the grafana data persisted between instance restarts and version upgrades?

I assume the annotations are stored in the database (https://grafana.com/docs/grafana/latest/installation/configuration/#database) alongside dashboards, data sources, users, etc.

Sending the data to additional sources later sounds good to me. I think we can do this once we start adding other deployment metrics.

Flags: needinfo?(oremj)
You need to log in before you can comment on or make changes to this bug.