AbsintheFieldTelemetry.Backend.Batch (absinthe_field_telemetry v0.3.1)

View Source

This implementation of the backend is provided to be a wrapper around another backend.

The idea related to this backend is that it will cache field hits in memory and then report them in batches of size threshold the other backend.

This is designed to improve performance and throughput when a backend requires a network call.

The backend process is started by calling start_link:

  AbsintheFieldTelemetry.Backend.Batch.start_link(
    threshold: 10_000,
    interval_ms: 60_000 * 10,
    backend: {AbsintheFieldTelemetry.Backend.Ets, []}
  )

Options are:

  • interval_ms: If set, this backend will report all unreported cached hits every interval_ms.
  • threshold: The number of hits to cash before reporting the backend (required)
  • backend: The persistence backend (required)

Summary

Functions

Returns a specification to start this module under a supervisor.

Types

t()

@type t() :: %AbsintheFieldTelemetry.Backend.Batch{
  backend: AbsintheFieldTelemetry.Backend.t(),
  field_cache: %{required(atom()) => list()},
  threshold: integer()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_config!(args, key)

start(args \\ [])

@spec start(keyword()) :: :ignore | {:error, any()} | {:ok, pid()}

start_link(args \\ [])

@spec start_link(keyword()) :: :ignore | {:error, any()} | {:ok, pid()}

stop()

@spec stop() :: any()