Skip to main content

systemprompt_runtime/trace/repository/
mod.rs

1//! Read-only SQL over the tracing and audit tables.
2//!
3//! [`TraceRepository`] owns every query the trace services issue; each
4//! submodule adds one group of methods (log events, AI requests, audit views,
5//! MCP executions, execution steps, log browsing) to the same type.
6//!
7//! Copyright (c) systemprompt.io — Business Source License 1.1.
8//! See <https://systemprompt.io> for licensing details.
9
10mod ai_trace;
11mod audit;
12mod events;
13mod list;
14mod log_lookup;
15mod log_search;
16mod log_summary;
17mod mcp_trace;
18mod request;
19mod request_stats;
20mod step;
21mod tool;
22
23use sqlx::PgPool;
24use std::sync::Arc;
25
26use super::TraceError;
27
28pub(super) type Result<T> = std::result::Result<T, TraceError>;
29
30/// Query access to the trace, log and audit tables.
31#[derive(Debug, Clone)]
32pub struct TraceRepository {
33    pool: Arc<PgPool>,
34}
35
36impl TraceRepository {
37    pub const fn new(pool: Arc<PgPool>) -> Self {
38        Self { pool }
39    }
40}