ExUtcp.Monitoring.Performance (ex_utcp v0.3.2)

Copy Markdown View Source

Performance monitoring for ExUtcp operations.

Tracks performance metrics, identifies bottlenecks, and provides alerts.

Summary

Functions

Returns a specification to start this module under a supervisor.

Gets performance statistics for a specific operation.

Checks for performance alerts based on thresholds.

Gets performance summary for all operations.

Measures the execution time of a function and emits telemetry.

Measures search performance.

Records a custom performance metric.

Starts the performance monitor.

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_operation_stats(operation_name)

@spec get_operation_stats(String.t()) :: map()

Gets performance statistics for a specific operation.

get_performance_alerts(metrics \\ nil)

@spec get_performance_alerts(map() | nil) :: [map()]

Checks for performance alerts based on thresholds.

get_performance_summary()

@spec get_performance_summary() :: %{
  operations: map(),
  system: map(),
  alerts: [map()],
  timestamp: integer(),
  status: atom()
}

Gets performance summary for all operations.

measure(operation_name, metadata \\ %{}, fun)

@spec measure(String.t(), map(), (-> any())) :: any()

Measures the execution time of a function and emits telemetry.

measure_connection(provider_name, transport_type, fun)

@spec measure_connection(String.t(), atom(), (-> any())) :: any()

Measures connection performance.

measure_search(query, algorithm, filters, fun)

@spec measure_search(String.t(), atom(), map(), (-> any())) :: any()

Measures search performance.

measure_tool_call(tool_name, provider_name, args, fun)

@spec measure_tool_call(String.t(), String.t(), map(), (-> any())) :: any()

Measures tool call performance.

record_custom_metric(name, type, value, labels \\ %{})

@spec record_custom_metric(String.t(), metric_type(), metric_value(), map()) :: :ok

Records a custom performance metric.

start_link(opts \\ [])

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

Starts the performance monitor.