Partially update a span’s mutable fields and return the updated span.
Only the provided fields among name, end timestamp, output, metadata, and status are changed. This endpoint is available only for accounts still served solely by the legacy trace store: once an account begins dual-writing to the tracing service — which is upsert-only and has no partial-update operation — PATCH returns 501 and PUT /v5/spans/batch must be used instead. Updates are authorized against the span’s parent trace, and an unknown id returns 404.
Credential redaction: values in the free-form input, output, metadata,
and expected objects, and in name, that are credential-shaped (bearer/JWT,
API keys, connection-string passwords) or under a credential-named key are replaced
with [REDACTED:credential] before the span is persisted, so the stored and
returned span reflects the redacted value (EY 12.3).
Update a span
import os
from scale_gp_beta import SGPClient
client = SGPClient(
api_key=os.environ.get("SGP_API_KEY"), # This is the default and can be omitted
)
span = client.spans.update(
span_id="span_id",
)
print(span.id){
"id": "id",
"account_id": "account_id",
"name": "name",
"start_timestamp": "2019-12-27T18:11:19.117Z",
"trace_id": "trace_id",
"application_interaction_id": "application_interaction_id",
"application_variant_id": "application_variant_id",
"created_by": {
"id": "id",
"type": "user",
"object": "identity"
},
"end_timestamp": "2019-12-27T18:11:19.117Z",
"expected": {
"foo": "bar"
},
"group_id": "group_id",
"input": {
"foo": "bar"
},
"input_tokens": 0,
"metadata": {
"foo": "bar"
},
"object": "span",
"obs_span_id": "obs_span_id",
"obs_trace_id": "obs_trace_id",
"output": {
"foo": "bar"
},
"output_tokens": 0,
"parent_id": "parent_id",
"status": "SUCCESS",
"type": "TEXT_INPUT"
}Returns Examples
{
"id": "id",
"account_id": "account_id",
"name": "name",
"start_timestamp": "2019-12-27T18:11:19.117Z",
"trace_id": "trace_id",
"application_interaction_id": "application_interaction_id",
"application_variant_id": "application_variant_id",
"created_by": {
"id": "id",
"type": "user",
"object": "identity"
},
"end_timestamp": "2019-12-27T18:11:19.117Z",
"expected": {
"foo": "bar"
},
"group_id": "group_id",
"input": {
"foo": "bar"
},
"input_tokens": 0,
"metadata": {
"foo": "bar"
},
"object": "span",
"obs_span_id": "obs_span_id",
"obs_trace_id": "obs_trace_id",
"output": {
"foo": "bar"
},
"output_tokens": 0,
"parent_id": "parent_id",
"status": "SUCCESS",
"type": "TEXT_INPUT"
}