promql for mere mortals
play

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


  1. PromQL for Mere Mortals Ian Billett Software Engineer ianbillett@improbable.io /billett_ Date 07/11/19

  2. Agenda Intro Gauges & Counters PromQL is important How en-gauge-ing Time Series Operators & Functions Series-ly cool Functionally operational Vector Selectors Demo! Range vs Instant Pray to the demo gods

  3. PromQL is Important ■ Queries ■ Alerts ■ Dashboards

  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", ".*")

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

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

  7. Some context... ■ SQL ✅ ■ JQL ✅ 😴 ■ PromQL … ?

  8. Instant Vectors

  9. Instant Vectors

  10. Instant Vectors

  11. Range Vectors

  12. Range Vectors

  13. Range Vectors

  14. Are they really that different? Yes

  15. Data Model

  16. Instant Vector

  17. Range Vector

  18. Instant Vector One value per time series guaranteed. Range Vector Any number of values between two timestamps.

  19. Counters & Gauges

  20. Counters

  21. Gauges

  22. Aggregation Operators sum() ■ min() ■ Instant Vector Input: max() ■ stddev() ■ Instant Vector Output: stdvar() ■

  23. Binary Operators Arithmetic Binary Operators: +, -, /, *, ^, %, ■ Comparison Binary Operators: !=, ==, <, <=, >, >= ■ Set Binary Operators: and, or, unless ■ = & Instant Vector Scalar Instant Vector Scalar Instant Vector Scalar 🌷🌷🌷

  24. Functions Instant Vector Instant Vector Range Vector Instant Vector

  25. rate(v range-vector) rate(http_requests_total[10m]) [4,6,1,3] [4,6,7,9]

  26. Demo time!

  27. 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 operators.

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

Recommend


More recommend