ExUtcp.Monitoring.Metrics (ex_utcp v0.3.2)

Copy Markdown View Source

Metrics collection and aggregation for ExUtcp operations.

Provides utilities for collecting, storing, and reporting metrics.

Summary

Functions

Returns a specification to start this module under a supervisor.

Gets metrics for a specific metric name.

Gets all collected metrics.

Gets metrics summary for reporting.

Increments a counter metric.

Records a histogram observation.

Resets all metrics.

Starts the metrics collector.

Types

metric_type()

@type metric_type() :: :counter | :gauge | :histogram | :summary

metric_value()

@type metric_value() :: number() | [number()]

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_metric(metric_name)

@spec get_metric(String.t()) :: map() | nil

Gets metrics for a specific metric name.

get_metrics()

@spec get_metrics() :: map()

Gets all collected metrics.

get_metrics_summary()

@spec get_metrics_summary() :: map()

Gets metrics summary for reporting.

increment_counter(metric_name, labels \\ %{})

@spec increment_counter(String.t(), map()) :: :ok

Increments a counter metric.

observe_histogram(metric_name, value, labels \\ %{})

@spec observe_histogram(String.t(), number(), map()) :: :ok

Records a histogram observation.

observe_summary(metric_name, value, labels \\ %{})

@spec observe_summary(String.t(), number(), map()) :: :ok

Records a summary observation.

reset_metrics()

@spec reset_metrics() :: :ok

Resets all metrics.

set_gauge(metric_name, value, labels \\ %{})

@spec set_gauge(String.t(), number(), map()) :: :ok

Sets a gauge metric value.

start_link(opts \\ [])

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

Starts the metrics collector.