On this page
Sommatic Docs
Open portal

Start Trace Span

Initiates a new Distributed Tracing Span for deep observability.

View as Markdown
Open in
Operations Available ops.trace.start Version 1.0.0 Execution: sync

Generates a trace id and a span id, writes a [TRACE-START] <name> line to the orchestrator log and returns both ids. No tracing backend is called.

Spans allow you to visualize the duration and details of a specific block of work in a trace waterfall graph. This operator starts a custom span, which must typically be closed by a corresponding 'End Span' (or happens automatically at workflow end).

Use Cases:

  • Explicitly measuring the duration of a specific group of steps.
  • Adding business-specific attributes (tags) to a trace segment.
  • Correlating with external systems via Parent Trace ID.

How it works

  1. Merges the input item with the resolved config (config wins).
  2. Uses parent_trace_id as the trace id when set; otherwise generates a UUID v4.
  3. Leaves through error with Missing 'name' when name is empty.
  4. Generates the span id (UUID v4) and logs [TRACE-START] <name> at info level; the ids and attributes passed with it are not written.
  5. Returns { port: "success", trace_id, span_id }; 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-start-checkout",
  "label": "Start checkout span",
  "operator_slug": "ops.trace.start",
  "operator_version": "1.0.0",
  "config": {
    "name": "checkout"
  }
}

Configuration

name string Required

Human-readable name for the span phase.

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.

parent_trace_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: parent_trace_id, attributes.
attributes
Accepted but not written anywhere: the log line contains only the name.

Output ports

success default

name is set.

Data
{
  "port": "success",
  "trace_id": "94d2f2da-7886-4e23-8bbb-b8c841d99b21",
  "span_id": "50cb8ce0-8949-4f60-a5ff-7795654af4d7"
}
error

name is empty.

Data
{
  "port": "error",
  "error": "Missing 'name'"
}

In expressions

What a later node can read from this node's output with $("Start Trace Span").item.json.<path> (write your node's label instead of Start 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.

ExpressionEditorWorker
$("Start Trace Span").item.json.trace_idstring= "94d2f2da-7886-4e23-8bbb-b8c841d99b21"
$("Start Trace Span").item.json.span_idstring= "50cb8ce0-8949-4f60-a5ff-7795654af4d7"
$("Start Trace Span").item.json.portstringNot suggested by the editor= "success"—

— 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

attributes object Optional

Custom tags/attributes to attach to the span.

parent_trace_id string Optional

Optional: Link to an external trace.

Output contract

trace_id string Optional
span_id string 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.start",
  "name": "Start Trace Span",
  "category": "ops",
  "version": "1.0.0",
  "description": "Initiates a new Distributed Tracing Span for deep observability.\n\n  Spans allow you to visualize the duration and details of a specific block of work in a trace waterfall graph. This operator starts a custom span, which must typically be closed by a corresponding 'End Span' (or happens automatically at workflow end).\n\n  **Use Cases:**\n  - Explicitly measuring the duration of a specific group of steps.\n  - Adding business-specific attributes (tags) to a trace segment.\n  - Correlating with external systems via Parent Trace ID.",
  "capabilities": [
    "observability",
    "tracing",
    "apm"
  ],
  "config_schema": {
    "type": "object",
    "required": [
      "name"
    ],
    "properties": {
      "name": {
        "type": "string",
        "title": "Span Name",
        "description": "Human-readable name for the span phase."
      },
      "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": {
      "attributes": {
        "type": "object",
        "description": "Custom tags/attributes to attach to the span."
      },
      "parent_trace_id": {
        "type": "string",
        "description": "Optional: Link to an external trace."
      }
    }
  },
  "output_contract_schema": {
    "type": "object",
    "description": "The created trace context identifiers.",
    "properties": {
      "trace_id": {
        "type": "string"
      },
      "span_id": {
        "type": "string"
      }
    }
  },
  "ports": [
    {
      "port_id": "success",
      "label": "Started",
      "is_default": true,
      "description": "Span active."
    },
    {
      "port_id": "error",
      "label": "Error",
      "description": "Failed to start tracer."
    }
  ],
  "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
    }
  }
}

Execution

Execution
sync
Stateful
No
Retries (retryOnFail)
No
Capabilities
observabilitytracingapm
Tags
observabilitytracingtelemetry

Notes and limits

  • The ids are not propagated automatically and are not linked to the run ids. Pass them on explicitly, for example {{ $json.trace_id }} and {{ $json.span_id }} in ops.trace.end.
  • 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, port included, as the node output.
  • Leaving through error does not fail the run: the engine follows the edges wired to error, and if there are none the branch simply ends.
  • The execution settings (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

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs