pub struct RequestLogRepository {
pub base: BaseRepository<RequestLog>,
}Expand description
请求日志Repository
Fields§
§base: BaseRepository<RequestLog>Implementations§
Source§impl RequestLogRepository
impl RequestLogRepository
pub fn new(query_executor: Box<dyn QueryExecutor>) -> Self
Sourcepub async fn find_by_deployment_id(
&self,
deployment_id: Uuid,
start_time: DateTime<Utc>,
end_time: DateTime<Utc>,
context: &QueryContext,
) -> DatabaseResult<Vec<RequestLog>>
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获取日志
Sourcepub async fn find_errors(
&self,
start_time: DateTime<Utc>,
end_time: DateTime<Utc>,
context: &QueryContext,
) -> DatabaseResult<Vec<RequestLog>>
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§
impl Freeze for RequestLogRepository
impl !RefUnwindSafe for RequestLogRepository
impl Send for RequestLogRepository
impl Sync for RequestLogRepository
impl Unpin for RequestLogRepository
impl !UnwindSafe for RequestLogRepository
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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