observability
Unified observability events via Redis pub/sub and sorted sets.
Publishes events for tool calls, response phases, and background tasks. All events are both streamed (pub/sub) and persisted (sorted sets) so dashboards can consume them in real-time or query history.
- observability.set_observability_redis(client)[source]
Set the observability redis.
- Parameters:
client (aioredis.Redis | None) – The client value.
- Return type:
None
- observability.generate_request_id()[source]
Generate request id.
- Returns:
Result string.
- Return type:
- async observability.publish_tool_event(tool_name, arguments=None, result_preview='', duration_ms=0, success=True, user_id='', channel_id='', request_id='')[source]
Publish tool event.
- Parameters:
tool_name (
str) – The tool name value.result_preview (
str) – The result preview value.duration_ms (
float) – The duration ms value.success (
bool) – The success value.user_id (
str) – Unique identifier for the user.channel_id (
str) – Discord/Matrix channel identifier.request_id (
str) – The request id value.
- Return type:
- async observability.publish_response_event(phase, request_id='', channel_id='', user_id='', model='', duration_ms=0, tool_rounds=0, error='', **extra)[source]
Publish response event.
- Parameters:
phase (
str) – The phase value.request_id (
str) – The request id value.channel_id (
str) – Discord/Matrix channel identifier.user_id (
str) – Unique identifier for the user.model (
str) – The model value.duration_ms (
float) – The duration ms value.tool_rounds (
int) – The tool rounds value.error (
str) – The error value.**extra (
Any) – Additional keyword arguments.
- Return type: