pub struct LogsQuery {
pub query: Option<String>,
pub labels: FxHashMap<String, String>,
pub contains: Option<String>,
pub start_ns: i64,
pub end_ns: i64,
pub limit: usize,
pub direction: QueryDirection,
}Expand description
A query for fetching logs.
Fields§
§query: Option<String>Backend-specific query string (e.g., LogQL for Loki). If None, uses labels and contains for filtering.
labels: FxHashMap<String, String>Filter by these label key-value pairs.
contains: Option<String>Simple text search within log messages.
start_ns: i64Start of time range (nanoseconds since Unix epoch).
end_ns: i64End of time range (nanoseconds since Unix epoch).
limit: usizeMaximum number of entries to return.
direction: QueryDirectionSort direction for results.
Implementations§
Source§impl LogsQuery
impl LogsQuery
Sourcepub fn new(start_ns: i64, end_ns: i64) -> Self
pub fn new(start_ns: i64, end_ns: i64) -> Self
Create a new logs query for the given time range.
Sourcepub fn with_query(self, query: impl Into<String>) -> Self
pub fn with_query(self, query: impl Into<String>) -> Self
Set a backend-specific query string.
Sourcepub fn with_label(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_label( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add a label filter.
Sourcepub fn with_contains(self, text: impl Into<String>) -> Self
pub fn with_contains(self, text: impl Into<String>) -> Self
Set a text search filter.
Sourcepub fn with_limit(self, limit: usize) -> Self
pub fn with_limit(self, limit: usize) -> Self
Set the maximum number of results.
Sourcepub fn with_direction(self, direction: QueryDirection) -> Self
pub fn with_direction(self, direction: QueryDirection) -> Self
Set the sort direction.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LogsQuery
impl RefUnwindSafe for LogsQuery
impl Send for LogsQuery
impl Sync for LogsQuery
impl Unpin for LogsQuery
impl UnsafeUnpin for LogsQuery
impl UnwindSafe for LogsQuery
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