From 79b00d4960a8438ea656e7ca86f99a545dd2f667 Mon Sep 17 00:00:00 2001 From: Molly Struve Date: Tue, 1 Sep 2020 15:21:07 -0500 Subject: [PATCH] [deploy] Optimization:Throttle Noisy Honeycomb Events More (#10143) --- app/lib/honeycomb/noise_cancelling_sampler.rb | 8 ++++---- spec/lib/honeycomb/noise_cancelling_sampler_spec.rb | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/lib/honeycomb/noise_cancelling_sampler.rb b/app/lib/honeycomb/noise_cancelling_sampler.rb index eda2c9f27..829853786 100644 --- a/app/lib/honeycomb/noise_cancelling_sampler.rb +++ b/app/lib/honeycomb/noise_cancelling_sampler.rb @@ -25,14 +25,14 @@ module Honeycomb # should_sample is a no-op if the rate is 1 if fields["redis.command"].in? NOISY_REDIS_COMMANDS - rate = 100 + rate = 300 elsif fields["sql.active_record.sql"].in? NOISY_SQL_COMMANDS - rate = 100 + rate = 300 elsif fields["redis.command"]&.start_with?("BRPOP") # BRPOP is disproportionately noisy and not really interesting - rate = 1000 + rate = 5000 elsif fields["redis.command"]&.start_with?(*NOISY_REDIS_PREFIXES) - rate = 100 + rate = 300 end [should_sample(rate, fields["trace.trace_id"]), rate] end diff --git a/spec/lib/honeycomb/noise_cancelling_sampler_spec.rb b/spec/lib/honeycomb/noise_cancelling_sampler_spec.rb index 3359546ba..4ec46f880 100644 --- a/spec/lib/honeycomb/noise_cancelling_sampler_spec.rb +++ b/spec/lib/honeycomb/noise_cancelling_sampler_spec.rb @@ -14,34 +14,34 @@ RSpec.describe Honeycomb::NoiseCancellingSampler do it "samples if its in NOISY_REDIS_COMMANDS" do is_sampled, rate = described_class.sample({ "redis.command" => "TIME", "trace.trace_id" => trace_id }) expect(is_sampled).to be_in [true, false] - expect(rate).to match(100) + expect(rate).to match(300) end it "samples if the command is BRPOP" do is_sampled, rate = described_class.sample({ "redis.command" => "BRPOP", "trace.trace_id" => trace_id }) expect(is_sampled).to be_in [true, false] - expect(rate).to match(1000) + expect(rate).to match(5000) end it "samples if the command starts with TTL" do is_sampled, rate = described_class.sample({ "redis.command" => "TTL this and that", "trace.trace_id" => trace_id }) expect(is_sampled).to be_in [true, false] - expect(rate).to match(100) + expect(rate).to match(300) end it "samples if the command starts with GET rack:" do is_sampled, rate = described_class.sample({ "redis.command" => "GET rack::something", "trace.trace_id" => trace_id }) expect(is_sampled).to be_in [true, false] - expect(rate).to match(100) + expect(rate).to match(300) end it "samples if the command starts with SET rack:" do is_sampled, rate = described_class.sample({ "redis.command" => "SET rack::something", "trace.trace_id" => trace_id }) expect(is_sampled).to be_in [true, false] - expect(rate).to match(100) + expect(rate).to match(300) end end @@ -49,7 +49,7 @@ RSpec.describe Honeycomb::NoiseCancellingSampler do it "samples if its in NOISY_SQL_COMMANDS" do is_sampled, rate = described_class.sample({ "sql.active_record.sql" => "COMMIT", "trace.trace_id" => trace_id }) expect(is_sampled).to be_in [true, false] - expect(rate).to match(100) + expect(rate).to match(300) end end end