3737
3838from boto3 import Session
3939
40+ from aws_advanced_python_wrapper .pep249_methods import DbApiMethod
4041from aws_advanced_python_wrapper .plugin import Plugin , PluginFactory
4142from aws_advanced_python_wrapper .utils .log import Logger
4243from aws_advanced_python_wrapper .utils .properties import WrapperProperties
@@ -194,7 +195,9 @@ def _run(self):
194195 self ._custom_endpoint_host_info .host ,
195196 endpoint_info ,
196197 CustomEndpointMonitor ._CUSTOM_ENDPOINT_INFO_EXPIRATION_NS )
197- self ._info_changed_counter .inc ()
198+
199+ if self ._info_changed_counter is not None :
200+ self ._info_changed_counter .inc ()
198201
199202 elapsed_time = perf_counter_ns () - start_ns
200203 sleep_duration = max (0 , self ._refresh_rate_ns - elapsed_time )
@@ -228,7 +231,7 @@ class CustomEndpointPlugin(Plugin):
228231 A plugin that analyzes custom endpoints for custom endpoint information and custom endpoint changes, such as adding
229232 or removing an instance in the custom endpoint.
230233 """
231- _SUBSCRIBED_METHODS : ClassVar [Set [str ]] = {"connect" }
234+ _SUBSCRIBED_METHODS : ClassVar [Set [str ]] = {DbApiMethod . CONNECT . method_name }
232235 _CACHE_CLEANUP_RATE_NS : ClassVar [int ] = 6 * 10 ^ 10 # 1 minute
233236 _monitors : ClassVar [SlidingExpirationCacheWithCleanupThread [str , CustomEndpointMonitor ]] = \
234237 SlidingExpirationCacheWithCleanupThread (_CACHE_CLEANUP_RATE_NS ,
@@ -250,7 +253,7 @@ def __init__(self, plugin_service: PluginService, props: Properties):
250253 self ._custom_endpoint_host_info : Optional [HostInfo ] = None
251254 self ._custom_endpoint_id : Optional [str ] = None
252255 telemetry_factory : TelemetryFactory = self ._plugin_service .get_telemetry_factory ()
253- self ._wait_for_info_counter : TelemetryCounter = telemetry_factory .create_counter ("customEndpoint.waitForInfo.counter" )
256+ self ._wait_for_info_counter : TelemetryCounter | None = telemetry_factory .create_counter ("customEndpoint.waitForInfo.counter" )
254257
255258 CustomEndpointPlugin ._SUBSCRIBED_METHODS .update (self ._plugin_service .network_bound_methods )
256259
@@ -312,7 +315,8 @@ def _wait_for_info(self, monitor: CustomEndpointMonitor):
312315 if has_info :
313316 return
314317
315- self ._wait_for_info_counter .inc ()
318+ if self ._wait_for_info_counter is not None :
319+ self ._wait_for_info_counter .inc ()
316320 host_info = cast ('HostInfo' , self ._custom_endpoint_host_info )
317321 hostname = host_info .host
318322 logger .debug ("CustomEndpointPlugin.WaitingForCustomEndpointInfo" , hostname , self ._wait_for_info_timeout_ms )
@@ -343,5 +347,6 @@ def execute(self, target: type, method_name: str, execute_func: Callable, *args:
343347
344348
345349class CustomEndpointPluginFactory (PluginFactory ):
346- def get_instance (self , plugin_service : PluginService , props : Properties ) -> Plugin :
350+ @staticmethod
351+ def get_instance (plugin_service : PluginService , props : Properties ) -> Plugin :
347352 return CustomEndpointPlugin (plugin_service , props )
0 commit comments