Method: Datadog::Sampling::TokenBucket#effective_rate

Defined in:
lib/ddtrace/sampling/rate_limiter.rb

#effective_rateFloat

Ratio of ‘conformance’ per ‘total messages’ checked on this bucket.

Returns 1.0 when no messages have been checked yet.

Returns:

  • (Float)

    Conformance ratio, between [0,1]



76
77
78
79
80
81
# File 'lib/ddtrace/sampling/rate_limiter.rb', line 76

def effective_rate
  return 0.0 if @rate.zero?
  return 1.0 if @rate < 0 || @total_messages.zero?

  @conforming_messages.to_f / @total_messages
end