telemetry_influxdb

InfluxDB reporter for Telemetry

Telemetry reporter for InfluxDB compatible events.

To use it, start the reporter with the start_link/1 function, providing it a list of Telemetry event names:

      TelemetryInfluxDB.start_link(
        events: [
          %{name: [:memory, :usage], metadata_tag_keys: [:host, :ip_address]},
          %{name: [:http, :request]},
        ]
      )

or put it under a supervisor:

  children = [
    {TelemetryInfluxDB, [
      events: [
        %{name: [:memory, :usage], metadata_tag_keys: [:host, :ip_address]},
        %{name: [:http, :request]}
    ]}
  ]

  Supervisor.start_link(children, ...)

By default the reporter sends events through UDP to localhost:8089.

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

Run test

Running the tests currently requires jq. Please make sure you have it installed before running the tests.

$ make test

It should setup the latest InfluxDB in docker for both v1 and v2 and runs all the tests against them.

Configuration

Possible options for the reporter:

Options for Any InfluxDB Version

V1 Only Options

V2 Only Options

Notes

For the HTTP protocol, worker_pool is used for sending requests asynchronously. Therefore the HTTP requests are sent in the context of the separate workers' pool, which does not block the client's application (it is not sent in the critical path of the client's process). The events are sent straightaway without any batching techniques. On the other hand, UDP packets are sent in the context of the processes that execute the events. However, the lightweight nature of UDP should not cause any bottlenecks in such a solution.

Once the reporter is started, it is attached to specified Telemetry events. The events are detached when the reporter is shutdown.

Copyright and License

TelemetryInfluxDB is copyright (c) 2019 Ludwik Bukowski.

TelemetryInfluxDB source code is released under MIT license.

See LICENSE for more information.