Skip to content

Partial Update Span

client.spans.update(stringspanID, SpanUpdateParams { data, end_time, input, 6 more } body, RequestOptionsoptions?): Span { id, name, start_time, 7 more }
PATCH/spans/{span_id}

Update a span with the provided output data and mark it as complete

ParametersExpand Collapse
spanID: string
body: SpanUpdateParams { data, end_time, input, 6 more }
data?: Record<string, unknown> | Array<Record<string, unknown>> | null

Any additional metadata or context for the span

One of the following:
Record<string, unknown>
Array<Record<string, unknown>>
end_time?: string | null

The time the span ended

formatdate-time
input?: Record<string, unknown> | Array<Record<string, unknown>> | null

Input parameters or data for the operation

One of the following:
Record<string, unknown>
Array<Record<string, unknown>>
name?: string | null

Name that describes what operation this span represents

output?: Record<string, unknown> | Array<Record<string, unknown>> | null

Output data resulting from the operation

One of the following:
Record<string, unknown>
Array<Record<string, unknown>>
parent_id?: string | null

ID of the parent span if this is a child span in a trace

start_time?: string | null

The time the span started

formatdate-time
task_id?: string | null

ID of the task this span belongs to

trace_id?: string | null

Unique identifier for the trace this span belongs to

ReturnsExpand Collapse
Span { id, name, start_time, 7 more }
id: string
name: string

Name that describes what operation this span represents

start_time: string

The time the span started

formatdate-time
trace_id: string

Unique identifier for the trace this span belongs to

data?: Record<string, unknown> | Array<Record<string, unknown>> | null

Any additional metadata or context for the span

One of the following:
Record<string, unknown>
Array<Record<string, unknown>>
end_time?: string | null

The time the span ended

formatdate-time
input?: Record<string, unknown> | Array<Record<string, unknown>> | null

Input parameters or data for the operation

One of the following:
Record<string, unknown>
Array<Record<string, unknown>>
output?: Record<string, unknown> | Array<Record<string, unknown>> | null

Output data resulting from the operation

One of the following:
Record<string, unknown>
Array<Record<string, unknown>>
parent_id?: string | null

ID of the parent span if this is a child span in a trace

task_id?: string | null

ID of the task this span belongs to

Partial Update Span

import Agentex from 'agentex';

const client = new Agentex({
  apiKey: process.env['AGENTEX_SDK_API_KEY'], // This is the default and can be omitted
});

const span = await client.spans.update('span_id');

console.log(span.id);
{
  "id": "id",
  "name": "name",
  "start_time": "2019-12-27T18:11:19.117Z",
  "trace_id": "trace_id",
  "data": {
    "foo": "bar"
  },
  "end_time": "2019-12-27T18:11:19.117Z",
  "input": {
    "foo": "bar"
  },
  "output": {
    "foo": "bar"
  },
  "parent_id": "parent_id",
  "task_id": "task_id"
}
Returns Examples
{
  "id": "id",
  "name": "name",
  "start_time": "2019-12-27T18:11:19.117Z",
  "trace_id": "trace_id",
  "data": {
    "foo": "bar"
  },
  "end_time": "2019-12-27T18:11:19.117Z",
  "input": {
    "foo": "bar"
  },
  "output": {
    "foo": "bar"
  },
  "parent_id": "parent_id",
  "task_id": "task_id"
}