Class: Sentiero::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/sentiero/configuration.rb

Constant Summary collapse

ENFORCED_PRIVACY =
{
  maskInputOptions: {password: true}
}.freeze
DEFAULT_SESSION_IDLE_TIMEOUT =

Replay sessions follow a user journey, so the idle boundary is generous (a lunch break shouldn't split a journey); max age is the hard cap that keeps the identifier from living forever on never-idle tabs.

6 * 60 * 60
DEFAULT_SESSION_MAX_AGE =
7 * 24 * 60 * 60
DEFAULT_MAX_BODY_SIZE =

512 KB

524_288

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/sentiero/configuration.rb', line 137

def initialize
  @store = nil
  @cors_origins = []
  @auth_callback = nil
  @flush_interval_ms = 10_000
  @flush_event_threshold = 50
  @max_events_per_page = 1_000
  @max_body_size = DEFAULT_MAX_BODY_SIZE
  @max_problems = 5_000
  @max_server_events = 50_000
  @ingest_keys = {}
  @cross_tab_sessions = true
  @capture_metadata = false
  @capture_errors = false
  @track_navigation = false
  @track_custom_events = false
  @capture_clicks = false
  @track_forms = false

  @mask_all_inputs = true
  @mask_input_options = {}
  @block_selector = "[data-rr-block]"
  @mask_text_selector = "[data-rr-mask]"
  @ignore_selector = "[data-rr-ignore]"
  @sampling = {scroll: 150, input: "last"}
  @inline_stylesheet = nil
  @checkout_every_n_ms = nil
  @recorder_options = {}

  @capture_web_vitals = false
  @analytics_max_scan_sessions = 5000
  @user_opt_out = false
  @opt_out_cookie_name = "sentiero_optout"
  @respect_gpc = true
  @retention_period = nil
  @session_idle_timeout = DEFAULT_SESSION_IDLE_TIMEOUT
  @session_max_age = DEFAULT_SESSION_MAX_AGE
  @redaction = Sentiero::Redaction::Config.new
  @fingerprint = Sentiero::Fingerprint::Config.new
  @anonymize_ip = true
  @geo_source = nil
  @audit_log = nil
  # Opt-in: a share file is a full session dump leaving the operator's
  # infrastructure, so export/import routes 404 until explicitly enabled.
  @shareable_replays = false
  @basic_auth = nil
  # The dashboard exposes recordings/analytics, so with neither basic_auth nor
  # auth_callback set it fails closed (403). Set true to opt into serving it
  # unauthenticated (e.g. behind a trusted proxy or in local dev).
  @allow_insecure_dashboard = false
end

Instance Attribute Details

#allow_insecure_dashboardObject

Returns the value of attribute allow_insecure_dashboard.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def allow_insecure_dashboard
  @allow_insecure_dashboard
end

#analytics_max_scan_sessionsObject

Returns the value of attribute analytics_max_scan_sessions.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def analytics_max_scan_sessions
  @analytics_max_scan_sessions
end

#anonymize_ipObject

Returns the value of attribute anonymize_ip.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def anonymize_ip
  @anonymize_ip
end

#audit_logObject

Returns the value of attribute audit_log.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def audit_log
  @audit_log
end

#auth_callbackObject

Returns the value of attribute auth_callback.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def auth_callback
  @auth_callback
end

#basic_authObject

Returns the value of attribute basic_auth.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def basic_auth
  @basic_auth
end

#block_selectorObject

Returns the value of attribute block_selector.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def block_selector
  @block_selector
end

#capture_clicksObject

Returns the value of attribute capture_clicks.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def capture_clicks
  @capture_clicks
end

#capture_errorsObject

Returns the value of attribute capture_errors.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def capture_errors
  @capture_errors
end

#capture_metadataObject

Returns the value of attribute capture_metadata.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def 
  @capture_metadata
end

#capture_web_vitalsObject

Returns the value of attribute capture_web_vitals.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def capture_web_vitals
  @capture_web_vitals
end

#checkout_every_n_msObject

Returns the value of attribute checkout_every_n_ms.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def checkout_every_n_ms
  @checkout_every_n_ms
end

#cors_originsObject

Returns the value of attribute cors_origins.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def cors_origins
  @cors_origins
end

#cross_tab_sessionsObject

Returns the value of attribute cross_tab_sessions.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def cross_tab_sessions
  @cross_tab_sessions
end

#fingerprintObject (readonly)

Reader-only: mutate via #register / #default_platform=, not by replacing the whole object.



9
10
11
# File 'lib/sentiero/configuration.rb', line 9

def fingerprint
  @fingerprint
end

#flush_event_thresholdObject

Returns the value of attribute flush_event_threshold.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def flush_event_threshold
  @flush_event_threshold
end

#flush_interval_msObject

Returns the value of attribute flush_interval_ms.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def flush_interval_ms
  @flush_interval_ms
end

#geo_sourceObject

Geo headers are trivially spoofable unless actually behind the CDN, so trusting them is an explicit opt-in.



65
66
67
# File 'lib/sentiero/configuration.rb', line 65

def geo_source
  @geo_source
end

#ignore_selectorObject

Returns the value of attribute ignore_selector.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def ignore_selector
  @ignore_selector
end

#ingest_keysObject

Returns the value of attribute ingest_keys.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def ingest_keys
  @ingest_keys
end

#inline_stylesheetObject

Returns the value of attribute inline_stylesheet.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def inline_stylesheet
  @inline_stylesheet
end

#mask_all_inputsObject

Returns the value of attribute mask_all_inputs.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def mask_all_inputs
  @mask_all_inputs
end

#mask_input_optionsObject

Returns the value of attribute mask_input_options.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def mask_input_options
  @mask_input_options
end

#mask_text_selectorObject

Returns the value of attribute mask_text_selector.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def mask_text_selector
  @mask_text_selector
end

#max_body_sizeObject

Returns the value of attribute max_body_size.



61
62
63
# File 'lib/sentiero/configuration.rb', line 61

def max_body_size
  @max_body_size
end

#max_events_per_pageObject

Returns the value of attribute max_events_per_page.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def max_events_per_page
  @max_events_per_page
end

#max_events_per_requestObject

Returns the value of attribute max_events_per_request.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def max_events_per_request
  @max_events_per_request
end

#max_events_per_sessionObject

Returns the value of attribute max_events_per_session.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def max_events_per_session
  @max_events_per_session
end

#max_problemsObject

Returns the value of attribute max_problems.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def max_problems
  @max_problems
end

#max_server_eventsObject

Returns the value of attribute max_server_events.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def max_server_events
  @max_server_events
end

#max_sessionsObject

Returns the value of attribute max_sessions.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def max_sessions
  @max_sessions
end

Returns the value of attribute opt_out_cookie_name.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def opt_out_cookie_name
  @opt_out_cookie_name
end

#recorder_optionsObject

Returns the value of attribute recorder_options.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def recorder_options
  @recorder_options
end

#redactionObject

Returns the value of attribute redaction.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def redaction
  @redaction
end

#respect_gpcObject

Returns the value of attribute respect_gpc.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def respect_gpc
  @respect_gpc
end

#retention_periodObject

Returns the value of attribute retention_period.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def retention_period
  @retention_period
end

#samplingObject

Returns the value of attribute sampling.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def sampling
  @sampling
end

#session_idle_timeoutObject

session_idle_timeout / session_max_age have validating writers below (a bad value here is serialized straight into client-side session-rotation logic), so they're declared separately from the plain attr_accessor list.



59
60
61
# File 'lib/sentiero/configuration.rb', line 59

def session_idle_timeout
  @session_idle_timeout
end

#session_max_ageObject

session_idle_timeout / session_max_age have validating writers below (a bad value here is serialized straight into client-side session-rotation logic), so they're declared separately from the plain attr_accessor list.



59
60
61
# File 'lib/sentiero/configuration.rb', line 59

def session_max_age
  @session_max_age
end

#shareable_replaysObject

Returns the value of attribute shareable_replays.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def shareable_replays
  @shareable_replays
end

#storeObject

Returns the value of attribute store.



5
6
7
# File 'lib/sentiero/configuration.rb', line 5

def store
  @store
end

#track_custom_eventsObject

Returns the value of attribute track_custom_events.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def track_custom_events
  @track_custom_events
end

#track_formsObject

Returns the value of attribute track_forms.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def track_forms
  @track_forms
end

#track_navigationObject

Returns the value of attribute track_navigation.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def track_navigation
  @track_navigation
end

#user_opt_outObject

Returns the value of attribute user_opt_out.



11
12
13
# File 'lib/sentiero/configuration.rb', line 11

def user_opt_out
  @user_opt_out
end

Instance Method Details

#effective_recorder_optionsObject



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/sentiero/configuration.rb', line 189

def effective_recorder_options
  first_class = {
    maskAllInputs: mask_all_inputs,
    maskInputOptions: mask_input_options,
    blockSelector: block_selector,
    maskTextSelector: mask_text_selector,
    ignoreSelector: ignore_selector,
    sampling: sampling
  }

  first_class[:inlineStylesheet] = inline_stylesheet unless inline_stylesheet.nil?
  first_class[:checkoutEveryNms] = checkout_every_n_ms unless checkout_every_n_ms.nil?

  recorder_options
    .merge(first_class)
    .merge(ENFORCED_PRIVACY) { |_key, existing, enforced|
      if enforced.is_a?(Hash)
        (existing.is_a?(Hash) ? existing : {}).merge(enforced)
      else
        enforced
      end
    }
end

#railsObject



95
96
97
98
# File 'lib/sentiero/configuration.rb', line 95

def rails
  require_subsystem!("Sentiero::Rails", "the sentiero-rails gem")
  Rails.configuration
end

#reporterObject

Reach the Rails / Reporter config from the one core object, e.g. Sentiero.configure { |c| c.reporter.endpoint = "..." }. They remain separate instances so the reporter stays usable as a standalone client.



90
91
92
93
# File 'lib/sentiero/configuration.rb', line 90

def reporter
  require_subsystem!("Sentiero::Reporter", 'require "sentiero/reporter"')
  Reporter.configuration
end