AuroraMeter. Telemetry. Metrics
(Aurora Meter v1.0.0)
View Source
Telemetry.Metrics definitions for every core event worth a series.
This module exists only when the optional telemetry_metrics dependency is
installed. Without it AuroraMeter.Telemetry and every event still work;
this module is simply not defined, and nothing in the library references it.
Use it instead of writing the list yourself
defmodule MyApp.Telemetry do
def metrics do
AuroraMeter.Telemetry.Metrics.metrics() ++ my_own_metrics()
end
endEvery tag here is on AuroraMeter.Telemetry.tag_allow_list/0 and every
value set behind one is bounded. Where an event's natural metadata name is
not an allow-listed name, or where its value is not bounded, the preset maps
it with :tag_values rather than tagging on it raw. The clearest case is
[:aurora_meter, :credits, :hold_reconciliation], whose decision is
{:settle, amount} for a settlement: tagging on that metadata key directly
gives one time series per distinct amount of money, which is unbounded. The
preset maps it to kind: :settle.
Cost
metrics/1 is pure: it builds structs and reads configuration. Attaching
them is the host's reporter's job, and the reporter's handlers run in the
process that emitted the event. The gauges are emitted by
AuroraMeter.Store and AuroraMeter.Cluster, so a slow handler on one of
them delays flush batch snapshots.
Options
:feature_label- tag metering metrics on:feature. Defaults toAuroraMeter.Config.metrics_feature_label?/0(false). One series per feature per metric: cheap for ten features, not for ten thousand.:include- which groups to return, any of[:metering, :quotas, :flush, :cluster, :events, :credits, :workers]. Defaults to all of them.
The metric name prefix is fixed at aurora_meter. A host that needs another
maps the list itself; making it an option would let two hosts disagree about
what a documented metric is called.
Summary
Functions
@spec groups() :: [atom()]
The groups :include accepts.
Examples
iex> AuroraMeter.Telemetry.Metrics.groups()
[:metering, :quotas, :flush, :cluster, :events, :credits, :workers]
@spec metrics(keyword()) :: [Telemetry.Metrics.t()]
The preset metric definitions.
Examples
iex> AuroraMeter.Telemetry.Metrics.metrics(include: [:cluster]) |> Enum.map(& &1.name) |> Enum.uniq()
[[:aurora_meter, :cluster, :apply, :count], [:aurora_meter, :cluster, :lag, :peers],
[:aurora_meter, :cluster, :lag, :since_last_message_ms],
[:aurora_meter, :cluster, :lag, :unreconciled_keys]]