End Trace Span
Closes an active distributed tracing span.
Writes a [TRACE-END] <name> line to the orchestrator log and returns { success: true } on success. It does not look up or close a span and computes no duration.
This operator marks the completion of a specific unit of work (Span). It calculates the duration and finalizing the span status (success/error). It is essential for accurate APM (Application Performance Monitoring) and constructing the full trace waterfall.
Use Cases:
- Measuring the latency of an external API call block.
- Grouping a set of complex logic steps into a single readable span.
- Recording the final status of a custom transaction.
How it works
- Merges the input item with the resolved config (config wins).
- Leaves through
errorwithMissing 'name'whennameis empty.span_idis not checked, although the input contract marks it as required. - Logs
[TRACE-END] <name>at info level;trace_id,span_idandattributespassed with it are not written. - Returns
{ port: "success", success: true }; the engine uses that whole object as the output.
In a workflow
The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.
{
"node_id": "node-trace-end-checkout",
"label": "End checkout span",
"operator_slug": "ops.trace.end",
"operator_version": "1.0.0",
"config": {
"name": "checkout",
"trace_id": "{{ $json.trace_id }}",
"span_id": "{{ $json.span_id }}"
}
}{
"ok": true,
"port": "success",
"data": {
"port": "success",
"success": true
}
}Configuration
-
namestring Required -
Name of the span to close (must match Start Span).
Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.
Behaviour in the code
What the implementation does with these keys beyond what the schema says.
-
span_id - Not in the config schema (only in the input contract), but read from the node config or, when unset there, from the input item:
trace_id,span_id,attributes. None of them is written to the log.
Output ports
success default name is set.
{
"port": "success",
"success": true
}error name is empty.
{
"port": "error",
"error": "Missing 'name'"
}In expressions
What a later node can read from this node's output with $("End Trace Span").item.json.<path> (write your node's label instead of End Trace Span). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through success, from the output shown in Ports.
| Expression | Editor | Worker |
|---|---|---|
$("End Trace Span").item.json.success | ||
$("End Trace Span").item.json.duration_ms | — | |
$("End Trace Span").item.json.port | — |
— Editor: The editor suggests it, but the worker does not return it: it reads as undefined.
— Worker: The worker returns it but the editor does not suggest it: write it by hand. Keys inside objects can depend on your data or configuration (for example one key per label).
Errors
| Message | Port | Cause and fix |
|---|---|---|
Missing 'name' | error | name is set neither on the node nor in the input item. |
Input contract
-
trace_idstring Optional -
The active Trace ID.
-
span_idstring Required -
The Span ID to close.
-
attributesobject Optional -
Final tags/attributes (e.g. status code).
Output contract
-
successboolean Optional -
duration_msnumber Optional
Contracts (JSON Schema)
The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.
{
"slug": "ops.trace.end",
"name": "End Trace Span",
"category": "ops",
"version": "1.0.0",
"description": "Closes an active distributed tracing span.\n\n This operator marks the completion of a specific unit of work (Span). It calculates the duration and finalizing the span status (success/error). It is essential for accurate APM (Application Performance Monitoring) and constructing the full trace waterfall.\n\n **Use Cases:**\n - Measuring the latency of an external API call block.\n - Grouping a set of complex logic steps into a single readable span.\n - Recording the final status of a custom transaction.",
"capabilities": [
"observability",
"tracing",
"apm"
],
"config_schema": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"title": "Span Name",
"description": "Name of the span to close (must match Start Span)."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
}
},
"input_contract_schema": {
"type": "object",
"properties": {
"trace_id": {
"type": "string",
"description": "The active Trace ID."
},
"span_id": {
"type": "string",
"description": "The Span ID to close."
},
"attributes": {
"type": "object",
"description": "Final tags/attributes (e.g. status code)."
}
},
"required": [
"span_id"
]
},
"output_contract_schema": {
"type": "object",
"description": "Confirmation.",
"properties": {
"success": {
"type": "boolean"
},
"duration_ms": {
"type": "number"
}
}
},
"ports": [
{
"port_id": "success",
"label": "Ended",
"is_default": true,
"description": "Span closed successfully."
},
{
"port_id": "error",
"label": "Error",
"description": "Failed to find or close span."
}
],
"execution_mode": "sync",
"tags": [
"observability",
"tracing",
"telemetry"
],
"is_stateful": false,
"publisher": {
"identity": "org_vectry",
"profile": {
"name": "Vectry Analytics",
"verified": true,
"url": "https://me.veripass.com/vectry",
"logo_url": null
}
}
}{
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"title": "Span Name",
"description": "Name of the span to close (must match Start Span)."
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
}
}{
"type": "object",
"properties": {
"trace_id": {
"type": "string",
"description": "The active Trace ID."
},
"span_id": {
"type": "string",
"description": "The Span ID to close."
},
"attributes": {
"type": "object",
"description": "Final tags/attributes (e.g. status code)."
}
},
"required": [
"span_id"
]
}{
"type": "object",
"description": "Confirmation.",
"properties": {
"success": {
"type": "boolean"
},
"duration_ms": {
"type": "number"
}
}
}[
{
"port_id": "success",
"label": "Ended",
"is_default": true,
"description": "Span closed successfully."
},
{
"port_id": "error",
"label": "Error",
"description": "Failed to find or close span."
}
]Execution
- Execution
sync- Stateful
- No
- Retries (
retryOnFail) - No
- Capabilities
observabilitytracingapm- Tags
observabilitytracingtelemetry
Notes and limits
duration_msappears in the output contract but is never returned.- The runtime logger prints only the message text: the structured object passed with it is not written to the log.
- The worker returns its fields at the top level instead of under
data, so the engine uses the whole returned object,portincluded, as the node output. - Leaving through
errordoes not fail the run: the engine follows the edges wired toerror, and if there are none the branch simply ends. - The
executionsettings (retryOnFail,maxTries,waitBetweenTries,continueOnFail,timeout_ms) are accepted, but neither this worker nor the engine applies them.
Reviewed against the orchestrator code · 31e874b · 2026-11-26