Excessibility.TelemetryCapture.Enricher behaviour (Excessibility v0.14.0)

View Source

Behaviour for timeline event enrichers.

Enrichers add computed data to timeline events during timeline building. All enrichers run automatically for every event.

Example

defmodule MyApp.CustomEnricher do
  @behaviour Excessibility.TelemetryCapture.Enricher

  def name, do: :custom
  def cost, do: :cheap

  def enrich(assigns, _opts) do
    %{custom_field: compute_value(assigns)}
  end
end

Callbacks

  • name/0 - Returns atom identifier for this enricher
  • enrich/2 - Takes assigns and options, returns map of fields to add to timeline event
  • cost/0 - (optional) Returns :cheap, :moderate, or :expensive for filtering

Summary

Functions

Returns the cost of an enricher, defaulting to :cheap if not defined.

Callbacks

cost()

(optional)
@callback cost() :: :cheap | :moderate | :expensive

enrich(assigns, opts)

@callback enrich(assigns :: map(), opts :: keyword()) :: map()

name()

@callback name() :: atom()

Functions

get_cost(enricher_module)

Returns the cost of an enricher, defaulting to :cheap if not defined.