Pristine.Profiles.Foundation (Pristine v0.4.0)

Copy Markdown View Source

Internal Foundation-backed production profile wiring.

Pristine.Client.foundation/1 is the public entrypoint for this profile.

Summary

Functions

Attach a TelemetryReporter handler with an explicit event list.

Attach a TelemetryReporter handler.

Build a Foundation-backed Pristine.Core.Context.

Build the default structured telemetry event map for a namespace.

Detach a previously attached TelemetryReporter handler.

Convenience child spec for running a TelemetryReporter instance under supervision.

Return the telemetry events that should be attached to a reporter for a context.

Start a TelemetryReporter instance directly.

Types

feature_option()

@type feature_option() :: false | true | module() | [option()]

option()

@type option() :: {atom(), term()}

Functions

attach_reporter(opts)

@spec attach_reporter([option()]) :: {:ok, term()} | {:error, :missing_dependency}

Attach a TelemetryReporter handler with an explicit event list.

attach_reporter(context, opts)

@spec attach_reporter(Pristine.Core.Context.t(), [option()]) ::
  {:ok, term()} | {:error, :missing_dependency}

Attach a TelemetryReporter handler.

When given a Context, this derives the event list from context.telemetry_events unless :events is supplied explicitly.

context(opts \\ [])

@spec context([option()]) :: Pristine.Core.Context.t()

Build a Foundation-backed Pristine.Core.Context.

Feature options are supplied at the top level:

  • retry
  • rate_limit
  • circuit_breaker
  • telemetry
  • admission_control

All other options are forwarded to Pristine.Core.Context.new/1.

default_telemetry_events(namespace \\ [:pristine])

@spec default_telemetry_events([atom()]) :: map()

Build the default structured telemetry event map for a namespace.

detach_reporter(handler_id)

@spec detach_reporter(term()) ::
  :ok | {:error, :not_found} | {:error, :missing_dependency}

Detach a previously attached TelemetryReporter handler.

reporter_child_spec(opts)

@spec reporter_child_spec([option()]) :: Supervisor.child_spec()

Convenience child spec for running a TelemetryReporter instance under supervision.

reporter_events(context)

@spec reporter_events(Pristine.Core.Context.t()) :: [[atom()]]

Return the telemetry events that should be attached to a reporter for a context.

start_reporter(opts)

@spec start_reporter([option()]) ::
  GenServer.on_start() | {:error, :missing_dependency}

Start a TelemetryReporter instance directly.