Skip to content

talkjs/telemetry_metrics_statsd

This branch is 4 commits ahead of, 4 commits behind beam-telemetry/telemetry_metrics_statsd:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ee1c8e5 · Apr 24, 2024

History

99 Commits
Aug 25, 2023
Apr 24, 2024
Sep 17, 2023
Mar 11, 2021
Oct 10, 2019
Jan 12, 2019
Sep 17, 2023
Mar 25, 2019
May 20, 2021
Sep 17, 2023
Aug 28, 2023

Repository files navigation

TelemetryMetricsStatsd

Test

Telemetry.Metrics reporter for StatsD-compatible metric servers (including DataDog).

To use it, start the reporter with the start_link/1 function, providing it a list of Telemetry.Metrics metric definitions:

import Telemetry.Metrics

TelemetryMetricsStatsd.start_link(
  metrics: [
    counter("http.request.count"),
    sum("http.request.payload_size"),
    last_value("vm.memory.total")
  ]
)

or put it under a supervisor:

import Telemetry.Metrics

children = [
  {TelemetryMetricsStatsd, [
    metrics: [
      counter("http.request.count"),
      sum("http.request.payload_size"),
      last_value("vm.memory.total")
    ]
  ]}
]

Supervisor.start_link(children, ...)

By default the reporter sends metrics to 127.0.0.1:8125 - both hostname / IP and port number can be configured using the :host and :port options. You can also configure the prefix for all the published metrics using the :prefix option.

Note that the reporter doesn't aggregate metrics in-process - it sends metric updates to StatsD whenever a relevant Telemetry event is emitted.

DataDog integration

To use the reporter with DataDog, add a formatter: :datadog to the reporter's list of options:

import Telemetry.Metrics

children = [
  {TelemetryMetricsStatsd, [
    metrics: [
      counter("http.request.count"),
      sum("http.request.payload_size"),
      last_value("vm.memory.total")
    ],
    formatter: :datadog
  ]}
]

Supervisor.start_link(children, ...)

Installation

Just add the reporter to your dependencies in mix.exs:

defp deps do
  [
    {:telemetry_metrics_statsd, "~> 0.6.0"}
  ]
end

Copyright and License

TelemetryMetricsStatsd is copyright (c) 2019 Arkadiusz Gil.

TelemetryMetricsStatsd source code is released under MIT license.

See LICENSE for more information.

About

Telemetry.Metrics reporter for StatsD-compatible metric servers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Elixir 100.0%