PromQL for Mere Mortals Ian Billett Software Engineer - - PowerPoint PPT Presentation

promql for mere mortals
SMART_READER_LITE
LIVE PREVIEW

PromQL for Mere Mortals Ian Billett Software Engineer - - PowerPoint PPT Presentation

PromQL for Mere Mortals Ian Billett Software Engineer ianbillett@improbable.io /billett_ Date 07/11/19 Agenda Intro Gauges & Counters PromQL is important How en-gauge-ing Time Series Operators & Functions Series-ly cool


slide-1
SLIDE 1

PromQL for Mere Mortals

Ian Billett Software Engineer ianbillett@improbable.io /billett_ Date 07/11/19

slide-2
SLIDE 2

Agenda

Intro

PromQL is important

Time Series

Series-ly cool

Vector Selectors

Range vs Instant

Operators & Functions

Functionally operational

Demo!

Pray to the demo gods

Gauges & Counters

How en-gauge-ing

slide-3
SLIDE 3

PromQL is Important

■ Queries ■ Alerts ■ Dashboards

slide-4
SLIDE 4

...but also intimidating

label_replace((sum by(job, env, cluster, instance) (exthttp_requests_total{ code=~"^5..$", err_category!="Transient", handler!="/health", job="prometheus"} ) or on(job, env, cluster, instance) sum by(job, env, cluster, instance) ((up{ job="prometheus"} == 1) * 0)), "code", "5xx", "job", ".*")

slide-5
SLIDE 5

Time Series

identifier -> (t0, v0), (t1, v1), (t2, v2), (t3, v3), .... {__name__="http_requests_total", path="/status", method="GET"} http_requests_total{path=”/status”, method=”GET”}

slide-6
SLIDE 6

PromQL

Four data types: ■ Strings ✅ ■ Scalars ✅ ■ Instant Vectors 🤸 ■ Range Vectors 🤸

slide-7
SLIDE 7

Some context...

■ SQL ✅ ■ JQL ✅ 😴 ■ PromQL … ?

slide-8
SLIDE 8

Instant Vectors

slide-9
SLIDE 9

Instant Vectors

slide-10
SLIDE 10

Instant Vectors

slide-11
SLIDE 11

Range Vectors

slide-12
SLIDE 12

Range Vectors

slide-13
SLIDE 13

Range Vectors

slide-14
SLIDE 14

Yes

Are they really that different?

slide-15
SLIDE 15

Data Model

slide-16
SLIDE 16

Instant Vector

slide-17
SLIDE 17

Range Vector

slide-18
SLIDE 18

Instant Vector

One value per time series guaranteed.

Range Vector

Any number of values between two timestamps.

slide-19
SLIDE 19

Counters & Gauges

slide-20
SLIDE 20

Counters

slide-21
SLIDE 21

Gauges

slide-22
SLIDE 22
slide-23
SLIDE 23

Aggregation Operators

■ sum() ■ min() ■ max() ■ stddev() ■ stdvar()

Instant Vector Input: Instant Vector Output:

slide-24
SLIDE 24

Binary Operators

■ Arithmetic Binary Operators: +, -, /, *, ^, %, ■ Comparison Binary Operators: !=, ==, <, <=, >, >= ■ Set Binary Operators: and, or, unless Scalar Scalar Scalar

& =

Instant Vector Instant Vector Instant Vector

🌷🌷🌷

slide-25
SLIDE 25

Functions

Instant Vector Instant Vector Range Vector Instant Vector

slide-26
SLIDE 26

rate(v range-vector)

rate(http_requests_total[10m]) [4,6,1,3] [4,6,7,9]

slide-27
SLIDE 27

Demo time!

slide-28
SLIDE 28

Gotchas

■ Tell your aggregation operators about the labels you care about! ■ Never compare raw counters - use rate() ■ Be careful with label sets when using binary

  • perators.
slide-29
SLIDE 29

Resources

■ https://www.robustperception.io Blog ■ Prometheus Up & Running Book ■ https://prometheus.io/docs/prometheus/ documentation

slide-30
SLIDE 30