grafana is not enough: diy user interfaces for prometheus

31
Grafana is not enough: DIY user interfaces for Prometheus David Kaltschmidt @davkals

Upload: weaveworks

Post on 13-Apr-2017

721 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Grafana is not enough: DIY user interfaces for Prometheus

Grafana is not enough:DIY user interfaces for Prometheus

David Kaltschmidt @davkals

Page 2: Grafana is not enough: DIY user interfaces for Prometheus
Page 3: Grafana is not enough: DIY user interfaces for Prometheus

What is Prometheus

Timeseries DB

Borgmon (Google) for the rest of us

Open source

Cloud Native Foundation

Page 4: Grafana is not enough: DIY user interfaces for Prometheus

Get started$dockerrun-p9090:9090prom/prometheustime="2016-11-16T00:51:06Z"level=infomsg="Startingprometheus(version=1.2.1,branch=master,revision=dd66f2e94b2b662804b9aa1b6a50587b990ba8b7)"source="main.go:75"

time="2016-11-16T00:51:06Z"level=infomsg="Buildcontext(go=go1.7.1,user=root@fd9b0daff6bd,date=20161010-15:58:23)"source="main.go:76"

time="2016-11-16T00:51:06Z"level=infomsg="Loadingconfigurationfile/etc/prometheus/prometheus.yml"source="main.go:247"

time="2016-11-16T00:51:07Z"level=infomsg="Loadingseriesmapandheadchunks..."source="storage.go:354"

time="2016-11-16T00:51:07Z"level=infomsg="0seriesloaded."source="storage.go:359"

time="2016-11-16T00:51:07Z"level=warningmsg="NoAlertManagersconfigured,notdispatchinganyalerts"source="notifier.go:176"

Page 5: Grafana is not enough: DIY user interfaces for Prometheus

Expression browser

Page 6: Grafana is not enough: DIY user interfaces for Prometheus

Console Templates: /consoles/prometheus-overview.html

Page 7: Grafana is not enough: DIY user interfaces for Prometheus

Grafana

Page 8: Grafana is not enough: DIY user interfaces for Prometheus
Page 9: Grafana is not enough: DIY user interfaces for Prometheus

Aside: Grafanalibhttps://github.com/weaveworks/grafanalib

https://www.weave.works/grafana-dashboards-as-code/

Page 10: Grafana is not enough: DIY user interfaces for Prometheus

Grafana for troubleshooting?

Page 11: Grafana is not enough: DIY user interfaces for Prometheus

Whereto now?

Page 12: Grafana is not enough: DIY user interfaces for Prometheus

What does Bob need to do?• Explore queries

• Compare time values

• Document his research

• Add notes

• Share with co-workers

• Handover incident

Page 13: Grafana is not enough: DIY user interfaces for Prometheus

DIY all the things

• Jump out of Grafana

• Prometheus API

• Reuse time-series charts from expression browser

• React/Draft.js input fields

Page 14: Grafana is not enough: DIY user interfaces for Prometheus

Jumping out

Injectinglinksto wherewe wantto explorequeries

Page 15: Grafana is not enough: DIY user interfaces for Prometheus

Yay, browser extensions

https://github.com/weaveworks/weavecloud-browser-extension

Page 16: Grafana is not enough: DIY user interfaces for Prometheus

Jump, but where to?

Page 17: Grafana is not enough: DIY user interfaces for Prometheus

Enhancing the query field

/api/v1/label/__name__/values

Page 18: Grafana is not enough: DIY user interfaces for Prometheus

One step further

/api/v1/series?match[]=${metric}

Page 19: Grafana is not enough: DIY user interfaces for Prometheus

One step further

/api/v1/series?match[]=${metric}

Page 20: Grafana is not enough: DIY user interfaces for Prometheus

One step further

/api/v1/series?match[]=${metric}

Page 21: Grafana is not enough: DIY user interfaces for Prometheus

One step further

/api/v1/series?match[]=${metric}

Page 22: Grafana is not enough: DIY user interfaces for Prometheus

Naive syntax decorators for Draft.jsMetric Label key Label value /=\s*"([^"]+)"\s*/g

Page 23: Grafana is not enough: DIY user interfaces for Prometheus

Let’s add table mode

Page 24: Grafana is not enough: DIY user interfaces for Prometheus

Charts!

Page 25: Grafana is not enough: DIY user interfaces for Prometheus

/api/v1/query_range?query=..&start=..&end=..&step=..

• Range query to get graph data

• Rickshaw graph library (same as vanilla expression browser)

• https://github.com/prometheus/prometheus/blob/master/web/ui/static/js/graph.js

Page 26: Grafana is not enough: DIY user interfaces for Prometheus

Setup

Grafana Weave Cloud UI

Weave CloudCortex

Local Prometheus (acting as

agent)

Services

Browser extension

Local Cluster (e.g., K8s)

Page 27: Grafana is not enough: DIY user interfaces for Prometheus

DEMO

https://cloud.weave.works

Page 28: Grafana is not enough: DIY user interfaces for Prometheus

Todo• Deep link from Grafana (via plugin?)

• Multiple cells notebooks to tell incident story

• Values table

• Shareable notebooks with other users

• Lots of syntax tweaks, e.g. sum by (mode) (irate(node_cpu{mode!="idle"}[5m]))

Page 29: Grafana is not enough: DIY user interfaces for Prometheus

Take-aways• Look at your behaviour:

Where do you get stuck? What can you automate?

• Look for jump points

• Study the API, and how existing implementations are using it

• You’ll find easy ways to take it one step further

• Don’t be afraid of the frontend, just build it

🛒

Page 30: Grafana is not enough: DIY user interfaces for Prometheus

We’re hiring!London BerlinSan Francisco

Page 31: Grafana is not enough: DIY user interfaces for Prometheus

David Kaltschmidt @davkals

Connect your Prometheus to https://cloud.weave.works/

Trying to figure out how to open source it

Backend is already OSS:https://github.com/weaveworks/cortex

Try It Out!

Questions?