AIO.SetTrace

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > AIO. - OpenRouter AI >

AIO.SetTrace

AIO.SetTrace

Previous Top Next


MiniRobotLanguage (MRL)

 

AIO.SetTrace|`JSON
Set Trace Metadata for Observability

 

Purpose

 

Sets trace metadata for observability and debugging purposes. This allows you to attach trace IDs, span IDs, and other distributed tracing information to API requests for monitoring and troubleshooting in distributed systems.

 

Syntax

 

AIO.SetTrace|`JSON

 

Parameters

 

`JSON - A JSON object containing trace metadata such as trace_id, span_id, and custom tags for observability systems.

 

Common Trace Fields

 

trace_id - Unique identifier for the entire trace

span_id - Identifier for the current operation span

parent_span_id - Parent span identifier for hierarchy

tags - Additional key-value pairs for categorization

 

JSON Format Example

 

{"trace_id":"abc123","span_id":"span456","service":"myapp"}

 

Notes

 

- Used for distributed tracing and observability platforms

- Compatible with OpenTelemetry and similar standards

- Helps correlate requests across multiple services

- Cleared when AIO.Init is called

 

Example

 

' Set trace information for request tracking

AIO.SetTrace|{"trace_id":"trace-789","span_id":"span-001"}

 

' Request will include trace headers

AIO.Chat|Process this|`Result

 

Related Commands

 

AIO.SetMetadata - Set general metadata

AIO.Init - Initialize AIO system