Upgrade to Pro — share decks privately, control downloads, hide ads and more …

An Introduction to Prometheus for App Developers

An Introduction to Prometheus for App Developers

I've presented this talk at KubeCon 2017 in Austin.

The video recording of this available on YouTube: https://youtu.be/-7fO99IiTpY.

121dcfb4f05ed316247772545e2cd590?s=128

Ilya Dmitrichenko

December 18, 2017
Tweet

Transcript

  1. @errordeveloper An Introduction to Prometheus for App Developers

  2. I build apps, and I do microservices

  3. I let k8s run my apps for me

  4. None
  5. observability is absolutely essential

  6. end goal: continuous improvement

  7. None
  8. None
  9. None
  10. None
  11. why must I instrument my app!?

  12. microservices is a culture

  13. what is Prometheus & why use it?

  14. what is Prometheus & why use it?

  15. how do I instrument my app for Prometheus?

  16. /metrics

  17. /metrics Content-Type: text/plain

  18. <name:string> <value:float>

  19. new_users_count 250.0

  20. <name:string>{<labels>} <value:float>

  21. new_users_count{locale=“en_GB”} 49.0 new_users_count{locale=“pt_BR”} 51.0 new_users_count{locale=“ru_RU”} 45.0 new_users_count{locale=“zh_HK”} 55.0 new_users_count{locale=“zh_TW”} 50.0

  22. > curl -i http://myapp:8080/metrics Content-Type: text/plain ... process_uptime_seconds 145236.015 http_requests_duration_seconds_count

    2.0 new_users_count 250.0
  23. > curl -i http://myapp:8080/metrics Content-Type: text/plain ... http_requests_count{method="GET",status="200",uri="/"} 1.0 http_requests_count{method=“PUT”,status=“403",uri="/"}

    1.0
  24. prometheus.io/docs/concepts/metric_types

  25. how do I use it to improve my app?

  26. process_uptime_seconds

  27. process_uptime_seconds{job=“myapp”}

  28. http_requests_duration_seconds_count

  29. http_requests_duration_seconds_count{ job=“myapp”, method=“GET”, uri=“/”, }

  30. sum( http_requests_duration_seconds_count{ job=“myapp”, method=“GET”, uri=“/”, } )

  31. sum( rate( http_requests_duration_seconds_count{ job=“myapp”, method=“GET”, uri=“/”, }[1m] ) )

  32. up

  33. up{job=“myapp"}

  34. sum( up{job=“myapp"} ) by (job)

  35. tutorial: step-by-step guide to Prometheus with Node.js http://github.com/errordeveloper/prom-nodejs-demo

  36. cloud.weave.works

  37. ilya@weave.works slack.weave.works