Giter Site home page Giter Site logo

telemetry_metrics's Introduction

Telemetry.Metrics

CircleCI Codecov

Telemetry.Metrics provides a common interface for defining metrics based on :telemetry events. While a single event means that a thing happened (e.g. an HTTP request was sent or a DB query returned a result), a metric is an aggregation of those events over time.

For example, to build a sum of HTTP request payload size received by your system, you could define the following metric:

Telemetry.Metrics.sum("http.request.payload_size")

This definition means that the metric is based on [:http, :request] events, and it should sum up values under :payload_size key in events' measurements.

Telemetry.Metrics also supports breaking down the metric values by tags - this means that there will be a distinct metric for each unique set of selected tags found in event metadata:

Telemetry.Metrics.sum("http.request.payload_size", tags: [:host, :method])

The above definiton means that we want to keep track of the sum, but for each unique pair of request host and method (assuming that :host and :method keys are present in event's metadata).

There are four metric types provided by Telemetry.Metrics:

  • counter, which counts the total number of emitted events
  • sum which keeps track of the sum of selected measurement
  • last value, holding the value of the selected measurement from the most recent event
  • distribution, which builds a histogram of selected measurement

Note that the metric definitions themselves are not enough, as they only provide the specification of what is the expected end-result. The job of subscribing to events and building the actual metrics is a responsibility of reporters. This is the crucial part of this library design - it doesn't aggregate events itself but relies on 3rd party reporters to perform this work in a way that makes the most sense for a particular monitoring system.

See the documentation on hexdocs for more details.

Copyright and License

Telemetry.Metrics is copyright (c) 2018 Chris McCord and Erlang Solutions.

Telemetry.Metrics source code is released under Apache License, Version 2.0.

See LICENSE and NOTICE files for more information.

telemetry_metrics's People

Contributors

arkgil avatar bryannaegele avatar josevalim avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.