Skip to content

The only tool you need to know what is happening and how to fix it.

1.4 KB
Raw Blame
CREATE TABLE IF NOT EXISTS spans_v2 (
    project_id UUID,
    trace_id String DEFAULT '',
    span_id String DEFAULT '',
    parent_span_id String DEFAULT '',
    name String DEFAULT '',
    span_kind Int32 DEFAULT 0,
    status_code Int32 DEFAULT 0,
    status_message String DEFAULT '',
    service_name LowCardinality(String) DEFAULT '',
    scope_name LowCardinality(String) DEFAULT '',
    scope_version LowCardinality(String) DEFAULT '',
    start_time_unix_nano UInt64 DEFAULT 0,
    end_time_unix_nano UInt64 DEFAULT 0,
    duration Int64 DEFAULT 0,
    recorded_at DateTime,
    trace_state String DEFAULT '',
    flags UInt32 DEFAULT 0,
    dropped_attributes_count UInt32 DEFAULT 0,
    dropped_events_count UInt32 DEFAULT 0,
    dropped_links_count UInt32 DEFAULT 0,
    resource_schema_url LowCardinality(String) DEFAULT '',
    scope_schema_url LowCardinality(String) DEFAULT '',
    span_attributes Map(LowCardinality(String), String),
    resource LowCardinality(String) DEFAULT '',
    scope LowCardinality(String) DEFAULT '',
    events String DEFAULT '[]' CODEC(ZSTD(1)),
    links String DEFAULT '[]' CODEC(ZSTD(1)),
    resource_pb LowCardinality(String) DEFAULT '',
    scope_pb LowCardinality(String) DEFAULT '',
    span_pb String DEFAULT '' CODEC(ZSTD(1)),
    INDEX idx_spans_v2_trace_id trace_id TYPE bloom_filter(0.001) GRANULARITY 1
) ENGINE = MergeTree
PARTITION BY toYYYYMMDD(recorded_at)
ORDER BY (project_id, trace_id, start_time_unix_nano)