Introduction Client Libraries

  • Instrumenting your code
  • Libraries
    • Official: Go, Java/Scala, Python, Ruby
    • Unofficial: Bash, C++, Common Lisp, Elixir, Erlang, Haskell, Lua for Nginx, Lua for Tarantool, .NET/C#, Node.js, PHP, Rust
  • No client library available?
    • Implement it yourself in one of the supported exposition formats
  • Exposition formats:
    • Simple text-based format
    • Protocol-buffer format (Prometheus 2.0 removed support for the protocol-buffer format)
  • 4 types of metrics
    • Counter
      • A value that only goes up (e.g. Visits to a website)
    • Gauge
      • Single numeric value that can go up and down (e.g.  CPU load, temperature)
    • Histogram
      • Samples observations (e.g. request durations or response sizes) and these observations get counted into buckets. Includes (_count and _sum)
      • Main purpose is calculating quantiles
    • Summary
      • Similar to a histogram, a summary samples observations (e.g. request durations or response sizes).
      • A Summary also provides a total count of observations and a sum of all observed values, it calculates configurable quantiles over a sliding time window.
      • Example:
        • Your need 2 counters for calculating the latency
        • 1) total request(_count)
        • 2) the total latency of those requests (_sum)
      • Take the rate() and divide = average latency

Client Libraries - Python Example

Client Libraries - Golang Example

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.