Sha256: 93adcd4adec88dde63c944b5908140b289703d961d15f76c96afe1b8b1c44cae
Contents?: true
Size: 1.47 KB
Versions: 6
Compression:
Stored size: 1.47 KB
Contents
# Copyright (c) 2015 Sqreen. All Rights Reserved. # Please refer to our terms for more information: https://www.sqreen.io/terms.html require 'sqreen/rule_callback' module Sqreen module Rules # Save request context for handling further down class RecordRequestContext < RuleCB WHITELISTED_METRIC = 'whitelisted'.freeze def initialize(*args) super(*args) @overtimeable = false end def whitelisted? false end def pre(_inst, args, _budget = nil, &_block) Sqreen.log.debug { "RecordRequestContext pre args: #{args.inspect}" } framework.store_request(args[0]) wh = framework.whitelisted_match if wh unless Sqreen.features.key?('whitelisted_metric') && !Sqreen.features['whitelisted_metric'] record_observation(WHITELISTED_METRIC, wh, 1) end Sqreen.log.debug { "Request was whitelisted because of #{wh}" } end advise_action(nil) end def post(rv, _inst, args, _budget = nil, &_block) Sqreen.log.debug { "RecordRequestContext post args: #{args.inspect}" } framework.store_response(rv, args[0]) framework.clean_request advise_action(nil) end def failing(_exception, _inst, args, _budget = nil, &_block) Sqreen.log.debug { "RecordRequestContext failing args: #{args.inspect}" } framework.clean_request advise_action(nil) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems