Class: RubyZipkin::TraceSampler

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-zipkin/tracesampler.rb

Class Method Summary collapse

Class Method Details

.request_sample_rate(request) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/ruby-zipkin/tracesampler.rb', line 5

def self.request_sample_rate(request)

  if request[RubyZipkin::ZipkinTraceHeader::FORCE_SAMPLE]
    #filter is matched in the request, thus ensure not fitereed by returning 100% tracing (unsampled)
    if request.body.matches(filter)
      return 1
    end
  end
  return 0.01
end