Slide 1

Slide 1 text

Dashboards as Code Sanooj Mananghat RootConf Data Engineer @ Intuit Hyderabad

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Demo Day

Slide 5

Slide 5 text

Scenario I: Teamwork in Dashboard

Slide 6

Slide 6 text

Problems in Manually created Dashboards - Human errors - No Meaningful History - No Rollbacks - Incosistent Dashbaords

Slide 7

Slide 7 text

Scenario II : Concurrent Modification - Difficult to Collaborate - Introduces Conflicts.

Slide 8

Slide 8 text

Scenarios III: External Consumers

Slide 9

Slide 9 text

Problems in Manually created Dashboards - Lacs Hygiene - No separate test environment - No/Minimal Peer Review System

Slide 10

Slide 10 text

DRY - Effects productivity - Zero value add - Difficult to scale

Slide 11

Slide 11 text

Problem Statement • Difficult to collaborate • Difficult to Scale • No/Minimal Peer Review • Effects Productivity • Introduces conflicts • Inconsistent • No Meaningful History • Untracked Temporary changes • No Rollback • Lacks Hygiene

Slide 12

Slide 12 text

Process • Process with Source control

Slide 13

Slide 13 text

Easiest Approach • Dashboards store data in JSON files.

Slide 14

Slide 14 text

Bloaty JSON

Slide 15

Slide 15 text

Dashboards as JSON - Bloaty huge JSON files - PR review became impossible - Duplicate blocks

Slide 16

Slide 16 text

How can we squeeze the elephant into the car trunk?

Slide 17

Slide 17 text

JSONNET Templates • Reduce Boilerplate and redundant code blocks

Slide 18

Slide 18 text

JSONET Loops • { "person1": { "name": "Alice", "welcome": "Hello Alice!" }, "person2": { "name": "Bob", "welcome": "Hello Bob!" }, "person3": { "name": "Jack", "welcome": "Hello Jack!" }, "person4": { "name": "Jill", "welcome": "Hello Jill!" }, "person5": { "name": "Pokemon", "welcome": "Hello Pokemon!" }, "person6": { "name": "Dora", "welcome": "Hello Dora!" }, "person7": { "name": "Jhony", "welcome": "Hello Jhony!" }, "person8": { "name": "Humpty", "welcome": "Hello Humpty!" }, "person99": { "name": "Dumpty", "welcome": "Hello Dumpty!" }, "person10": { "name": "Tom", "welcome": "Hello Tom!" } } { person1: { name: "Alice", welcome: "Hello " + self.name + "!", }, person2: self.person1 { name: “Bob”}, person3: self.person1 { name: “Jack" }, person4: self.person1 { name: “Jill" }, person5: self.person1 { name: “Pokemon" }, person6: self.person1 { name: “Dora" }, person7: self.person1 { name: “Jhony" }, person8: self.person1 { name: “Humty" }, person9: self.person1 { name: “Dumpty" }, person10: self.person1 { name: “Tom" }, }

Slide 19

Slide 19 text

Architecture

Slide 20

Slide 20 text

Dashboards as JSONNET - Simplest solution with less overhead. - Learning a new language. - Provisioning is still a challenge. - Jsonnet for grafana: grafonnet-lib

Slide 21

Slide 21 text

Manual Provisioning • Provisioning is still a challenge.

Slide 22

Slide 22 text

What?

Slide 23

Slide 23 text

Terraform • Terraform providers/plugins • terraform-provider-grafana • terraform-provider-kibana • terraform-provider-wavefront

Slide 24

Slide 24 text

Show me the code! resource "wavefront_dashboard" "test_dashboard" { name = "Terraform 12 Dashboard" url = "tf12-test" dynamic "section" { for_each = var.sections content { name = section.key dynamic "row" { iterator = rows for_each = section.value content { chart { name = rows.value.name description = rows.value.description units = "unit" source { name = rows.value.source query = rows.value.query } chart_setting { type = "line" } summarization = "MEAN” } } } } } } • terraform apply For loop

Slide 25

Slide 25 text

Architecture

Slide 26

Slide 26 text

Dashboards as Code - No dashboard specialist - Introduced strict peer review concept - Reviewing became meaningful - Consistent and collaborative. - Easily scalable. - Rollbacks become easier. - No repeated works, no clicks.

Slide 27

Slide 27 text

Dashboards as Code - Oncall more easier with consistent dashboard. - Less cognitive overhead. - Visual Diff with test and prod environment - Templatizing helped similar dashboard for similar services. - Monitoring as code

Slide 28

Slide 28 text

Wrapping Up • Initial Onboarding time. • Moved majority of our dashboards to Terraform • Moving further to Monitoring as Code. • Grafana-Lib (JSONNET based solution) • https://github.com/grafana/grafonnet-lib • Grafana python module - from Weave works • https://github.com/weaveworks/grafanalib • Grafana dashboard generator - from Uber • https://github.com/uber/grafana-dash-gen

Slide 29

Slide 29 text

And they lived happily ever after!!

Slide 30

Slide 30 text

Sanooj Mananghat Data Engineer @ Intuit