Langfuse icon

Langfuse

Log LLM traces, spans, generations, and scores to Langfuse, or query traces, prompts, datasets, sessions, and more via the Public API.

Ingestion → Span Update

AI-generated

Summary

Update an existing span observation within a trace by modifying fields such as its name, timing (including optional end time), input and output JSON payloads, metadata, version, level, and status message.

Inputs

  • observationId (required) — The ID of the existing span observation to update; this field is required.
  • name — Human-readable name for the span.
  • endTime — Optional ISO 8601 timestamp marking the end time of the span.
  • inputJson — JSON string representing the input payload associated with the span.
  • outputJson — JSON string representing the output payload associated with the span.
  • metadataJson — Additional JSON metadata to associate with the span update.
  • version — Optional version string for the span.
  • level — Optional observation/log level for the span.
  • statusMessage — Optional status message attached to the span.
  • traceId — Trace ID that this span update attaches to; if left blank, auto-filled from previous step output.
  • eventId — Optional event ID for idempotency and deduplication.
  • parentObservationId — Optional parent observation ID for nested spans or events.
  • timestamp — Optional ISO 8601 timestamp for the event; defaults to current time if blank.
  • failOnBatchErrors — Whether to fail the item when Langfuse returns partial ingestion errors.

Output shape

a single record containing the updated span observation's details including any auto-generated or linked IDs such as traceId and observationId

The output reflects the final state of the updated span event sent to Langfuse ingestion API. If partial batch errors occur and 'failOnBatchErrors' is false, the operation may still succeed with partial acceptance indicated in the output. Advanced fields are visible only if toggled and they enhance control over the span update.

Examples

Example 1: Update the end time, status message, and add metadata to an existing span in a trace to mark its completion and provide additional context.

Provide the 'observationId' of the span to update, set the 'endTime' with an ISO 8601 string, optionally include 'statusMessage' and 'metadataJson' in JSON string format, and optionally provide or rely on auto-filled 'traceId'.

Links

Discussion