diff --git a/src/prism/home/mod.rs b/src/prism/home/mod.rs index 95e03b8ce..238a1a9cf 100644 --- a/src/prism/home/mod.rs +++ b/src/prism/home/mod.rs @@ -29,6 +29,7 @@ use tracing::error; use crate::{ alerts::{get_alerts_info, AlertError, AlertsInfo, ALERTS}, correlation::{CorrelationError, CORRELATIONS}, + event::format::LogSource, handlers::http::{ cluster::fetch_daily_stats_from_ingestors, logstream::{error::StreamError, get_stats_date}, @@ -61,6 +62,19 @@ struct TitleAndId { id: String, } +#[derive(Debug, Serialize)] +enum DataSetType { + Logs, + Metrics, + Traces, +} + +#[derive(Debug, Serialize)] +struct DataSet { + title: String, + dataset_type: DataSetType, +} + #[derive(Debug, Serialize)] pub struct HomeResponse { alert_titles: Vec, @@ -69,7 +83,7 @@ pub struct HomeResponse { stream_info: StreamInfo, stats_details: Vec, stream_titles: Vec, - + datasets: Vec, dashboard_titles: Vec, filter_titles: Vec, } @@ -161,11 +175,11 @@ pub async fn generate_home_response(key: &SessionKey) -> Result Result d, @@ -188,13 +200,31 @@ pub async fn generate_home_response(key: &SessionKey) -> Result DataSetType::Metrics, + LogSource::OtelTraces => DataSetType::Traces, + _ => DataSetType::Logs, + }; + + let dataset = DataSet { + title: stream.clone(), + dataset_type, + }; + datasets.push(dataset); } for date in dates.into_iter() { - let dated_stats = stats_for_date(date, stream_wise_ingestor_stream_json.clone()).await?; + let dated_stats = stats_for_date(date, stream_wise_stream_json.clone()).await?; summary.stats_summary.events += dated_stats.events; summary.stats_summary.ingestion += dated_stats.ingestion_size; summary.stats_summary.storage += dated_stats.storage_size; @@ -205,7 +235,8 @@ pub async fn generate_home_response(key: &SessionKey) -> Result