client side monitoring with prometheus

24
Client-side Prometheus Metrics @tom_wilkie, CNCFCon Berlin April 2017

Upload: weaveworks

Post on 05-Apr-2017

434 views

Category:

Technology


11 download

TRANSCRIPT

Page 1: Client Side Monitoring With Prometheus

Client-side Prometheus Metrics@tom_wilkie, CNCFCon Berlin April 2017

Page 2: Client Side Monitoring With Prometheus
Page 3: Client Side Monitoring With Prometheus

The Problem

Page 4: Client Side Monitoring With Prometheus

A rich-client web app

Weave Cloud

~28k LOC

Page 5: Client Side Monitoring With Prometheus

What we had:

Page 6: Client Side Monitoring With Prometheus

What we wanted:

Page 7: Client Side Monitoring With Prometheus
Page 8: Client Side Monitoring With Prometheus

Prometheus Aggregating Push Gateway

JS Prometheus client library

Rich Client Web App

https://github.com/weaveworks/prom-aggregation-gateway

https://github.com/weaveworks/promjs

Page 9: Client Side Monitoring With Prometheus

weaveworks/promjs

Page 10: Client Side Monitoring With Prometheus

Failure modes

1. Failed to load JS quickly enough, or was invalid

2. JS hits a bug when rendering a view

3. High client <-> sever latency

Page 11: Client Side Monitoring With Prometheus

Case 1: Cannot load JS assets

^^ special handling code directly in the index.html ^^

Page 12: Client Side Monitoring With Prometheus

Case 1: Cannot load JS assets (continued)

timer cancelled after ~5s

Page 13: Client Side Monitoring With Prometheus

Case 2: Error rendering page

a higher order react class is then used to wrap the views

Page 14: Client Side Monitoring With Prometheus

Case 3: High client <-> sever latency

Page 15: Client Side Monitoring With Prometheus

Case 3: High client <-> sever latency (II)

Page 16: Client Side Monitoring With Prometheus

• “Counters” are actually more like gauges, with partial aggregation on the client (I’ll explain later)

• Client pushes to server every 15s

• Opensource: https://github.com/weaveworks/promjs

• All credit to Jordan Pellizzari @ Weaveworks

Page 17: Client Side Monitoring With Prometheus

weaveworks/prom-aggregation-gateway

Page 18: Client Side Monitoring With Prometheus

The Pushgateway never forgets series pushed to it and will expose them to Prometheus forever…

The latter point is especially relevant when multiple instances of a job differentiate their metrics in the

Pushgateway via an instance label or similar.

https://prometheus.io/docs/practices/pushing/

Page 19: Client Side Monitoring With Prometheus

Prometheus

Aggregating Push Gateway

Aggregated in memory

/metrics

weaveworks/prom-aggregation-gateway

~300 LOC

+

Page 20: Client Side Monitoring With Prometheus

Bunch of similar projects• Webdriver Exporter by Matt Bostock from Cloudflare

• Looks awesome, but we didn’t see this when we started our project… • https://github.com/mattbostock/webdriver_exporter

• Prometheus User Metrics by Riley Eynon-Lynch from Peardesk • New project, similar aims • https://github.com/peardeck/prometheus-user-metrics

• Torch by Outbrain • https://github.com/outbrain/torch

• Prometheus at JustWatch by Dominik Schulz from JustWatch • Describes the same problem, couldn’t find any code through • https://speakerdeck.com/dominikschulz/prometheus-at-justwatch

Page 21: Client Side Monitoring With Prometheus
Page 22: Client Side Monitoring With Prometheus

Demo

Page 23: Client Side Monitoring With Prometheus

Thank you!Questions?

Page 24: Client Side Monitoring With Prometheus

We’re hiring!London BerlinSan Francisco

[email protected]