RequestLogRepository

Struct RequestLogRepository 

Source
pub struct RequestLogRepository {
    pub base: BaseRepository<RequestLog>,
}
Expand description

请求日志Repository

Fields§

§base: BaseRepository<RequestLog>

Implementations§

Source§

impl RequestLogRepository

Source

pub fn new(query_executor: Box<dyn QueryExecutor>) -> Self

Source

pub async fn find_by_deployment_id( &self, deployment_id: Uuid, start_time: DateTime<Utc>, end_time: DateTime<Utc>, context: &QueryContext, ) -> DatabaseResult<Vec<RequestLog>>

根据部署ID获取日志

Source

pub async fn find_errors( &self, start_time: DateTime<Utc>, end_time: DateTime<Utc>, context: &QueryContext, ) -> DatabaseResult<Vec<RequestLog>>

获取错误日志

Examples found in repository?
examples/burncloud_usage.rs (line 217)
198async fn advanced_query_examples(db: &BurnCloudDatabase) -> Result<(), Box<dyn std::error::Error>> {
199    let context = QueryContext::default();
200
201    // 时间范围查询
202    let start_time = chrono::Utc::now() - chrono::Duration::hours(24);
203    let end_time = chrono::Utc::now();
204
205    // 获取过去24小时的系统指标
206    let recent_metrics = db.system_metrics.find_by_time_range(start_time, end_time, &context).await?;
207    println!("📊 过去24小时系统指标: {} 条记录", recent_metrics.len());
208
209    // 获取特定部署的性能指标
210    if let Some(deployment) = db.deployments.get_running_deployments(&context).await?.first() {
211        let deployment_metrics = db.model_metrics
212            .find_by_deployment_id(deployment.id, start_time, end_time, &context)
213            .await?;
214        println!("📈 部署 {} 的性能指标: {} 条记录", deployment.name, deployment_metrics.len());
215
216        // 获取该部署的错误日志
217        let error_logs = db.request_logs.find_errors(start_time, end_time, &context).await?;
218        println!("❌ 过去24小时错误日志: {} 条记录", error_logs.len());
219    }
220
221    Ok(())
222}

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,