EcsElixirCore.Application.Features.Sampling.SamplingConfig (ecs_elixir_core v1.0.0)

Copy Markdown

Manages sampling feature configuration.

Reads sampling rules from application config, parses them into a SamplingRuleSet and caches the result in :persistent_term to avoid re-parsing on every request.

This module belongs to the application layer because the application layer is responsible for managing configuration for both the middleware and its features.

Summary

Functions

Clears the cached ruleset, forcing a reload on the next call.

Returns the current sampling ruleset, loading and caching it on first access.

Functions

clear_cache()

@spec clear_cache() :: :ok

Clears the cached ruleset, forcing a reload on the next call.

fetch_ruleset()

@spec fetch_ruleset() ::
  {:ok, EcsElixirCore.Domain.Model.Features.Sampling.Model.SamplingRuleSet.t()}
  | {:error, term()}

Returns the current sampling ruleset, loading and caching it on first access.