lib/sqreen/callbacks.rb in sqreen-1.15.1 vs lib/sqreen/callbacks.rb in sqreen-1.15.2
- old
+ new
@@ -125,50 +125,16 @@
whitelisted = SharedStorage.get(:whitelisted)
return whitelisted unless whitelisted.nil?
framework && !framework.whitelisted_match.nil?
end
- # Record an attack event into Sqreen system
- # @param infos [Hash] Additional information about request
- def record_event(infos, at = Time.now.utc)
- return unless framework
- payload = {
- :infos => infos,
- :rulespack_id => rulespack_id,
- :rule_name => rule_name,
- :test => test,
- :time => at,
- }
- if payload_tpl.include?('context')
- payload[:backtrace] = Sqreen::Context.new.bt
- end
- framework.observe(:attacks, payload, payload_tpl)
- end
-
# Record a metric observation
# @param category [String] Name of the metric observed
# @param key [String] aggregation key
# @param observation [Object] data observed
# @param at [Time] time when observation was made
def record_observation(category, key, observation, at = Time.now.utc)
return unless framework
framework.observe(:observations, [category, key, observation, at], [], false)
- end
-
- # Record an exception that just occurred
- # @param exception [Exception] Exception to send over
- # @param infos [Hash] Additional contextual information
- def record_exception(exception, infos = {}, at = Time.now.utc)
- return unless framework
- payload = {
- :exception => exception,
- :infos => infos,
- :rulespack_id => rulespack_id,
- :rule_name => rule_name,
- :test => test,
- :time => at,
- :backtrace => exception.backtrace || Sqreen::Context.bt,
- }
- framework.observe(:sqreen_exceptions, payload)
end
end
end