@@ -973,7 +973,8 @@ def get_valid_check_class(check_name, check_path):
973973 return True , check_class , {}
974974
975975
976- def _initialize_check (check_config , check_name , check_class , agentConfig , manifest_path ):
976+ def _initialize_check (check_config , check_name , check_class , agentConfig ,
977+ manifest_path , version_override = None ):
977978 init_config = check_config .get ('init_config' ) or {}
978979 instances = check_config ['instances' ]
979980 try :
@@ -989,14 +990,20 @@ def _initialize_check(check_config, check_name, check_class, agentConfig, manife
989990
990991 if manifest_path :
991992 check .set_manifest_path (manifest_path )
992- check .set_check_version (load_manifest (manifest_path ))
993+
994+ if not version_override :
995+ check .set_check_version (manifest = load_manifest (manifest_path ))
996+ else :
997+ check .set_check_version (version = version_override )
993998 except Exception as e :
994999 log .exception ('Unable to initialize check %s' % check_name )
9951000 traceback_message = traceback .format_exc ()
9961001 manifest = load_manifest (manifest_path )
9971002 if manifest is not None :
9981003 check_version = '{core}:{vers}' .format (core = AGENT_VERSION ,
9991004 vers = manifest .get ('version' , 'unknown' ))
1005+ elif version_override :
1006+ check_version = version_override
10001007 else :
10011008 check_version = AGENT_VERSION
10021009
@@ -1066,8 +1073,13 @@ def load_check_from_places(check_config, check_name, checks_places, agentConfig)
10661073 log .warn ("The SDK check (%s) was designed for a different agent core "
10671074 "or couldnt be validated - behavior is undefined" % check_name )
10681075
1076+ version_override = None
1077+ if not manifest_path and agentConfig ['additional_checksd' ] in check_path :
1078+ version_override = 'custom' # custom check
1079+
1080+
10691081 load_success , load_failure = _initialize_check (
1070- check_config , check_name , check_class , agentConfig , manifest_path
1082+ check_config , check_name , check_class , agentConfig , manifest_path , version_override
10711083 )
10721084
10731085 _update_python_path (check_config )
0 commit comments