Class: RubyZipkin::TraceFilter
- Inherits:
-
Object
- Object
- RubyZipkin::TraceFilter
- Defined in:
- lib/rubyzipkin/trace_filter.rb
Class Method Summary collapse
-
.KeywordFilterMatches?(keyword, keyword_blacklist = []) ⇒ Boolean
Filter a string based on a keyword blacklist Meant to define if a key should be traced or not.
-
.UriFilterMatches?(uri, keyword_blacklist = []) ⇒ Boolean
Filter uri’s from being traced based on their type or a keyword listed in the blacklist Known static content requests like fonts are filtered as well.
-
.UriSamplingMatches?(uri, uri_hash = {}) ⇒ Boolean
Matcher to get a custom sample rate for a specific URI paths.
Class Method Details
.KeywordFilterMatches?(keyword, keyword_blacklist = []) ⇒ Boolean
Filter a string based on a keyword blacklist Meant to define if a key should be traced or not.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/rubyzipkin/trace_filter.rb', line 38 def self.KeywordFilterMatches?(keyword, keyword_blacklist = []) #exclude static content requests keyword_blacklist.each do |blacklisted| if keyword.to_s.match(/.*(#{blacklisted}).*/) return true end end PermanentFilter::HEADERS.each do |blacklisted| if keyword.to_s.match(/.*(#{blacklisted}).*/) return true end end false end |
.UriFilterMatches?(uri, keyword_blacklist = []) ⇒ Boolean
Filter uri’s from being traced based on their type or a keyword listed in the blacklist Known static content requests like fonts are filtered as well
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rubyzipkin/trace_filter.rb', line 8 def self.UriFilterMatches?(uri, keyword_blacklist = []) #exclude static content requests if uri.to_s.match(/.*(\.svg)|(\.ttf)|(\.ott)|(\.woff)/) return true end keyword_blacklist.each do |key| if uri.to_s.match(key) return true end end return false end |
.UriSamplingMatches?(uri, uri_hash = {}) ⇒ Boolean
Matcher to get a custom sample rate for a specific URI paths. returns the sample rate or nil
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rubyzipkin/trace_filter.rb', line 25 def self.UriSamplingMatches?(uri, uri_hash = {}) uri_hash.each do |key, value| if uri.to_s.match key return value end end return nil end |