Sha256: bfebddba596f4457287e898b5b47a31283f6e1ed2c4561404a67652ffe14b9d1
Contents?: true
Size: 723 Bytes
Versions: 9
Compression:
Stored size: 723 Bytes
Contents
# Copyright (c) 2015 Sqreen. All Rights Reserved. # Please refer to our terms for more information: https://www.sqreen.com/terms.html require 'sqreen/rules/matcher_rule' require 'sqreen/frameworks' module Sqreen module Rules # Look for crawlers and post them in metrics class CrawlerUserAgentMatchesMetricsCB < MatcherRuleCB CRAWLER_CATEGORY = 'crawler'.freeze def pre(_inst, _args, _budget = nil, &_block) ua = framework.client_user_agent return unless ua found = match(ua) return unless found Sqreen.log.debug { "Found UA #{ua} - found: #{found}" } record_observation(CRAWLER_CATEGORY, ua, 1) advise_action(nil) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems