Skip to main content

query_log_range_aggregation

Function query_log_range_aggregation 

Source
pub fn query_log_range_aggregation<D: Drain>(
    log_store: &LogStore<D>,
    query_source: QuerySource,
    start_time: DateTime<Utc>,
    end_time: DateTime<Utc>,
) -> Vec<Record>
Expand description

Aggregates log records based on a query source and a time range.

This function retrieves records either by a specific log group ID or by a LogQL query, and then filters these records to include only those within the specified time range. It is generic over D: Drain due to its use of LogStore.

Similar to execute_logql_query, this function returns Vec<Record> (cloned records) to manage lifetimes correctly with data sourced from the Drain.

§Arguments

  • log_store - A reference to the LogStore instance.
  • query_source - A QuerySource enum indicating whether to fetch records by ID or by a LogQL query.
  • start_time - The DateTime<Utc> start of the aggregation range.
  • end_time - The DateTime<Utc> end of the aggregation range.

§Returns

A Vec<Record> containing all records that match the query source and fall within the time range.