@@ -125,6 +125,8 @@ use integration_skywalking::SkyWalkingExtra;
125
125
use packet_sequence_block:: BoxedPacketSequenceBlock ;
126
126
use pcap_assembler:: { BoxedPcapBatch , PcapAssembler } ;
127
127
128
+ #[ cfg( feature = "enterprise" ) ]
129
+ use enterprise_utils:: utils:: { kernel_version_check, ActionFlags } ;
128
130
use public:: {
129
131
buffer:: BatchedBox ,
130
132
debug:: QueueDebugger ,
@@ -269,16 +271,6 @@ impl AgentState {
269
271
}
270
272
}
271
273
272
- pub fn terminate ( & self ) {
273
- if !self . terminated . swap ( true , Ordering :: Relaxed ) {
274
- // log only the first time
275
- info ! ( "Agent state changed to {:?}" , State :: Terminated ) ;
276
- }
277
- let sg = self . state . lock ( ) . unwrap ( ) ;
278
- self . notifier . notify_one ( ) ;
279
- info ! ( "Agent terminate with state: {:?}" , State :: from( sg. 0 ) ) ;
280
- }
281
-
282
274
pub fn update_config ( & self , config : ChangedConfig ) {
283
275
if self . terminated . load ( Ordering :: Relaxed ) {
284
276
// when state is Terminated, main thread should still be notified for exiting
@@ -629,6 +621,20 @@ impl Trident {
629
621
Ok ( Trident { state, handle } )
630
622
}
631
623
624
+ #[ cfg( feature = "enterprise" ) ]
625
+ fn kernel_version_check ( state : & AgentState , exception_handler : & ExceptionHandler ) {
626
+ let action = kernel_version_check ( ) ;
627
+ if action. contains ( ActionFlags :: TERMINATE ) {
628
+ exception_handler. set ( Exception :: KernelVersionCircuitBreaker ) ;
629
+ crate :: utils:: clean_and_exit ( 1 ) ;
630
+ } else if action. contains ( ActionFlags :: MELTDOWN ) {
631
+ exception_handler. set ( Exception :: KernelVersionCircuitBreaker ) ;
632
+ state. melt_down ( ) ;
633
+ } else if action. contains ( ActionFlags :: ALARM ) {
634
+ exception_handler. set ( Exception :: KernelVersionCircuitBreaker ) ;
635
+ }
636
+ }
637
+
632
638
fn run (
633
639
state : Arc < AgentState > ,
634
640
ctrl_ip : IpAddr ,
@@ -894,6 +900,9 @@ impl Trident {
894
900
platform_synchronizer. start ( ) ;
895
901
}
896
902
903
+ #[ cfg( feature = "enterprise" ) ]
904
+ Trident :: kernel_version_check ( & state, & exception_handler) ;
905
+
897
906
let mut components: Option < Components > = None ;
898
907
let mut first_run = true ;
899
908
let mut config_initialized = false ;
@@ -1176,7 +1185,6 @@ impl Trident {
1176
1185
}
1177
1186
1178
1187
pub fn stop ( & mut self ) {
1179
- self . state . terminate ( ) ;
1180
1188
info ! ( "Agent stopping" ) ;
1181
1189
crate :: utils:: clean_and_exit ( 0 ) ;
1182
1190
}
0 commit comments