# SQL schema The tables and columns you can query in the SQL console and the filter language. Each table below is a view of your project's data. The SQL console and the filter language read the same views. Timestamps are integers in nanoseconds since the Unix epoch (UTC), and trace and span IDs are lowercase hex strings. ## `traces` One row per trace. Merge bookkeeping columns are not exposed. | Column | Type | Nullable | Description | |---|---|---|---| | `trace_id` | `string` | no | Trace id, 16 bytes as lowercase hex. | | `start_time` | `timestamp` | no | Earliest span start. | | `end_time` | `timestamp` | no | Latest span end. | | `duration_ns` | `integer` | no | end_time minus start_time, in nanoseconds. | | `duration_ms` | `float` | no | duration_ns / 1e6, for convenience. | | `name` | `string` | no | Name of the root span, else the earliest span. | | `root_span_id` | `string` | yes | Span id of the root. Null when the trace has no root. | | `has_root` | `boolean` | no | Whether a root span is present. | | `status` | `string` | no | error if any span errored, else the root status, else unset. | | `session_id` | `string` | yes | Session id, preferring the root. | | `user_id` | `string` | yes | End-user id, preferring the root. | | `environment` | `string` | yes | Deployment environment. | | `release` | `string` | yes | Git SHA or version string. | | `tags` | `string_list` | no | Distinct union of span tags. | | `metadata` | `string_map` | no | Root metadata, with keys from other spans added when absent. | | `input_preview` | `string` | yes | Root input preview, else the first llm span's. | | `output_preview` | `string` | yes | Root output preview, else the first llm span's. | | `span_count` | `integer` | no | Number of spans. | | `error_count` | `integer` | no | Number of spans with status error. | | `llm_count` | `integer` | no | Number of llm spans. | | `input_tokens` | `integer` | yes | Sum of input tokens. Null when every span omitted the field. | | `output_tokens` | `integer` | yes | Sum of output tokens. Null when every span omitted the field. | | `cache_read_tokens` | `integer` | yes | Sum of cache-read tokens. Null when every span omitted the field. | | `cache_write_tokens` | `integer` | yes | Sum of cache-write tokens. Null when every span omitted the field. | | `reasoning_tokens` | `integer` | yes | Sum of reasoning tokens. Null when every span omitted the field. | | `total_tokens` | `integer` | yes | Sum of total tokens. Null when every span omitted the field. | | `cost_total` | `float` | yes | Sum of span costs, USD. Null when every span omitted the field. | | `models` | `string_list` | no | Distinct model names. | | `prompts` | `string_list` | no | Registry prompts the trace used, as name@version (D-V-15). | ## `spans` One row per span, including payload columns. | Column | Type | Nullable | Description | |---|---|---|---| | `trace_id` | `string` | no | Trace id, 16 bytes as lowercase hex. | | `span_id` | `string` | no | Span id, 8 bytes as lowercase hex. | | `parent_span_id` | `string` | yes | Parent span id. Null when the span was received as a root. | | `name` | `string` | no | Span name. | | `span_kind` | `string` | no | Kind of work: llm, embedding, tool, agent, chain, retriever, reranker, guardrail, evaluator, or span. | | `start_time` | `timestamp` | no | Start time. | | `end_time` | `timestamp` | no | End time. | | `duration_ns` | `integer` | no | end_time minus start_time, in nanoseconds. | | `duration_ms` | `float` | no | duration_ns / 1e6, for convenience. | | `status` | `string` | no | unset, ok, or error. | | `status_message` | `string` | yes | Status description. | | `service_name` | `string` | yes | Resource service.name. | | `session_id` | `string` | yes | Session id. | | `user_id` | `string` | yes | End-user id. | | `environment` | `string` | yes | Deployment environment. cetra-eval is reserved for evaluator runs, cetra-playground for playground runs and cetra-assistant for assistant turns. | | `release` | `string` | yes | Git SHA or version string. | | `tags` | `string_list` | no | Tags. | | `metadata` | `string_map` | no | User metadata. Values are JSON-encoded scalars or strings. | | `provider` | `string` | yes | Normalized provider name, for example openai or anthropic. | | `request_model` | `string` | yes | Model named in the request. | | `response_model` | `string` | yes | Model named in the response. | | `model` | `string` | yes | coalesce(response_model, request_model). | | `prompt_name` | `string` | yes | Registry prompt the span used (D-V-15). | | `prompt_version` | `integer` | yes | Version of that prompt. | | `operation` | `string` | yes | GenAI operation name. | | `input_tokens` | `integer` | yes | Input tokens, including cached tokens. | | `output_tokens` | `integer` | yes | Output tokens, including reasoning tokens. | | `cache_read_tokens` | `integer` | yes | Cache-read tokens. | | `cache_write_tokens` | `integer` | yes | Cache-write tokens. | | `reasoning_tokens` | `integer` | yes | Reasoning tokens. | | `total_tokens` | `integer` | yes | Total tokens. | | `cost_input` | `float` | yes | Input cost, USD. | | `cost_output` | `float` | yes | Output cost, USD. | | `cost_total` | `float` | yes | Total cost, USD, including cache and reasoning. | | `cost_source` | `string` | yes | computed, reported, or none. | | `ttft_ns` | `integer` | yes | Time to first token, nanoseconds. | | `request_params` | `json` | yes | Request parameters such as temperature and max_tokens. | | `input` | `string` | yes | Stored payload text. | | `input_format` | `string` | yes | messages, json, or text. | | `output` | `string` | yes | Stored payload text. | | `output_format` | `string` | yes | messages, json, or text. | | `input_preview` | `string` | yes | First 512 characters of the plain-text rendering. | | `output_preview` | `string` | yes | First 512 characters of the plain-text rendering. | | `system_instructions` | `json` | yes | System instructions as JSON text. | | `tool_definitions` | `json` | yes | Tool definitions as JSON text. | | `attributes` | `string_map` | no | Span attributes not consumed by normalization. Values are JSON-encoded. | | `resource_attributes` | `string_map` | no | Resource attributes except service.name. Values are JSON-encoded. | | `scope_name` | `string` | yes | Instrumentation scope name. | | `scope_version` | `string` | yes | Instrumentation scope version. | | `events` | `json` | no | Span events. Each item has time, name, and attributes. | | `links` | `json` | no | Span links. Each item has trace_id, span_id, and attributes. | | `media_refs` | `string_list` | no | SHA-256 hex of extracted media blobs. | | `truncated` | `string_list` | no | Names of attributes truncated at ingest. | | `conventions` | `string_list` | no | Detected conventions, for example genai or openinference. | | `ingest_time` | `timestamp` | no | Server receive time. | | `schema_version` | `integer` | no | Row-level normalization version. | ## `sessions` One row per session. | Column | Type | Nullable | Description | |---|---|---|---| | `session_id` | `string` | no | Session id. | | `start_time` | `timestamp` | no | Earliest trace start. | | `end_time` | `timestamp` | no | Latest trace end. | | `duration_ns` | `integer` | no | end_time minus start_time, in nanoseconds. | | `duration_ms` | `float` | no | duration_ns / 1e6, for convenience. | | `trace_count` | `integer` | no | Number of traces in the session. | | `error_count` | `integer` | no | Sum of trace error counts. | | `total_tokens` | `integer` | yes | Sum of trace total tokens. | | `cost_total` | `float` | yes | Sum of trace costs, USD. | | `user_id` | `string` | yes | End-user id of the session. | | `tags` | `string_list` | no | Distinct union of trace tags. | ## `scores` One row per live score. | Column | Type | Nullable | Description | |---|---|---|---| | `score_id` | `string` | no | Score id. | | `target` | `string` | no | span, trace, or session. | | `trace_id` | `string` | yes | Trace id for a span or trace target. | | `span_id` | `string` | yes | Span id for a span target. | | `session_id` | `string` | yes | Session id for a session target, and copied for a trace target when known. | | `user_id` | `string` | yes | End-user id, when the writer knew it. | | `name` | `string` | no | Score name. | | `data_type` | `string` | no | numeric, boolean, categorical, or text. | | `value_num` | `float` | yes | Numeric value. Booleans are 0 or 1. | | `value_str` | `string` | yes | Categorical label or text. | | `reason` | `string` | yes | Explanation. | | `source` | `string` | no | api, sdk, human, end_user, llm_judge, check, webhook or issue. | | `evaluator_id` | `string` | yes | Evaluator that produced the score. | | `rule_id` | `string` | yes | Online rule that produced the score. | | `experiment_id` | `string` | yes | Experiment the score belongs to. | | `dataset_item_id` | `string` | yes | Dataset item the score belongs to. | | `queue_id` | `string` | yes | Annotation queue the score was written from. | | `author_user_id` | `string` | yes | Person who annotated, for human scores. | | `metadata` | `string_map` | no | Evaluator metadata. Values are strings. | | `created_at` | `timestamp` | no | Creation time. | | `updated_at` | `timestamp` | no | Last-writer-wins version. | | `deleted` | `boolean` | no | Tombstone. | | `ingest_time` | `timestamp` | no | Server receive time. | ## `experiment_items` One row per experiment result (item × repetition) of the project's visible experiments. | Column | Type | Nullable | Description | |---|---|---|---| | `experiment_id` | `string` | no | Experiment id. | | `experiment_name` | `string` | no | Experiment name. | | `dataset_id` | `string` | yes | Dataset the experiment ran on; null once the dataset is deleted. | | `dataset_version` | `integer` | no | Dataset version the experiment pinned. | | `dataset_item_id` | `string` | no | Dataset item id, stable across versions. | | `repetition` | `integer` | no | Repetition number, from 0. | | `trace_id` | `string` | yes | Trace of the task run, lowercase hex; null when none was reported. | | `input` | `json` | no | Item input at the pinned version, JSON text. | | `expected_output` | `json` | yes | Expected output at the pinned version, JSON text; null when absent. | | `output` | `json` | yes | Task output, JSON text; null when the run failed. | | `error` | `string` | yes | Error text of the failed run; null when the run did not fail. | | `latency_ns` | `integer` | yes | Task run time in nanoseconds, as the SDK measured it. | | `created_at` | `timestamp` | no | Time the result was stored. | ## `dataset_items` Live items of each dataset at its current version. | Column | Type | Nullable | Description | |---|---|---|---| | `dataset_id` | `string` | no | Dataset id. | | `dataset_name` | `string` | no | Dataset name. | | `dataset_version` | `integer` | no | Current version of the dataset, the version these rows belong to. | | `item_id` | `string` | no | Dataset item id, stable across versions. | | `input` | `json` | no | Item input, JSON text. | | `expected_output` | `json` | yes | Expected output, JSON text; null when absent. | | `metadata` | `json` | no | Item metadata, JSON text. | | `source_trace_id` | `string` | yes | Trace the item was created from, lowercase hex; null when none. | | `source_span_id` | `string` | yes | Span the item was created from, lowercase hex; null when none. | | `created_at` | `timestamp` | no | Time the item revision was stored. | ## Functions | Function | Description | |---|---| | `lower(value: string) -> string` | Lowercase a string. | | `upper(value: string) -> string` | Uppercase a string. | | `length(value: string) -> integer` | Number of UTF-8 characters. | | `substr(value: string, start: integer [, count: integer]) -> string` | Extract a substring (1-based start). | | `trim(value: string [, chars: string]) -> string` | Trim leading and trailing characters. | | `ltrim(value: string [, chars: string]) -> string` | Trim leading characters. | | `rtrim(value: string [, chars: string]) -> string` | Trim trailing characters. | | `left(value: string, n: integer) -> string` | First n characters of a string. | | `right(value: string, n: integer) -> string` | Last n characters of a string. | | `split_part(value: string, delimiter: string, part: integer) -> string` | Split a string and return the 1-based part. | | `concat(value: any, ...) -> string` | Concatenate values as a string. | | `concat_ws(separator: string, value: any, ...) -> string` | Concatenate non-null values with a separator. | | `starts_with(value: string, prefix: string) -> boolean` | Whether value starts with prefix. | | `ends_with(value: string, suffix: string) -> boolean` | Whether value ends with suffix. | | `contains(value: string, substring: string) -> boolean` | Whether value contains substring. | | `strpos(value: string, substring: string) -> integer` | 1-based position of substring, or 0 if absent. | | `regexp_like(value: string, pattern: string [, flags: string]) -> boolean` | Whether value matches a regular expression. | | `regexp_extract(value: string, pattern: string [, flags: string]) -> string` | Extract the first match or capture group. | | `encode(value: binary \| string, encoding: string) -> string` | Encode bytes using hex or base64. | | `now() -> timestamp` | Current query timestamp. | | `date_trunc(unit: string, time: timestamp) -> timestamp` | Truncate a timestamp to a unit such as day or hour. | | `date_bin(stride: interval, time: timestamp [, origin: timestamp]) -> timestamp` | Bin a timestamp to fixed stride boundaries. | | `extract(field: string, value: timestamp \| date \| interval) -> integer \| float` | Extract a calendar field from a timestamp, date, or interval. | | `to_timestamp(value: integer \| float \| string \| timestamp) -> timestamp` | Convert epoch seconds or string to a UTC timestamp. | | `abs(value: number) -> number` | Absolute value. | | `round(value: number [, digits: integer]) -> number` | Round a number to digits decimal places. | | `floor(value: number) -> number` | Largest integer not greater than value. | | `ceil(value: number) -> number` | Smallest integer not less than value. | | `sqrt(value: float) -> float` | Square root. | | `ln(value: float) -> float` | Natural logarithm. | | `log10(value: float) -> float` | Base-10 logarithm. | | `power(base: float, exponent: float) -> float` | Raise base to exponent. | | `coalesce(value: any, fallback: any, ...) -> any` | First non-null argument. | | `nullif(a: any, b: any) -> any` | Return null when a equals b, else a. | | `greatest(value: any, ...) -> any` | Largest non-null argument. | | `least(value: any, ...) -> any` | Smallest non-null argument. | | `isnan(value: float) -> boolean` | Whether value is IEEE NaN. | | `isfinite(value: float) -> boolean` | Whether value is finite (not NaN or infinite). | | `array_has(array: list, value: any) -> boolean` | Whether the list contains the value. | | `array_has_all(array: list, subset: list) -> boolean` | Whether array contains every element of subset. | | `array_length(array: list [, dim: integer]) -> integer` | Number of elements. | | `array_element(array: list, index: integer) -> any` | 1-based element of a list. | | `array_to_string(array: list, delimiter: string [, null_str: string]) -> string` | Join list elements into a string. | | `array_distinct(array: list) -> list` | Remove duplicate elements from a list. | | `map_keys(map: string_map) -> string_list` | Sorted keys of a string map. | | `map_values(map: string_map) -> string_list` | Values of a string map in key order. | | `json_get(json: string, key: string \| integer) -> string` | Get JSON object field or array element as JSON text. | | `json_get_text(json: string, key: string \| integer) -> string` | Get JSON object field or array element as unquoted text. | | `json_extract(json: string, path: string) -> string` | Extract JSONPath value as JSON text. | | `json_extract_text(json: string, path: string) -> string` | Extract JSONPath value as unquoted text. | | `count([DISTINCT] value: any \| *) -> integer` | Count rows or non-null values. | | `sum(value: number) -> number` | Sum of non-null values. | | `avg(value: number) -> float \| decimal` | Arithmetic mean of non-null values. | | `min(value: any) -> any` | Minimum non-null value. | | `max(value: any) -> any` | Maximum non-null value. | | `approx_percentile_cont(value: number, quantile: float) -> float` | Approximate continuous percentile via DDSketch. | | `percentile_cont(quantile: float) WITHIN GROUP (ORDER BY value) -> float` | Exact interpolated continuous percentile. | | `bool_or(value: boolean) -> boolean` | True if any non-null value is true. | | `bool_and(value: boolean) -> boolean` | True if all non-null values are true. | | `array_agg([DISTINCT] value: any) -> list` | Collect non-null values into a list. | | `row_number() OVER (...) -> integer` | Sequential 1-based row number within each partition. | | `rank() OVER (...) -> integer` | 1-based rank with gaps for ties. | | `dense_rank() OVER (...) -> integer` | 1-based rank without gaps for ties. | | `lag(value: any [, offset: integer [, default: any]]) OVER (...) -> any` | Value from a preceding row in the partition. | | `lead(value: any [, offset: integer [, default: any]]) OVER (...) -> any` | Value from a following row in the partition. | | `first_value(value: any) OVER (...) -> any` | Value at the first row of the window frame. | | `last_value(value: any) OVER (...) -> any` | Value at the last row of the window frame. | | `score(name: string) -> float` | Latest numeric score of that name on the row's target. | | `score_label(name: string) -> string` | Latest categorical or text score of that name. | | `has_score(name: string) -> boolean` | Whether the row's target has a score of that name. |