View Source TelemetryMetricsSplunk (TelemetryMetricsSplunk v0.0.1-alpha)

Telemetry.Metrics reporter for Splunk metrics indexes using the Splunk HTTP Event Collector (HEC).

NOTE All options are required and the order is enforced: metrics, token, url.

You can start the reporter with the start_link/1 function:

  alias Telemetry.Metrics

  TelemetryMetricsSplunk.start_link(
    metrics: [
      Metrics.summary("vm.memory.total")
    ],
    token: "00000000-0000-0000-0000-000000000000",
    url: "https://example.splunkcloud.com:8088/services/collector"
  )

In production, you should use a Supervisor in your application definition:

  alias Telemetry.Metrics

  children = [
    {
      TelemetryMetricsSplunk, [
        metrics: [
          Metrics.summary("vm.memory.total")
        ],
        token: "00000000-0000-0000-0000-000000000000",
        url: "https://example.splunkcloud.com:8088/services/collector"
      ]
    }
  ]

  Supervisor.start_link(children, strategy: :one_for_one)

Metric names are normalized so that calling :telemetry.execute([:vm, :memory], %{total: 500}) will send a metric named vm.memory.total.summary if you have a metric defined as Metrics.summary("vm.memory.total").

Summary

Functions

Reporter's child spec.

Handles a telemetry event by normalizing it and sending it to the Splunk HEC.

Starts a reporter and links it to the calling process.

Types

@type option() ::
  {:metrics, [Telemetry.Metrics.t()]}
  | {:token, String.t() | {:url, String.t()}}
@type options() :: [option()]

Functions

@spec child_spec(options()) :: Supervisor.child_spec()

Reporter's child spec.

This function allows you to start the reporter under a supervisor like this:

  children = [
    {TelemetryMetricsSplunk, options}
  ]

See start_link/1 for a list of available options.

Link to this function

handle_event(event_name, measurements, metadata, options)

View Source
@spec handle_event(any(), any(), map(), options()) :: :ok

Handles a telemetry event by normalizing it and sending it to the Splunk HEC.

@spec start_link(options()) :: GenServer.on_start()

Starts a reporter and links it to the calling process.

  alias Telemetry.Metrics

  TelemetryMetricsSplunk.start_link(
    metrics: [
      Metrics.summary("vm.memory.total")
    ]
    token: "00000000-0000-0000-0000-000000000000",
    url: "https://example.splunkcloud.com:8088/services/collector",
  )