mirror of
https://github.com/Bryanthelol/namekoplus
synced 2025-07-07 03:20:43 +08:00
feat: add metrics for nameko services 4
This commit is contained in:
parent
c6c5289e44
commit
c50e53ad53
@ -330,6 +330,7 @@ def metric_config_gen(module, class_name_str):
|
|||||||
dest_dir = module.split('.')[0]
|
dest_dir = module.split('.')[0]
|
||||||
file_name = module.split('.')[-1]
|
file_name = module.split('.')[-1]
|
||||||
_module = __import__(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)
|
||||||
@ -346,6 +347,7 @@ def metric_config_gen(module, class_name_str):
|
|||||||
})
|
})
|
||||||
|
|
||||||
# Generate one file of statsd config yaml for statsd exporter
|
# Generate one file of statsd config yaml for statsd exporter
|
||||||
|
with status(f'Creating statsd_mapping.yml'):
|
||||||
metric_configs_dir = os.path.join(get_directory('chassis-agent'), 'metric-configs')
|
metric_configs_dir = os.path.join(get_directory('chassis-agent'), 'metric-configs')
|
||||||
template_file_path = os.path.join(metric_configs_dir, 'statsd_mapping.yml.mako')
|
template_file_path = os.path.join(metric_configs_dir, 'statsd_mapping.yml.mako')
|
||||||
output_file = os.path.join('.', 'statsd_mapping.yml')
|
output_file = os.path.join('.', 'statsd_mapping.yml')
|
||||||
@ -357,6 +359,7 @@ def metric_config_gen(module, class_name_str):
|
|||||||
with status(f'Creating directory {os.path.abspath("grafana_dashboards")!r}'):
|
with status(f'Creating directory {os.path.abspath("grafana_dashboards")!r}'):
|
||||||
os.makedirs('grafana_dashboards')
|
os.makedirs('grafana_dashboards')
|
||||||
|
|
||||||
|
with status(f'Creating files of Grafana.json into the directory of grafana_dashboards'):
|
||||||
for class_name in class_name_str.split(','):
|
for class_name in class_name_str.split(','):
|
||||||
grafana_list = []
|
grafana_list = []
|
||||||
for config in config_list:
|
for config in config_list:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user