View Source OneAndDone.Telemetry (One and Done v0.1.5)

Telemetry integration to track how long it takes to process a request.

OneAndDone emits the following metrics:

MetricDescriptionMeasurementsMetadata
[:one_and_done, :request, :start]When we begin processing a request.conn, opts
[:one_and_done, :request, :stop]When we finish processing a request, including the duration in native units.durationconn, opts
[:one_and_done, :request, :exception]When we finish processing a request, if an exception was raised. Includes the duration in native units.duration, exceptionconn, opts
[:one_and_done, :request, :cache_hit]Given an idempotency key, we found a cached response.idempotency_keyconn, response
[:one_and_done, :request, :cache_miss]Given an idempotency key, we didn't find a cached response.idempotency_keyconn
[:one_and_done, :request, :idempotency_key_not_set]The request doesn't have an idempotency key and will not be processed further by OneAndDone.conn
[:one_and_done, :request, :idempotency_key_too_long]The idempotency key is too long. A 400 error was returned to the client.key_length, key_length_limitconn
[:one_and_done, :request, :cache_get, :start]When we begin checking the cache for a request.conn, idempotency_key
[:one_and_done, :request, :cache_get, :stop]When we finish checking the cache for a request, including the duration in native units.durationconn, idempotency_key
[:one_and_done, :request, :cache_get, :exception]When we finish checking the cache for a request, if an exception was raised. Includes the duration in native units.duration, exceptionconn, idempotency_key
[:one_and_done, :request, :cache_put, :start]When we begin serializing and putting a response into the cache.conn, idempotency_key
[:one_and_done, :request, :cache_put, :stop]When we finish serializing and putting a response into the cache, including the duration in native units.durationconn, idempotency_key
[:one_and_done, :request, :cache_put, :exception]When we finish serializing and putting a response into the cache, if an exception was raised. Includes the duration in native units.duration, exceptionconn, idempotency_key

The duration is emitted in native units. To convert to milliseconds, use System.convert_time_unit(duration, :native, :millisecond).

Link to this section Summary

Functions

Emit a telemetry event.

Return the list of events emitted by this module.

Measure the duration of a function call.

Link to this section Functions

Link to this function

event(base_name, metrics, meta \\ %{})

View Source
@spec event(atom() | [atom()], map(), map()) :: :ok

Emit a telemetry event.

@spec events() :: list()

Return the list of events emitted by this module.

Link to this function

span(base_name, meta \\ %{}, fun)

View Source
@spec span(atom() | [atom()], map(), (... -> any())) :: any()

Measure the duration of a function call.