@@ -534,7 +534,7 @@ impl EbpfCollector {
534
534
let Some ( m_ctx) = ( ctx as * mut memory_profile:: MemoryContext ) . as_mut ( ) else {
535
535
return ;
536
536
} ;
537
- m_ctx. update ( data, PROFILE_STACK_COMPRESSION ) ;
537
+ m_ctx. update ( data) ;
538
538
m_ctx. report (
539
539
Duration :: from_nanos ( ts_nanos) ,
540
540
EBPF_PROFILE_SENDER . as_mut ( ) . unwrap ( ) ,
@@ -568,20 +568,24 @@ impl EbpfCollector {
568
568
profile. cpu = data. cpu ;
569
569
profile. count = data. count as u32 ;
570
570
profile. wide_count = data. count ;
571
- profile. data =
572
- slice:: from_raw_parts ( data. stack_data as * mut u8 , data. stack_data_len as usize )
573
- . to_vec ( ) ;
574
- let container_id =
575
- CStr :: from_ptr ( data. container_id . as_ptr ( ) as * const libc:: c_char ) . to_string_lossy ( ) ;
571
+ let profile_data =
572
+ slice:: from_raw_parts ( data. stack_data as * mut u8 , data. stack_data_len as usize ) ;
576
573
if PROFILE_STACK_COMPRESSION {
577
- match compress ( & profile . data , 0 ) {
574
+ match compress ( & profile_data , 0 ) {
578
575
Ok ( compressed_data) => {
579
576
profile. data_compressed = true ;
580
577
profile. data = compressed_data;
581
578
}
582
- Err ( e) => debug ! ( "failed to compress ebpf profile: {:?}" , e) ,
579
+ Err ( e) => {
580
+ profile. data = profile_data. to_vec ( ) ;
581
+ debug ! ( "failed to compress ebpf profile: {:?}" , e) ;
582
+ }
583
583
}
584
+ } else {
585
+ profile. data = profile_data. to_vec ( ) ;
584
586
}
587
+ let container_id =
588
+ CStr :: from_ptr ( data. container_id . as_ptr ( ) as * const libc:: c_char ) . to_string_lossy ( ) ;
585
589
if let Some ( policy_getter) = POLICY_GETTER . as_ref ( ) {
586
590
profile. pod_id = policy_getter. lookup_pod_id ( & container_id) ;
587
591
}
@@ -824,7 +828,10 @@ impl EbpfCollector {
824
828
let mut contexts: [ * mut c_void ; 3 ] = [ ptr:: null_mut ( ) ; 3 ] ;
825
829
#[ cfg( feature = "extended_profile" ) ]
826
830
{
827
- let mp_ctx = memory_profile:: MemoryContext :: new ( memory. report_interval ) ;
831
+ let mp_ctx = memory_profile:: MemoryContext :: new (
832
+ memory. report_interval ,
833
+ ebpf_conf. preprocess . stack_compression ,
834
+ ) ;
828
835
handle. memory_profile_settings = Some ( mp_ctx. settings ( ) ) ;
829
836
contexts[ ebpf:: PROFILER_CTX_MEMORY_IDX ] =
830
837
Box :: into_raw ( Box :: new ( mp_ctx) ) as * mut c_void ;
0 commit comments