For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
DiscordPlatform
DocumentationIntegrationsAPI referenceSDKsChangelog
DocumentationIntegrationsAPI referenceSDKsChangelog
  • Get started
    • Overview
    • Trace your first call
    • Run your first eval
    • Gateway & prompting
    • Live demo
  • Observability
      • Core concepts
      • Set up the SDK
      • Decorators (@workflow, @task)
      • Override span fields
      • Metadata & tags
      • Span types & multimodal
      • Manually log spans
      • OpenTelemetry (OTLP)
      • Retention & export
    • Users
  • Gateway
    • Limits
  • Admin
    • API keys
    • Provider keys
    • Workspaces & projects
    • Collaborate
  • Resources
  • Security & Support
    • Support
    • Status
LogoLogo
DiscordPlatform
On this page
  • Override input & output
ObservabilityTracing

Override span fields

Force the input, output, name, or other fields on the current span when the auto-captured values aren’t what you want.

Was this page helpful?
Previous

Metadata & tags

Attach metadata, customer identifiers, and other parameters to your spans.
Next
Built with

By default, Respan captures span input and output from the function arguments and return value. When that isn’t what you want displayed in the trace UI — for example, you want to redact sensitive args, condense a large payload, or surface a different field — override the span at runtime via update_current_span().

Override input & output

Python
1import json
2from opentelemetry.semconv_ai import SpanAttributes
3from respan import Respan
4from respan.decorators import workflow
5
6respan = Respan()
7client = respan.getClient()
8
9@workflow(name="update_attributes_test")
10def update_attributes_test(input: str):
11 force_set_attributes = {
12 SpanAttributes.TRACELOOP_ENTITY_INPUT: json.dumps({
13 "args": [],
14 "kwargs": {"text": "custom input"}
15 }),
16 }
17
18 client.update_current_span(
19 attributes=force_set_attributes,
20 name="update_attributes_test",
21 respan_params={"metadata": {"test": "test"}},
22 )
23
24 return "Some desired output"
25
26if __name__ == "__main__":
27 update_attributes_test("Some input")

Use update_current_span(attributes=...) for overriding displayed input/output. Values must be JSON-serializable strings via json.dumps(...).

You can also update spans after they’ve been logged via the Update Span API.