Sha256: 54b6f3e82f5b9a67c452112f6a9850b8f404a17499dd4983abdd544035cd0850
Contents?: true
Size: 703 Bytes
Versions: 16
Compression:
Stored size: 703 Bytes
Contents
# Copyright (c) 2015 Sqreen. All Rights Reserved. # Please refer to our terms for more information: https://www.sqreen.io/terms.html require 'sqreen/rules_callbacks/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, &_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) nil end end end end
Version data entries
16 entries across 16 versions & 1 rubygems