Traces guide
Group model calls with session_id, run_id, user_id, and user_name in X-Shieldon-Metadata, and inspect execution trees, timelines, and on-demand payloads.
What is Traces?
Workspace → Traces groups multiple model calls that belong to the same Agent or workflow execution (run_id) and multi-turn conversation (session_id), so you can inspect latency, retries/fallbacks, token usage, Credits, and captured input/output in one view.
Data hierarchy:
session_id (multi-turn conversation or session)
└── run_id (single Agent or workflow execution)
└── Model request (Chat Completions / Responses / Embeddings, etc.)
└── _shieldon.lifecycle spans (routing, guardrails, attempts, retry/fallback)Traces is an aggregate query view built on recorded model calls and system
Metadata. It does not infer unrecorded business steps, external tool calls, or
business completion state. Calls without a run_id remain in Request logs.
Get started in 3 steps
- Publish a Release with system Metadata fields: Every Gateway API key includes built-in
session_id,run_id,user_id, anduser_namefields once published. No manual variable creation is needed; optionally mark fields as required under API Keys → Manage Metadata. - Send
X-Shieldon-Metadataon Gateway requests: Reuse the samerun_idacross model calls within one execution, and the samesession_idacross executions in one conversation. - Inspect in the console: Open Workspace → Traces. Rows are grouped by
session_idby default—click a session row to expand itsrun_idrows in place, then click anyrun_idto open the split-pane inspector.
Request examples
Set SHIELDON_GATEWAY_BASE_URL (including /v1) and SHIELDON_GATEWAY_API_KEY, and replace the model with an ID returned by GET /v1/models. Other protocols (such as Anthropic Messages and OpenAI Responses) also accept X-Shieldon-Metadata.
curl "$SHIELDON_GATEWAY_BASE_URL/chat/completions" \
-H "Authorization: Bearer $SHIELDON_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-H 'X-Shieldon-Metadata: {"session_id":"sess_checkout_01","run_id":"run_step_01","user_id":"cust_1042","user_name":"Alice"}' \
-d '{
"model": "@your-integration/your-model",
"messages": [
{ "role": "user", "content": "Summarize today'\''s order anomalies." }
]
}'System Metadata fields
| Field | Purpose | Grouping & filtering | Rules & boundaries |
|---|---|---|---|
run_id | Identifies one Agent or workflow execution | Required for Traces; exact filter and run_id view | Non-empty string, max 128 chars; internal retries/fallbacks do not create new Runs |
session_id | Identifies a multi-run conversation | Default view groups by session_id; exact filter | Optional; never send auth tokens or secrets |
user_id | Stable business end-user identifier | Exact filter | Attribution only; distinct from Shieldon login identity |
user_name | Display name at request time | Display only in table and details; not filterable | Never used for identity merging or guessed on conflicts |
- Strict isolation: Organization, Workspace, and Gateway API key define the isolation boundary. Identical
session_idorrun_idvalues under different Workspaces or API keys are never merged. - Validation: Values must be non-blank strings without control characters and cannot have static defaults configured on a key.
Inspecting Traces in the console
Traces list
- View switcher: Grouped by
session_idby default; click a row to expand itsrun_iditems in place, or switch torun_idview to list Runs directly. - Filters: Filter by
session_id,run_id,user_id, API key, and date range (24h,7d,30d, or custom range). Clicking auser_idorsession_idcell applies that filter immediately. - Aggregation semantics: Request counts, failures/cancellations, known tokens, and Credits are aggregated across all matching requests in the selected time range—independent of pagination. The observed time range reflects the earliest start to latest completion, not business task completion.
Split-pane detail inspector
- Left tree & timeline: Select the top Run root for a Run summary and loaded request table, or expand any request to inspect
_shieldon.lifecyclespans. Supports Tree / Timeline toggle, search filtering, expand/collapse all, resizable split, and↑ / ↓keyboard navigation. - Right inspector: Shows observation overview, routing/guardrail diagnostics, Metadata (
Table / JSON), and on-demand Input / Output (Formatted / JSON). - Content permissions & audit: Input and output payloads follow Workspace capture settings and encrypted storage rules. Content is fetched only when an authorized administrator clicks Load content, generating an immutable audit event.
Troubleshooting
- Sent requests do not appear in Traces:
- Ensure
X-Shieldon-Metadataincludes a non-emptyrun_id(requests with onlysession_idremain in Request logs). - Verify the selected date range (defaults to
7d) andAPI Keyfilter match the request. - Confirm the Workspace has an active Release published with system Metadata support.
- Ensure
- Conflicting attribution: Multiple distinct
session_idoruser_idvalues appeared inside the samerun_id, or multipleuser_idvalues appeared within onesession_id. Runs with conflictingsession_idattribution stay separate to avoid double counting. - Incomplete usage / Unpriced requests: Missing upstream token counts are never treated as zero; calls without effective published Credit rates are marked unpriced rather than free.