diff options
author | asteroide <thomas.duval@orange.com> | 2017-06-16 10:05:27 +0200 |
---|---|---|
committer | asteroide <thomas.duval@orange.com> | 2017-06-16 10:05:27 +0200 |
commit | c25a7ed290780368f1e8a68fa047b8618d794bb3 (patch) | |
tree | d12a834251e85ac0f7a557c3f9a0c2ccaf8615f6 | |
parent | 170dab6c6c42f4edad70eddac81372a0a37a25f3 (diff) |
Add timestamps in request results for evaluation
Change-Id: I130855cec8a6e4559a93d0f86507216c99099182
-rw-r--r-- | moonv4/moon_interface/moon_interface/api/authz.py | 8 |
1 files changed, 6 insertions, 2 deletions
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 |