systemprompt-analytics 0.2.2

Analytics for systemprompt.io AI governance infrastructure. Session, agent, tool, and microdollar-precision cost attribution across the MCP governance pipeline.
Documentation
use thiserror::Error;

#[derive(Error, Debug)]
pub enum AnalyticsError {
    #[error("Session not found: {0}")]
    SessionNotFound(String),

    #[error("Invalid fingerprint hash: {0}")]
    InvalidFingerprint(String),

    #[error("Database error: {0}")]
    Database(#[from] sqlx::Error),

    #[error("Session expired")]
    SessionExpired,

    #[error("Throttle level exceeded")]
    ThrottleLevelExceeded,

    #[error("Behavioral bot detected: {0}")]
    BehavioralBotDetected(String),

    #[error("Anomaly detection failed: {0}")]
    AnomalyDetectionFailed(String),
}

pub type Result<T> = std::result::Result<T, AnalyticsError>;