@app.route("/stats", methods=["GET"])
def stats():
try:
- stats = r.get("stats")
+ stats = r.scan_iter()
if stats is None:
app.logger.debug("Uninitialized stats object")
return {}
- return r.get("stats")
+ return {"stats": [{stat: r.get(stat)} for stat in stats]}
except redis.exceptions.ConnectionError as e:
app.logger.exception(e)
return Response("Internal Server Error", 500)
return {}
-@app.route("/api/", methods=["GET"])
-def api():
- return {"req": request.values}
+@app.route("/api/<path:subpath>", methods=["GET"])
+def api(subpath):
+ app.logger.debug("subpath %s", subpath)
+ hits = r.incr(f"hits:{subpath}")
+ return {"hits": hits}
def main():