@@ -9,12 +9,11 @@ use crate::metrics::DeprecationMetrics;
99use async_trait:: async_trait;
1010use chrono:: Utc ;
1111use sentinel_agent_sdk:: { Agent , Decision , Request , Response } ;
12- use sentinel_agent_sdk :: v2:: {
13- AgentCapabilities , AgentCapabilitiesExt , AgentV2 , DrainReason , HealthStatus ,
14- MetricsReport , ShutdownReason ,
12+ use sentinel_agent_protocol :: v2:: {
13+ AgentCapabilities , AgentFeatures , AgentHandlerV2 , CounterMetric , DrainReason , GaugeMetric ,
14+ HealthStatus , MetricsReport , ShutdownReason ,
1515} ;
16- // Import metric types directly from protocol crate
17- use sentinel_agent_protocol:: v2:: GaugeMetric ;
16+ use sentinel_agent_protocol:: { AgentResponse , EventType , RequestHeadersEvent , ResponseHeadersEvent } ;
1817use std:: collections:: HashMap ;
1918use std:: sync:: atomic:: { AtomicBool , Ordering } ;
2019use std:: sync:: Arc ;
@@ -383,22 +382,27 @@ impl Agent for ApiDeprecationAgent {
383382///
384383/// Provides capability negotiation, health reporting, metrics export,
385384/// and lifecycle management.
386- impl AgentV2 for ApiDeprecationAgent {
385+ #[ async_trait]
386+ impl AgentHandlerV2 for ApiDeprecationAgent {
387387 fn capabilities ( & self ) -> AgentCapabilities {
388388 AgentCapabilities :: new (
389389 "api-deprecation" ,
390390 "API Deprecation Agent" ,
391391 env ! ( "CARGO_PKG_VERSION" ) ,
392392 )
393- . with_streaming_body ( false )
394- . with_config_push ( true )
395- . with_health_reporting ( true )
396- . with_metrics_export ( true )
397- . with_concurrent_requests ( 100 )
398- . with_cancellation ( false )
399- . with_flow_control ( false )
400- . with_max_processing_time_ms ( 1000 )
401- . with_health_interval_ms ( 10000 )
393+ . with_event ( EventType :: RequestHeaders )
394+ . with_event ( EventType :: ResponseHeaders )
395+ . with_features ( AgentFeatures {
396+ streaming_body : false ,
397+ config_push : true ,
398+ health_reporting : true ,
399+ metrics_export : true ,
400+ concurrent_requests : 100 ,
401+ cancellation : false ,
402+ flow_control : false ,
403+ max_processing_time_ms : 1000 ,
404+ health_interval_ms : 10000 ,
405+ } )
402406 }
403407
404408 fn health_status ( & self ) -> HealthStatus {
@@ -447,7 +451,7 @@ impl AgentV2 for ApiDeprecationAgent {
447451 }
448452 }
449453
450- fn on_shutdown ( & self , reason : ShutdownReason , grace_period_ms : u64 ) {
454+ async fn on_shutdown ( & self , reason : ShutdownReason , grace_period_ms : u64 ) {
451455 info ! (
452456 ?reason,
453457 grace_period_ms,
@@ -456,7 +460,7 @@ impl AgentV2 for ApiDeprecationAgent {
456460 self . draining . store ( true , Ordering :: Relaxed ) ;
457461 }
458462
459- fn on_drain ( & self , duration_ms : u64 , reason : DrainReason ) {
463+ async fn on_drain ( & self , duration_ms : u64 , reason : DrainReason ) {
460464 info ! (
461465 ?reason,
462466 duration_ms,
0 commit comments