From c25a7ed290780368f1e8a68fa047b8618d794bb3 Mon Sep 17 00:00:00 2001 From: asteroide Date: Fri, 16 Jun 2017 10:05:27 +0200 Subject: Add timestamps in request results for evaluation Change-Id: I130855cec8a6e4559a93d0f86507216c99099182 --- moonv4/moon_interface/moon_interface/api/authz.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'moonv4/moon_interface') diff --git a/moonv4/moon_interface/moon_interface/api/authz.py b/moonv4/moon_interface/moon_interface/api/authz.py index 5224f762..d5242869 100644 --- a/moonv4/moon_interface/moon_interface/api/authz.py +++ b/moonv4/moon_interface/moon_interface/api/authz.py @@ -7,6 +7,7 @@ Authz is the endpoint to get authorization response """ from uuid import uuid4 +import time from flask_restful import Resource from oslo_config import cfg from oslo_log import log as logging @@ -55,7 +56,8 @@ class Authz(Resource): """ # Note (asteroide): user_id default to admin to be able to read the database # it would be better to have a read-only user. - return call("security_router", ctx={"id": uuid, + start_time = time.time() + result = call("security_router", ctx={"id": uuid, "call_master": False, "method": "authz", "subject_name": subject_name, @@ -63,4 +65,6 @@ class Authz(Resource): "action_name": action_name, "user_id": "admin", "request_id": uuid4().hex}, args={}) - + end_time = time.time() + result['time'] = {"start": start_time, "end": end_time} + return result -- cgit 1.2.3-korg