Packages
nous
0.17.0
0.17.0
0.16.6
0.16.5
0.16.4
0.16.3
0.16.2
0.16.1
0.16.0
0.15.8
0.15.7
0.15.6
0.15.5
0.15.4
0.15.3
0.15.2
0.15.1
0.15.0
0.14.3
0.14.2
0.14.1
0.14.0
0.13.3
0.13.2
0.13.1
0.13.0
0.12.17
0.12.16
0.12.15
0.12.14
0.12.13
0.12.12
0.12.11
0.12.9
0.12.7
0.12.6
0.12.5
0.12.3
0.12.2
0.12.0
0.11.3
0.11.0
0.10.1
0.10.0
0.9.0
0.8.1
0.8.0
0.7.2
0.7.1
0.7.0
0.5.0
AI agent framework for Elixir with multi-provider LLM support
Current section
Files
Jump to
Current section
Files
lib/nous/workflow/telemetry.ex
defmodule Nous.Workflow.Telemetry do
@moduledoc """
Telemetry events for workflow execution.
## Workflow Events
* `[:nous, :workflow, :run, :start]` — workflow begins
* Measurement: `%{system_time: integer}`
* Metadata: `%{workflow_id: string, workflow_name: string, node_count: integer}`
* `[:nous, :workflow, :run, :stop]` — workflow completes
* Measurement: `%{duration: integer}`
* Metadata: `%{workflow_id: string, status: atom, nodes_executed: integer}`
* `[:nous, :workflow, :run, :exception]` — workflow fails
* Measurement: `%{duration: integer}`
* Metadata: `%{workflow_id: string, reason: term}`
## Node Events
* `[:nous, :workflow, :node, :start]` — node begins
* Measurement: `%{system_time: integer}`
* Metadata: `%{workflow_id: string, node_id: string, node_type: atom}`
* `[:nous, :workflow, :node, :stop]` — node completes
* Measurement: `%{duration: integer}`
* Metadata: `%{workflow_id: string, node_id: string, node_type: atom, success: boolean}`
* `[:nous, :workflow, :node, :exception]` — node fails
* Measurement: `%{duration: integer}`
* Metadata: `%{workflow_id: string, node_id: string, node_type: atom, reason: term}`
"""
@doc false
def workflow_start(workflow_id, workflow_name, node_count) do
:telemetry.execute(
[:nous, :workflow, :run, :start],
%{system_time: System.system_time(), monotonic_time: System.monotonic_time()},
%{workflow_id: workflow_id, workflow_name: workflow_name, node_count: node_count}
)
end
@doc false
def workflow_stop(workflow_id, start_time, status, nodes_executed) do
:telemetry.execute(
[:nous, :workflow, :run, :stop],
%{duration: System.monotonic_time() - start_time},
%{workflow_id: workflow_id, status: status, nodes_executed: nodes_executed}
)
end
@doc false
def workflow_exception(workflow_id, start_time, reason) do
:telemetry.execute(
[:nous, :workflow, :run, :exception],
%{duration: System.monotonic_time() - start_time},
%{workflow_id: workflow_id, reason: reason}
)
end
@doc false
def node_start(workflow_id, node_id, node_type) do
:telemetry.execute(
[:nous, :workflow, :node, :start],
%{system_time: System.system_time(), monotonic_time: System.monotonic_time()},
%{workflow_id: workflow_id, node_id: node_id, node_type: node_type}
)
end
@doc false
def node_stop(workflow_id, node_id, node_type, start_time, success) do
:telemetry.execute(
[:nous, :workflow, :node, :stop],
%{duration: System.monotonic_time() - start_time},
%{workflow_id: workflow_id, node_id: node_id, node_type: node_type, success: success}
)
end
@doc false
def node_exception(workflow_id, node_id, node_type, start_time, reason) do
:telemetry.execute(
[:nous, :workflow, :node, :exception],
%{duration: System.monotonic_time() - start_time},
%{workflow_id: workflow_id, node_id: node_id, node_type: node_type, reason: reason}
)
end
end