Elug SP 2016 - Measuring your Elixir Application

4569aec00cb223b3fbf484f9e7ba1256?s=47 Renan Ranelli
April 18, 2016
180

Elug SP 2016 - Measuring your Elixir Application

In this talk I show how you can use Exometer, InfluxDB and Grafana to collect & observer application metrics easily and extensibly.

4569aec00cb223b3fbf484f9e7ba1256?s=128

Renan Ranelli

April 18, 2016
Tweet

Transcript

  1. MEASURING YOUR ELIXIR APPLICATION Renan Ranelli

  2. … [OR]: HOW TO USE NUMBERS TO MAKE BETTER DECISIONS

    Renan Ranelli
  3. Milhouse (Renan Ranelli)

  4. Software Engineer @ Milhouse (Renan Ranelli)

  5. (former) Software Engineer @ Milhouse (Renan Ranelli)

  6. Milhouse (Renan Ranelli)

  7. AGENDA • Why should I care about metrics? • General

    principles when collecting metrics • How we measure our things @ Xerpa • Demo demo demo
  8. DISCLAIMER • The main inspiration for this talk is Coda

    Hale's “Metrics Metrics” talk: • https://www.youtube.com/watch?v=czes-oa0yik
  9. WHY SHOULD I CARE ABOUT METRICS?

  10. WHY? • We write code.

  11. WHY? • We write code. • Code generates business value.

  12. WHY? • We write code. • Code generates business value.

    – When we RUN it is running. – Not when we write it.
  13. WHY? • In order to generate more business value, we

    need to make better decisions about our code.
  14. WHY? • In order to generate more business value, we

    need to make better decisions about our code. • In order to make better decisions about our code (about anything really) we need to measure it.
  15. THE MAP IS NOT THE TERRITORY

  16. WHY? • We have a mental model of what our

    code does.
  17. WHY? • We have a mental model of what our

    code does. • We are often wrong
  18. WHY? • We have a mental model of what our

    code does. • We are often wrong • There is no physical counterpart for the things we work with. We spend too much times inside our heads.
  19. WHICH IS FASTER?

  20. WE DON'T KNOW

  21. WHY?

  22. WHY?

  23. WHY? • If we we're so wrong in such a

    trivial example, imagine a typical web-app scenario:
  24. WHY? • If we we're so wrong in such a

    trivial example, imagine a typical web-app scenario: – Action routing – Database queries – Template rendering – Session cache
  25. WHY? • If we we're so wrong in such a

    trivial example, imagine a typical web-app scenario: – Action routing (10ms) – Database queries (31ms) – Template rendering (22ms) – Session cache (327ms)
  26. WE DON'T KNOW

  27. WE DON'T KNOW UNTIL WE SEE OUR CODE FOR WHAT

    IT **ACTUALLY** DOES (SCIENCE!!)
  28. METRICS METRICS METRICS

  29. TYPES OF MEASUREMENTS – Counters – Gauges – Histograms –

    Timers (See coda-hales “metrics, metrics” talk!)
  30. TYPES OF MEASUREMENTS

  31. HOW WE MEASURE THINGS @ XERPA

  32. • ESTAMOS CONTRATANDO

  33. • ESTAMOS CONTRATANDO (principalmente se vc manjar frontend)

  34. • ESTAMOS CONTRATANDO (principalmente se vc manjar frontend, mas também

    rola backend)
  35. • • • SQL-like query language • HTTP interface •

    Continuous Queries • Seamless integration with Grafana • (has an exometer reporter)
  36. • • <<<<<<<< LIVE DEMO >>>>>>>>> • https://github.com/rranelli/elugsp_milmetrics

  37. • mix.exs

  38. • config.exs

  39. • plug/metrics.exs

  40. • Start `grafana` and `influxdb` with `make start` • Configure

    a new data source for influxdb 0.9x, user: root, pass: root, host: http://localhost:8086 • Profit
  41. OBRIGADO !

  42. @renanranelli /rranelli Renan Ranelli (Milhouse) milhouseonsofware.com