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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/sentiero/configuration.rb', line 111

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_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
  @anonymize_ip = true
  @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.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def allow_insecure_dashboard
  @allow_insecure_dashboard
end

#analytics_max_scan_sessionsObject

Returns the value of attribute analytics_max_scan_sessions.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def analytics_max_scan_sessions
  @analytics_max_scan_sessions
end

#anonymize_ipObject

Returns the value of attribute anonymize_ip.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def anonymize_ip
  @anonymize_ip
end

#audit_logObject

Returns the value of attribute audit_log.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def audit_log
  @audit_log
end

#auth_callbackObject

Returns the value of attribute auth_callback.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def auth_callback
  @auth_callback
end

#basic_authObject

Returns the value of attribute basic_auth.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def basic_auth
  @basic_auth
end

#block_selectorObject

Returns the value of attribute block_selector.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def block_selector
  @block_selector
end

#capture_clicksObject

Returns the value of attribute capture_clicks.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def capture_clicks
  @capture_clicks
end

#capture_errorsObject

Returns the value of attribute capture_errors.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def capture_errors
  @capture_errors
end

#capture_metadataObject

Returns the value of attribute capture_metadata.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def 
  @capture_metadata
end

#capture_web_vitalsObject

Returns the value of attribute capture_web_vitals.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def capture_web_vitals
  @capture_web_vitals
end

#checkout_every_n_msObject

Returns the value of attribute checkout_every_n_ms.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def checkout_every_n_ms
  @checkout_every_n_ms
end

#cors_originsObject

Returns the value of attribute cors_origins.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def cors_origins
  @cors_origins
end

#cross_tab_sessionsObject

Returns the value of attribute cross_tab_sessions.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def cross_tab_sessions
  @cross_tab_sessions
end

#flush_event_thresholdObject

Returns the value of attribute flush_event_threshold.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def flush_event_threshold
  @flush_event_threshold
end

#flush_interval_msObject

Returns the value of attribute flush_interval_ms.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def flush_interval_ms
  @flush_interval_ms
end

#ignore_selectorObject

Returns the value of attribute ignore_selector.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def ignore_selector
  @ignore_selector
end

#ingest_keysObject

Returns the value of attribute ingest_keys.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def ingest_keys
  @ingest_keys
end

#inline_stylesheetObject

Returns the value of attribute inline_stylesheet.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def inline_stylesheet
  @inline_stylesheet
end

#mask_all_inputsObject

Returns the value of attribute mask_all_inputs.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def mask_all_inputs
  @mask_all_inputs
end

#mask_input_optionsObject

Returns the value of attribute mask_input_options.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def mask_input_options
  @mask_input_options
end

#mask_text_selectorObject

Returns the value of attribute mask_text_selector.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def mask_text_selector
  @mask_text_selector
end

#max_events_per_pageObject

Returns the value of attribute max_events_per_page.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def max_events_per_page
  @max_events_per_page
end

#max_events_per_requestObject

Returns the value of attribute max_events_per_request.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def max_events_per_request
  @max_events_per_request
end

#max_events_per_sessionObject

Returns the value of attribute max_events_per_session.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def max_events_per_session
  @max_events_per_session
end

#max_problemsObject

Returns the value of attribute max_problems.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def max_problems
  @max_problems
end

#max_server_eventsObject

Returns the value of attribute max_server_events.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def max_server_events
  @max_server_events
end

#max_sessionsObject

Returns the value of attribute max_sessions.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def max_sessions
  @max_sessions
end

Returns the value of attribute opt_out_cookie_name.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def opt_out_cookie_name
  @opt_out_cookie_name
end

#recorder_optionsObject

Returns the value of attribute recorder_options.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def recorder_options
  @recorder_options
end

#redactionObject

Returns the value of attribute redaction.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def redaction
  @redaction
end

#respect_gpcObject

Returns the value of attribute respect_gpc.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def respect_gpc
  @respect_gpc
end

#retention_periodObject

Returns the value of attribute retention_period.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def retention_period
  @retention_period
end

#samplingObject

Returns the value of attribute sampling.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

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.



55
56
57
# File 'lib/sentiero/configuration.rb', line 55

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.



55
56
57
# File 'lib/sentiero/configuration.rb', line 55

def session_max_age
  @session_max_age
end

#shareable_replaysObject

Returns the value of attribute shareable_replays.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

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.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def track_custom_events
  @track_custom_events
end

#track_formsObject

Returns the value of attribute track_forms.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def track_forms
  @track_forms
end

#track_navigationObject

Returns the value of attribute track_navigation.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def track_navigation
  @track_navigation
end

#user_opt_outObject

Returns the value of attribute user_opt_out.



7
8
9
# File 'lib/sentiero/configuration.rb', line 7

def user_opt_out
  @user_opt_out
end

Instance Method Details

#effective_recorder_optionsObject



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/sentiero/configuration.rb', line 160

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



84
85
86
87
# File 'lib/sentiero/configuration.rb', line 84

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.



79
80
81
82
# File 'lib/sentiero/configuration.rb', line 79

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