Skip to content

Commit

Permalink
implemented logged metrics and included params in error logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sri Harsha authored and Sri Harsha committed Aug 7, 2018
1 parent 66d10ef commit 362841e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions kwikapi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,14 +481,15 @@ def handle_request(self, request):
method=rinfo.method, compute_time=tcompute, serialize_time=t.value,
deserialize_time=rinfo.time_deserialize,
__params=get_loggable_params(request.fn_params or {}),
protocol=request.protocol, type='log', **request.metrics)
protocol=request.protocol, type='logged_metric', **request.metrics)

except Exception as e:
message = e.message if hasattr(e, 'message') else str(e)
message = '[(%s) %s: %s]' % (self.api._id, e.__class__.__name__, message)

_log = request.log if hasattr(request, 'log') else self.log
_log.exception('handle_request_error', message=message)
_log.exception('handle_request_error', message=message,
__params=get_loggable_params(request.fn_params or {}))
response.write(dict(success=False, message=message), protocol)

response.flush()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages

version = '0.4.0'
version = '0.4.1'
setup(
name="kwikapi",
version=version,
Expand Down

0 comments on commit 362841e

Please sign in to comment.