store hashes, not json strings
This commit is contained in:
parent
23f80ea9b7
commit
d631a30be4
@ -36,8 +36,16 @@ module Devops
|
|||||||
# Save information about requests with methods POST, PUT, DELETE
|
# Save information about requests with methods POST, PUT, DELETE
|
||||||
def insert_statistic msg=nil
|
def insert_statistic msg=nil
|
||||||
unless request.get?
|
unless request.get?
|
||||||
|
# parse body
|
||||||
request.body.rewind
|
request.body.rewind
|
||||||
body = request.body.read
|
raw_body = request.body.read
|
||||||
|
body = begin
|
||||||
|
::JSON.parse(raw_body)
|
||||||
|
rescue ::JSON::ParserError
|
||||||
|
raw_body
|
||||||
|
end
|
||||||
|
|
||||||
|
# store statistic
|
||||||
settings.mongo.insert_statistic request.env['REMOTE_USER'], request.path, request.request_method, body, response.status
|
settings.mongo.insert_statistic request.env['REMOTE_USER'], request.path, request.request_method, body, response.status
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user