Added function to read metrics data.
Change-Id: I7f02eab917e3838e50600d6eeaa1027186fdfef9
Issue-ID: NONRTRIC-154
Signed-off-by: BjornMagnussonXA <bjorn.magnusson@est.tech>
policy_status[policyId] = ps
return("Status updated for policy: " + policyId, 200)
policy_status[policyId] = ps
return("Status updated for policy: " + policyId, 200)
+#Metrics function
+
+@app.route('/counter/<string:countername>', methods=['GET'])
+def getCounter(countername):
+ if (countername == "num_instances"):
+ return str(len(policy_instances)),200
+ elif (countername == "num_types"):
+ return str(len(policy_types)),200
+ else:
+ return "Counter name: "+countername+" not found.",404
+
+
port_number = 8085
if len(sys.argv) >= 2:
if isinstance(sys.argv[1], int):
port_number = 8085
if len(sys.argv) >= 2:
if isinstance(sys.argv[1], int):