Foundation.Services.TelemetryService (foundation v0.1.0)

GenServer implementation for telemetry collection and metrics.

Provides structured telemetry with automatic metric collection, event emission, and performance monitoring.

Summary

Functions

Returns a specification to start this module under a supervisor.

Reset all metrics (for testing purposes).

Reset all internal state for testing purposes.

Types

server_state()

@type server_state() :: %{
  metrics: %{required(atom()) => map()},
  handlers: %{required([atom()]) => function()},
  config: map(),
  namespace: atom()
}

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

emit_counter(event_name, value, metadata)

@spec emit_counter([atom()], number(), map()) :: :ok

initialize(opts)

@spec initialize(keyword()) :: :ok | {:error, Foundation.Types.Error.t()}

reset_metrics()

@spec reset_metrics() :: :ok | {:error, Foundation.Types.Error.t()}

Reset all metrics (for testing purposes).

reset_state()

@spec reset_state() :: :ok | {:error, Foundation.Types.Error.t()}

Reset all internal state for testing purposes.

Clears all metrics, handlers, and resets configuration to defaults. This function should only be used in test environments.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()

stop()

@spec stop() :: :ok