View Source TelemetryMetricsAppsignal (telemetry_metrics_appsignal v1.5.0)
AppSignal Reporter for Telemetry.Metrics
definitions.
This reporter is useful for getting custom metrics into AppSignal from your application. These custom metrics are especially useful for building custom dashboards.
To use the reporter, first define a list of metrics as shown here:
def metrics, do:
[
summary("phoenix.endpoint.stop.duration"),
last_value("vm.memory.total"),
counter("my_app.my_server.call.exception")
]
It's recommended to start TelemetryMetricsAppsignal under a supervision tree, either in your main application or as recommended here if using Phoenix:
{TelemetryMetricsAppsignal, [metrics: metrics()]}
Putting that altogether, your configuration could look something like this:
def start_link(_arg) do
children = [
{TelemetryMetricsAppsignal, [metrics: metrics()]},
...
]
Supervisor.init(children, strategy: :one_for_one)
end
defp metrics, do:
[
summary("phoenix.endpoint.stop.duration"),
last_value("vm.memory.total"),
counter("my_app.my_server.call.exception")
]
Optionally you can register a name:
{TelemetryMetricsAppsignal,
[metrics: metrics(), name: MyTelemetryMetricsAppsignal]}
The following table shows how Telemetry.Metrics
metrics map to AppSignal
metrics:
Telemetry.Metrics | AppSignal |
---|---|
last_value | gauge |
counter | counter |
sum | counter , increased by the provided value |
summary | measurement |
distribution | Not supported |
Summary
Functions
Returns a specification to start this module under a supervisor.
Types
@type metric() :: Telemetry.Metrics.Counter.t() | Telemetry.Metrics.Distribution.t() | Telemetry.Metrics.LastValue.t() | Telemetry.Metrics.Sum.t() | Telemetry.Metrics.Summary.t()
@type option() :: {:metrics, [metric()]} | {:name, GenServer.name()}
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
@spec start_link([option()]) :: GenServer.on_start()