Skip to content

Commit ca4adb8

Browse files
feat: add log source to home api (#1525)
1 parent 94c235f commit ca4adb8

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

src/prism/home/mod.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use tracing::error;
2828
use crate::{
2929
alerts::{ALERTS, AlertError, alert_structs::AlertsSummary, get_alerts_summary},
3030
correlation::{CORRELATIONS, CorrelationError},
31+
event::format::{LogSource, LogSourceEntry},
3132
handlers::{
3233
TelemetryType,
3334
http::{cluster::fetch_daily_stats, logstream::error::StreamError},
@@ -46,6 +47,7 @@ type StreamMetadataResponse = Result<
4647
Vec<ObjectStoreFormat>,
4748
TelemetryType,
4849
Option<String>,
50+
LogSource,
4951
),
5052
PrismHomeError,
5153
>;
@@ -65,6 +67,7 @@ pub struct DataSet {
6567
dataset_type: TelemetryType,
6668
#[serde(skip_serializing_if = "Option::is_none")]
6769
time_partition: Option<String>,
70+
dataset_format: LogSource,
6871
}
6972

7073
#[derive(Debug, Serialize)]
@@ -131,7 +134,7 @@ pub async fn generate_home_response(
131134

132135
for result in stream_metadata_results {
133136
match result {
134-
Ok((stream, metadata, dataset_type, time_partition)) => {
137+
Ok((stream, metadata, dataset_type, time_partition, dataset_format)) => {
135138
// Skip internal streams if the flag is false
136139
if !include_internal
137140
&& metadata
@@ -145,6 +148,7 @@ pub async fn generate_home_response(
145148
title: stream,
146149
dataset_type,
147150
time_partition,
151+
dataset_format,
148152
});
149153
}
150154
Err(e) => {
@@ -222,6 +226,7 @@ async fn get_stream_metadata(
222226
Vec<ObjectStoreFormat>,
223227
TelemetryType,
224228
Option<String>,
229+
LogSource,
225230
),
226231
PrismHomeError,
227232
> {
@@ -250,8 +255,21 @@ async fn get_stream_metadata(
250255

251256
let dataset_type = stream_jsons[0].telemetry_type;
252257
let time_partition = stream_jsons[0].time_partition.clone();
253-
254-
Ok((stream, stream_jsons, dataset_type, time_partition))
258+
let dataset_format = stream_jsons[0]
259+
.log_source
260+
.first()
261+
.cloned()
262+
.unwrap_or_else(LogSourceEntry::default)
263+
.log_source_format
264+
.clone();
265+
266+
Ok((
267+
stream,
268+
stream_jsons,
269+
dataset_type,
270+
time_partition,
271+
dataset_format,
272+
))
255273
}
256274

257275
async fn stats_for_date(

0 commit comments

Comments
 (0)