​
chalk.telemetry schema

The chalk.telemetry schema provides three environment-scoped tables:

  • spans has one row per OpenTelemetry span. It includes query and resolver spans as well as OpenInference AI spans such as AGENT, LLM, and TOOL spans.
  • traces has one summary row per trace.
  • sessions has one summary row per agent session — the multi-turn conversation a set of traces belongs to.

chalk.telemetry.spans includes these columns:

  • Timing and identity: start_time, end_time, duration_ns, duration_ms, trace_id, span_id, parent_span_id, is_root_span, and trace_state.
  • OpenTelemetry metadata: span_name, span_kind, service_name, environment_id, scope_name, scope_version, status_code, and status_message.
  • Complete JSON payloads: resource_attributes_json, span_attributes_json, events_json, and links_json.
  • AI input and output: openinference_span_kind, input_value, input_mime_type, output_value, and output_mime_type.
  • Agent and tool metadata: turn_iterations, tool_call_count, tool_name, tool_call_id, and session_id.
  • LLM metadata: llm_provider, llm_model_name, llm_system, llm_finish_reason, and llm_cost.
  • LLM tokens: llm_token_count_prompt, llm_token_count_cache_read, llm_token_count_cache_write, llm_token_count_completion, llm_token_count_reasoning, and llm_token_count_total.

chalk.telemetry.traces includes start_time, end_time, duration_ns, duration_ms, trace_id, span_count, root_span_id, root_parent_span_id, root_span_name, root_span_attributes_json, root_resource_attributes_json, and environment_id.

chalk.telemetry.sessions includes session_id, start_time, end_time, duration_ns, duration_ms, trace_count, span_count, first_trace_id, first_root_span_name, and environment_id. A session is idle between turns, so its duration is the wall-clock span it covers rather than the sum of its traces’ durations. Traces with no session ID — anything that is not an agent conversation — are not counted as sessions. Join sessions to spans on session_id to reach the individual spans of a conversation.

For example, this query returns recent LLM and tool-call spans:

SELECT
  start_time,
  trace_id,
  span_name,
  openinference_span_kind,
  llm_model_name,
  llm_token_count_total,
  tool_name
FROM "chalk.telemetry.spans"
WHERE start_time >= now()::timestamp - INTERVAL 1 DAY
  AND openinference_span_kind IN ('LLM', 'TOOL')
ORDER BY start_time DESC
LIMIT 100

To find the largest recent traces:

SELECT
  start_time,
  trace_id,
  root_span_name,
  span_count,
  duration_ms
FROM "chalk.telemetry.traces"
WHERE start_time >= now()::timestamp - INTERVAL 1 DAY
ORDER BY span_count DESC
LIMIT 100

To find the longest-running agent conversations:

SELECT
  session_id,
  start_time,
  first_root_span_name,
  trace_count,
  span_count,
  duration_ms
FROM "chalk.telemetry.sessions"
WHERE start_time >= now()::timestamp - INTERVAL 1 DAY
ORDER BY duration_ms DESC
LIMIT 100

This schema is available in Chalk deployments with managed telemetry configured. Results are always restricted to the active environment.