@@ -22,6 +22,7 @@ use actix_web::http::StatusCode;
2222use actix_web:: { HttpRequest , HttpResponse , web} ;
2323use serde:: { Deserialize , Serialize } ;
2424
25+ use crate :: event:: format:: LogSource ;
2526use crate :: rbac:: { self , Users , role:: Action } ;
2627use crate :: utils:: actix:: extract_session_key_from_req;
2728use crate :: utils:: get_tenant_id_from_request;
@@ -44,6 +45,7 @@ fn can_access_stream(req: &HttpRequest, stream_name: &str) -> bool {
4445#[ serde( rename_all = "camelCase" ) ]
4546struct CorrelatedDataset {
4647 name : String ,
48+ log_source : LogSource ,
4749 shared_tags : Vec < DatasetTag > ,
4850 shared_labels : Vec < String > ,
4951}
@@ -99,8 +101,14 @@ pub async fn get_correlated_datasets(
99101 target_labels. intersection ( & s_labels) . cloned ( ) . collect ( ) ;
100102
101103 if !shared_tags. is_empty ( ) || !shared_labels. is_empty ( ) {
104+ let log_source = s
105+ . get_log_source ( )
106+ . first ( )
107+ . map ( |entry| entry. log_source_format . clone ( ) )
108+ . unwrap_or_default ( ) ;
102109 correlated. push ( CorrelatedDataset {
103110 name,
111+ log_source,
104112 shared_tags,
105113 shared_labels,
106114 } ) ;
@@ -111,6 +119,13 @@ pub async fn get_correlated_datasets(
111119 Ok ( HttpResponse :: Ok ( ) . json ( correlated) )
112120}
113121
122+ #[ derive( Debug , Serialize ) ]
123+ #[ serde( rename_all = "camelCase" ) ]
124+ struct TaggedDataset {
125+ name : String ,
126+ log_source : LogSource ,
127+ }
128+
114129/// GET /api/v1/datasets/tags/{tag}
115130/// Returns all datasets that have the specified tag.
116131/// Results are filtered to only include datasets the caller is authorized to read.
@@ -136,7 +151,12 @@ pub async fn get_datasets_by_tag(
136151 continue ;
137152 }
138153 if s. get_dataset_tags ( ) . contains ( & tag) {
139- matching. push ( name) ;
154+ let log_source = s
155+ . get_log_source ( )
156+ . first ( )
157+ . map ( |entry| entry. log_source_format . clone ( ) )
158+ . unwrap_or_default ( ) ;
159+ matching. push ( TaggedDataset { name, log_source } ) ;
140160 }
141161 }
142162 }
0 commit comments