Browse Source

fix api bug, query metrics from server when add/update strategy.

https://github.com/open-falcon/dashboard/issues/90
laiwei 6 years ago
parent
commit
bce66ef1e5
1 changed files with 3 additions and 2 deletions
  1. 3 2
      rrd/view/portal/api.py

+ 3 - 2
rrd/view/portal/api.py

@@ -128,9 +128,10 @@ def api_metric_query():
         return []
 
     metrics = r.json() or []
-    metrics = [q,] + metrics
+    matched_metrics = [x for x in metrics if q in x]
+    ret_data = [q,] + matched_metrics[:limit]
 
-    return jsonify(data=[{'name': name} for name in metrics])
+    return jsonify(data=[{'name': name} for name in ret_data])
 
 
 # 给ping监控提供的接口