Compare commits

..

2 Commits

Author SHA1 Message Date
BryantHe e389125b10 feat: add metrics for nameko services 2 2023-07-27 18:15:26 +08:00
BryantHe ba7cc886e7 feat: add metrics for nameko services 2023-07-27 17:49:30 +08:00
1 changed files with 2 additions and 2 deletions

View File

@ -319,13 +319,13 @@ def metric_config_gen(module, class_name_str):
""" """
import sys import sys
from statsd.client.timer import Timer from statsd.client.timer import Timer
sys.path.append('/home/ubuntu/namekoplus-examples') sys.path.append(os.getcwd())
click.echo(f'sys.path: {sys.path}') click.echo(f'sys.path: {sys.path}')
# Extract information of statsd config from the class of nameko service # Extract information of statsd config from the class of nameko service
dest_dir = module.split('.')[0] dest_dir = module.split('.')[0]
file_name = module.split('.')[-1] file_name = module.split('.')[-1]
_module = importlib.import_module(module) _module = __import__(module)
config_list = [] config_list = []
for class_name in class_name_str.split(','): for class_name in class_name_str.split(','):
members = inspect.getmembers(getattr(getattr(_module, file_name), class_name), predicate=inspect.isfunction) members = inspect.getmembers(getattr(getattr(_module, file_name), class_name), predicate=inspect.isfunction)