Skip to content

Commit 995c53b

Browse files
committed
constantize sampling percentages and nonce fallback
1 parent d0813d1 commit 995c53b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/dial/configuration.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ def self._configuration
1212
class Configuration
1313
def initialize
1414
@options = {
15-
sampling_percentage: ::Rails.env.development? ? 100 : 1,
16-
content_security_policy_nonce: -> (env, _headers) { env[NONCE] || "" },
15+
sampling_percentage: ::Rails.env.development? ? SAMPLING_PERCENTAGE_DEV : SAMPLING_PERCENTAGE_PROD,
16+
content_security_policy_nonce: -> (env, _headers) { env[NONCE] || EMPTY_NONCE },
1717
vernier_interval: VERNIER_INTERVAL,
1818
vernier_allocation_interval: VERNIER_ALLOCATION_INTERVAL,
1919
prosopite_ignore_queries: PROSOPITE_IGNORE_QUERIES,

lib/dial/constants.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ module Dial
1818

1919
FILE_STALE_SECONDS = 60 * 60
2020

21+
SAMPLING_PERCENTAGE_DEV = 100
22+
SAMPLING_PERCENTAGE_PROD = 1
23+
EMPTY_NONCE = ""
24+
2125
VERNIER_INTERVAL = 200
2226
VERNIER_ALLOCATION_INTERVAL = 2_000
2327
VERNIER_PROFILE_OUT_RELATIVE_DIRNAME = "tmp/dial/profiles"

0 commit comments

Comments
 (0)