View Source TelemetryMetricsTelegraf (telemetry_metrics_telegraf v0.4.0)

InfluxDB reporter for Telemetry.Metrics.

TelemetryMetricsTelegraf:

  • uses all except last dot-separated segments of metric name as influxdb measurement name ("foo.bar.duration" -> "foo.bar")
  • uses the last name segment or :field_name reporter option as field key ("foo.bar.duration" -> "duration")
  • reports metrics with the same measurement name as a single influxdb measurement (with multiple fields)
  • uses adapters to provide flexibility in influxdb client choice (see spec at TelemetryMetricsTelegraf.Writer)

For example, metrics definition

[
  summary("app.repo.query.decode_time", tags: [:source])
  summary("app.repo.query.total_time", tags: [:source])
]

for event

:telemetry.execute([:app, :repo, :query], %{total_time: 100, decode_time: 30}, %{source: "users"})

yields

  app.repo.query,source="users" total_time=100,decode_time=30

influxdb measurement.

Configuration options

Refer to TelemetryMetricsTelegraf.AppConfig for the complete list of available configuration options.

Options can be set:

  • as metric reporter options
    summary("foo.value", reporter_options: [period: "1m"])
  • as reporter process options
    TelemetryMetricsTelegraf.start_link(
    metrics: metrics(),
    adapter: adapter(),
    period: "45s"
    )
  • as application config
# config/config.exs
config :telemetry_metrics_telegraf, period: "50s"

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Link to this section Types

Specs

Specs

args() ::
  keyword(
    {:adapter, TelemetryMetricsTelegraf.Writer.t() | adapter()}
    | {:metrics, [Telemetry.Metrics.t()]}
    | {atom(), any()}
  )

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

handle_event(event_name, measurements, metadata, arg)

View Source

Specs

start_link(args()) :: {:error, any()} | {:ok, pid()}