pub const SYS_TRACES: &str = "system.traces";
pub const CREATE_TRACES_SQL: &str = r#"
CREATE TABLE IF NOT EXISTS system.traces (
id INTEGER PRIMARY KEY AUTO_INCREMENT,
trace_id TEXT NOT NULL,
span_id TEXT NOT NULL,
parent_span_id TEXT,
name TEXT NOT NULL,
span_kind TEXT NOT NULL,
start_time TIMESTAMP NOT NULL,
end_time TIMESTAMP NOT NULL,
duration_ms FLOAT NOT NULL,
status_code TEXT NOT NULL,
status_message TEXT,
attributes TEXT,
events TEXT
);
"#;
pub fn is_traces_table(schema: &str, name: &str) -> bool {
schema.eq_ignore_ascii_case("system") && name.eq_ignore_ascii_case("traces")
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_is_traces_table() {
assert!(is_traces_table("system", "traces"));
assert!(is_traces_table("SYSTEM", "TRACES"));
assert!(!is_traces_table("public", "traces"));
assert!(!is_traces_table("system", "tables"));
}
}