Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/handlers/http/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ pub async fn get_counts(
let records = counts_request.get_bin_density().await?;

Ok(web::Json(CountsResponse {
fields: vec!["counts_timestamp".into(), "log_count".into()],
fields: vec![
"counts_start_timestamp".into(),
"counts_end_timestamp".into(),
"log_count".into(),
],
records,
}))
}
Expand Down
13 changes: 9 additions & 4 deletions src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ impl Query {
#[derive(Debug, Serialize, Clone)]
pub struct CountsRecord {
/// Start time of the bin
pub counts_timestamp: String,
pub counts_start_timestamp: String,
/// End time of the bin
pub counts_end_timestamp: String,
/// Number of logs in the bin
pub log_count: u64,
}
Expand Down Expand Up @@ -297,8 +299,8 @@ impl CountsRequest {

for bin in counts {
// extract start and end time to compare
let counts_timestamp = bin.start.timestamp_millis();

let counts_start_timestamp = bin.start.timestamp_millis();
let counts_end_timestamp = bin.end.timestamp_millis();
// Sum up the number of rows that fall within the bin
let log_count: u64 = all_manifest_files
.iter()
Expand All @@ -322,7 +324,10 @@ impl CountsRequest {
.sum();

counts_records.push(CountsRecord {
counts_timestamp: DateTime::from_timestamp_millis(counts_timestamp)
counts_start_timestamp: DateTime::from_timestamp_millis(counts_start_timestamp)
.unwrap()
.to_rfc3339(),
counts_end_timestamp: DateTime::from_timestamp_millis(counts_end_timestamp)
.unwrap()
.to_rfc3339(),
log_count,
Expand Down
Loading