Metrics¶
Execution metrics for monitoring LangGraph workflows on Temporal.
MetricsReporter¶
MetricsReporter
¶
Collects and reports LangGraph-specific execution metrics.
Metrics are emitted via structured logging by default. When OpenTelemetry is available, metrics are also recorded as OTel measurements.
Attributes:
| Name | Type | Description |
|---|---|---|
node_durations |
dict[str, list[float]]
|
Per-node execution duration history (ms). |
step_count |
int
|
Total steps executed. |
interrupt_count |
int
|
Total interrupts encountered. |
Source code in langgraph/temporal/metrics.py
record_node_execution
¶
Record a node execution duration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_name
|
str
|
Name of the executed node. |
required |
duration_ms
|
float
|
Execution duration in milliseconds. |
required |
success
|
bool
|
Whether the execution succeeded. |
True
|
Source code in langgraph/temporal/metrics.py
record_step_completion
¶
Record a workflow step completion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
step
|
int
|
The step number that completed. |
required |
channel_count
|
int
|
Number of channels with values. |
0
|
Source code in langgraph/temporal/metrics.py
record_interrupt
¶
Record an interrupt event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node_name
|
str
|
Name of the node that triggered the interrupt. |
required |
interrupt_type
|
str
|
Type of interrupt (node, before, after). |
'node'
|
Source code in langgraph/temporal/metrics.py
measure_node
¶
Context manager to measure node execution duration.
Source code in langgraph/temporal/metrics.py
get_summary
¶
Get a summary of collected metrics.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Dictionary with metrics summary. |