@@ -42,7 +42,7 @@ use crate::utils::header_parsing::ParseHeaderError;
4242use crate :: utils:: json:: flatten:: JsonFlattenError ;
4343
4444use super :: logstream:: error:: { CreateStreamError , StreamError } ;
45- use super :: modal:: utils:: ingest_utils:: flatten_and_push_logs;
45+ use super :: modal:: utils:: ingest_utils:: { flatten_and_push_logs, get_custom_fields_from_header } ;
4646use super :: users:: dashboards:: DashboardError ;
4747use super :: users:: filters:: FiltersError ;
4848
@@ -92,6 +92,7 @@ pub async fn ingest(
9292 } ;
9393
9494 let log_source_entry = LogSourceEntry :: new ( log_source. clone ( ) , fields) ;
95+ let p_custom_fields = get_custom_fields_from_header ( req) ;
9596
9697 PARSEABLE
9798 . create_stream_if_not_exists (
@@ -101,7 +102,7 @@ pub async fn ingest(
101102 )
102103 . await ?;
103104
104- flatten_and_push_logs ( json, & stream_name, & log_source) . await ?;
105+ flatten_and_push_logs ( json, & stream_name, & log_source, & p_custom_fields ) . await ?;
105106
106107 Ok ( HttpResponse :: Ok ( ) . finish ( ) )
107108}
@@ -122,6 +123,7 @@ pub async fn ingest_internal_stream(stream_name: String, body: Bytes) -> Result<
122123 None ,
123124 SchemaVersion :: V0 ,
124125 StreamType :: Internal ,
126+ & HashMap :: new ( ) ,
125127 ) ?
126128 . process ( ) ?;
127129
@@ -163,8 +165,9 @@ pub async fn handle_otel_logs_ingestion(
163165 vec ! [ log_source_entry] ,
164166 )
165167 . await ?;
168+ let p_custom_fields = get_custom_fields_from_header ( req) ;
166169
167- flatten_and_push_logs ( json, & stream_name, & log_source) . await ?;
170+ flatten_and_push_logs ( json, & stream_name, & log_source, & p_custom_fields ) . await ?;
168171
169172 Ok ( HttpResponse :: Ok ( ) . finish ( ) )
170173}
@@ -186,6 +189,7 @@ pub async fn handle_otel_metrics_ingestion(
186189 if log_source != LogSource :: OtelMetrics {
187190 return Err ( PostError :: IncorrectLogSource ( LogSource :: OtelMetrics ) ) ;
188191 }
192+
189193 let stream_name = stream_name. to_str ( ) . unwrap ( ) . to_owned ( ) ;
190194 let log_source_entry = LogSourceEntry :: new (
191195 log_source. clone ( ) ,
@@ -202,7 +206,9 @@ pub async fn handle_otel_metrics_ingestion(
202206 )
203207 . await ?;
204208
205- flatten_and_push_logs ( json, & stream_name, & log_source) . await ?;
209+ let p_custom_fields = get_custom_fields_from_header ( req) ;
210+
211+ flatten_and_push_logs ( json, & stream_name, & log_source, & p_custom_fields) . await ?;
206212
207213 Ok ( HttpResponse :: Ok ( ) . finish ( ) )
208214}
@@ -242,7 +248,9 @@ pub async fn handle_otel_traces_ingestion(
242248 )
243249 . await ?;
244250
245- flatten_and_push_logs ( json, & stream_name, & log_source) . await ?;
251+ let p_custom_fields = get_custom_fields_from_header ( req) ;
252+
253+ flatten_and_push_logs ( json, & stream_name, & log_source, & p_custom_fields) . await ?;
246254
247255 Ok ( HttpResponse :: Ok ( ) . finish ( ) )
248256}
@@ -299,7 +307,8 @@ pub async fn post_event(
299307 _ => { }
300308 }
301309
302- flatten_and_push_logs ( json, & stream_name, & log_source) . await ?;
310+ let p_custom_fields = get_custom_fields_from_header ( req) ;
311+ flatten_and_push_logs ( json, & stream_name, & log_source, & p_custom_fields) . await ?;
303312
304313 Ok ( HttpResponse :: Ok ( ) . finish ( ) )
305314}
@@ -452,7 +461,13 @@ mod tests {
452461 } ) ;
453462
454463 let ( rb, _) = json:: Event :: new ( json)
455- . into_recordbatch ( & HashMap :: default ( ) , false , None , SchemaVersion :: V0 )
464+ . into_recordbatch (
465+ & HashMap :: default ( ) ,
466+ false ,
467+ None ,
468+ SchemaVersion :: V0 ,
469+ & HashMap :: new ( ) ,
470+ )
456471 . unwrap ( ) ;
457472
458473 assert_eq ! ( rb. num_rows( ) , 1 ) ;
@@ -480,7 +495,13 @@ mod tests {
480495 } ) ;
481496
482497 let ( rb, _) = json:: Event :: new ( json)
483- . into_recordbatch ( & HashMap :: default ( ) , false , None , SchemaVersion :: V0 )
498+ . into_recordbatch (
499+ & HashMap :: default ( ) ,
500+ false ,
501+ None ,
502+ SchemaVersion :: V0 ,
503+ & HashMap :: new ( ) ,
504+ )
484505 . unwrap ( ) ;
485506
486507 assert_eq ! ( rb. num_rows( ) , 1 ) ;
@@ -512,7 +533,7 @@ mod tests {
512533 ) ;
513534
514535 let ( rb, _) = json:: Event :: new ( json)
515- . into_recordbatch ( & schema, false , None , SchemaVersion :: V0 )
536+ . into_recordbatch ( & schema, false , None , SchemaVersion :: V0 , & HashMap :: new ( ) )
516537 . unwrap ( ) ;
517538
518539 assert_eq ! ( rb. num_rows( ) , 1 ) ;
@@ -544,7 +565,7 @@ mod tests {
544565 ) ;
545566
546567 assert ! ( json:: Event :: new( json)
547- . into_recordbatch( & schema, false , None , SchemaVersion :: V0 , )
568+ . into_recordbatch( & schema, false , None , SchemaVersion :: V0 , & HashMap :: new ( ) )
548569 . is_err( ) ) ;
549570 }
550571
@@ -562,7 +583,7 @@ mod tests {
562583 ) ;
563584
564585 let ( rb, _) = json:: Event :: new ( json)
565- . into_recordbatch ( & schema, false , None , SchemaVersion :: V0 )
586+ . into_recordbatch ( & schema, false , None , SchemaVersion :: V0 , & HashMap :: new ( ) )
566587 . unwrap ( ) ;
567588
568589 assert_eq ! ( rb. num_rows( ) , 1 ) ;
@@ -603,7 +624,13 @@ mod tests {
603624 ] ) ;
604625
605626 let ( rb, _) = json:: Event :: new ( json)
606- . into_recordbatch ( & HashMap :: default ( ) , false , None , SchemaVersion :: V0 )
627+ . into_recordbatch (
628+ & HashMap :: default ( ) ,
629+ false ,
630+ None ,
631+ SchemaVersion :: V0 ,
632+ & HashMap :: new ( ) ,
633+ )
607634 . unwrap ( ) ;
608635
609636 assert_eq ! ( rb. num_rows( ) , 3 ) ;
@@ -651,7 +678,13 @@ mod tests {
651678 ] ) ;
652679
653680 let ( rb, _) = json:: Event :: new ( json)
654- . into_recordbatch ( & HashMap :: default ( ) , false , None , SchemaVersion :: V0 )
681+ . into_recordbatch (
682+ & HashMap :: default ( ) ,
683+ false ,
684+ None ,
685+ SchemaVersion :: V0 ,
686+ & HashMap :: new ( ) ,
687+ )
655688 . unwrap ( ) ;
656689
657690 assert_eq ! ( rb. num_rows( ) , 3 ) ;
@@ -700,7 +733,7 @@ mod tests {
700733 ) ;
701734
702735 let ( rb, _) = json:: Event :: new ( json)
703- . into_recordbatch ( & schema, false , None , SchemaVersion :: V0 )
736+ . into_recordbatch ( & schema, false , None , SchemaVersion :: V0 , & HashMap :: new ( ) )
704737 . unwrap ( ) ;
705738
706739 assert_eq ! ( rb. num_rows( ) , 3 ) ;
@@ -749,7 +782,7 @@ mod tests {
749782 ) ;
750783
751784 assert ! ( json:: Event :: new( json)
752- . into_recordbatch( & schema, false , None , SchemaVersion :: V0 , )
785+ . into_recordbatch( & schema, false , None , SchemaVersion :: V0 , & HashMap :: new ( ) )
753786 . is_err( ) ) ;
754787 }
755788
@@ -789,7 +822,13 @@ mod tests {
789822 . unwrap ( ) ;
790823
791824 let ( rb, _) = json:: Event :: new ( flattened_json)
792- . into_recordbatch ( & HashMap :: default ( ) , false , None , SchemaVersion :: V0 )
825+ . into_recordbatch (
826+ & HashMap :: default ( ) ,
827+ false ,
828+ None ,
829+ SchemaVersion :: V0 ,
830+ & HashMap :: new ( ) ,
831+ )
793832 . unwrap ( ) ;
794833 assert_eq ! ( rb. num_rows( ) , 4 ) ;
795834 assert_eq ! ( rb. num_columns( ) , 5 ) ;
@@ -872,7 +911,13 @@ mod tests {
872911 . unwrap ( ) ;
873912
874913 let ( rb, _) = json:: Event :: new ( flattened_json)
875- . into_recordbatch ( & HashMap :: default ( ) , false , None , SchemaVersion :: V1 )
914+ . into_recordbatch (
915+ & HashMap :: default ( ) ,
916+ false ,
917+ None ,
918+ SchemaVersion :: V1 ,
919+ & HashMap :: new ( ) ,
920+ )
876921 . unwrap ( ) ;
877922
878923 assert_eq ! ( rb. num_rows( ) , 4 ) ;
0 commit comments