View Source TelemetryMetricsSplunk (TelemetryMetricsSplunk v0.0.5-alpha)
Telemetry.Metrics
reporter for Splunk metrics indexes using the Splunk HTTP Event Collector (HEC).
You can start the reporter with the start_link/1
function:
alias Telemetry.Metrics
TelemetryMetricsSplunk.start_link(
finch: MyFinch,
index: "main",
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 = [
{
Finch,
name: MyFinch,
pools: %{
:default => [size: 10],
"https://example.splunkcloud.com:8088" => [count: 2, size: 4]
}
},
{
TelemetryMetricsSplunk, [
finch: MyFinch,
index: "main",
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 options() :: [ finch: Finch.name() | nil, index: String.t() | nil, metrics: [Telemetry.Metrics.t()], token: String.t() | nil, url: String.t() | nil ]
Functions
@spec child_spec(options :: 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.
Handles a telemetry event by normalizing it and sending it to the Splunk HEC.
@spec start_link(options :: options()) :: GenServer.on_start()
Starts a reporter and links it to the calling process.
alias Telemetry.Metrics
TelemetryMetricsSplunk.start_link(
finch: MyFinch,
index: "main",
metrics: [
Metrics.summary("vm.memory.total")
]
token: "00000000-0000-0000-0000-000000000000",
url: "https://example.splunkcloud.com:8088/services/collector",
)