Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix]curvefs/monitor: target_json.py #2849

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[fix]curvefs/monitor: target_json.py
Signed-off-by: Cyber-SiKu <Cyber-SiKu@outlook.com>
Cyber-SiKu committed Oct 27, 2023
commit 1223e4520c7dd0ba2a6188b26dc200d5a5b8e988
13 changes: 8 additions & 5 deletions curvefs/monitor/target_json.py
Original file line number Diff line number Diff line change
@@ -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():