Skip to content

Commit

Permalink
[fix]curvefs/monitor: target_json.py
Browse files Browse the repository at this point in the history
Signed-off-by: Cyber-SiKu <[email protected]>
  • Loading branch information
Cyber-SiKu committed Oct 30, 2023
1 parent c63296b commit f9ca5d8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions curvefs/monitor/target_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,14 @@ def loadPlugin():
# load *.json file in plugin dir
# merge to one json
data = []
for filename in os.listdir(PLUGIN_PATH):
if filename.endswith('.json'):
with open(os.path.join(PLUGIN_PATH, filename)) as f:
plugin_data = json.load(f)
data.append(unitValue(plugin_data["labels"], plugin_data["targets"])
if os.path.isdir(PLUGIN_PATH):
for filename in os.listdir(PLUGIN_PATH):
if filename.endswith('.json'):
with open(os.path.join(PLUGIN_PATH, filename)) as f:
plugin_data = json.load(f)
if len(plugin_data) == 0:
continue
data.append(unitValue(plugin_data["labels"], plugin_data["targets"]))
return data

def refresh():
Expand Down

0 comments on commit f9ca5d8

Please sign in to comment.