Class: DebugBundle::Config
- Inherits:
-
Object
- Object
- DebugBundle::Config
- Defined in:
- lib/debugbundle/config.rb
Constant Summary collapse
- DEFAULT_ENDPOINT =
'https://api.debugbundle.com/v1/events'- DEFAULT_PROJECT_MODE =
:connected- DEFAULT_BATCH_SIZE =
25- DEFAULT_FLUSH_INTERVAL =
5- DEFAULT_SAMPLE_RATE =
1.0- DEFAULT_LOG_LEVEL =
:warning- DEFAULT_LOCAL_EVENTS_DIR =
'.debugbundle/local/events'- DEFAULT_SPOOL_DIR =
'.debugbundle/local/browser-relay-spool'- DEFAULT_RELAY_RATE_LIMIT_PER_MINUTE =
60- DEFAULT_MAX_PROBE_LABELS =
50- DEFAULT_MAX_PROBE_ENTRIES_PER_LABEL =
10- DEFAULT_PROBE_FLUSH_ON_ERROR =
true- DEFAULT_PROBES_POLL_INTERVAL =
60- DEFAULT_REDACT_FIELDS =
[].freeze
- VALID_PROJECT_MODES =
%i[connected local_only].freeze
- VALID_STATUSES =
%i[healthy degraded disconnected].freeze
Instance Attribute Summary collapse
-
#batch_size ⇒ Object
readonly
Returns the value of attribute batch_size.
-
#enabled ⇒ Object
readonly
Returns the value of attribute enabled.
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#flush_interval ⇒ Object
readonly
Returns the value of attribute flush_interval.
-
#local_events_dir ⇒ Object
readonly
Returns the value of attribute local_events_dir.
-
#log_level ⇒ Object
readonly
Returns the value of attribute log_level.
-
#max_probe_entries_per_label ⇒ Object
readonly
Returns the value of attribute max_probe_entries_per_label.
-
#max_probe_labels ⇒ Object
readonly
Returns the value of attribute max_probe_labels.
-
#probe_flush_on_error ⇒ Object
readonly
Returns the value of attribute probe_flush_on_error.
-
#probes_poll_interval ⇒ Object
readonly
Returns the value of attribute probes_poll_interval.
-
#project_mode ⇒ Object
readonly
Returns the value of attribute project_mode.
-
#project_token ⇒ Object
readonly
Returns the value of attribute project_token.
-
#redact_fields ⇒ Object
readonly
Returns the value of attribute redact_fields.
-
#relay_durable_write ⇒ Object
readonly
Returns the value of attribute relay_durable_write.
-
#relay_enabled ⇒ Object
readonly
Returns the value of attribute relay_enabled.
-
#relay_rate_limit_per_minute ⇒ Object
readonly
Returns the value of attribute relay_rate_limit_per_minute.
-
#sample_rate ⇒ Object
readonly
Returns the value of attribute sample_rate.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#spool_dir ⇒ Object
readonly
Returns the value of attribute spool_dir.
Instance Method Summary collapse
- #configured? ⇒ Boolean
- #enabled? ⇒ Boolean
-
#initialize(project_token: nil, enabled: true, environment: nil, service: nil, endpoint: DEFAULT_ENDPOINT, project_mode: DEFAULT_PROJECT_MODE, local_events_dir: DEFAULT_LOCAL_EVENTS_DIR, spool_dir: DEFAULT_SPOOL_DIR, batch_size: DEFAULT_BATCH_SIZE, flush_interval: DEFAULT_FLUSH_INTERVAL, sample_rate: DEFAULT_SAMPLE_RATE, log_level: DEFAULT_LOG_LEVEL, relay_enabled: true, relay_rate_limit_per_minute: DEFAULT_RELAY_RATE_LIMIT_PER_MINUTE, relay_durable_write: true, redact_fields: DEFAULT_REDACT_FIELDS, max_probe_labels: DEFAULT_MAX_PROBE_LABELS, max_probe_entries_per_label: DEFAULT_MAX_PROBE_ENTRIES_PER_LABEL, probe_flush_on_error: DEFAULT_PROBE_FLUSH_ON_ERROR, probes_poll_interval: DEFAULT_PROBES_POLL_INTERVAL) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(project_token: nil, enabled: true, environment: nil, service: nil, endpoint: DEFAULT_ENDPOINT, project_mode: DEFAULT_PROJECT_MODE, local_events_dir: DEFAULT_LOCAL_EVENTS_DIR, spool_dir: DEFAULT_SPOOL_DIR, batch_size: DEFAULT_BATCH_SIZE, flush_interval: DEFAULT_FLUSH_INTERVAL, sample_rate: DEFAULT_SAMPLE_RATE, log_level: DEFAULT_LOG_LEVEL, relay_enabled: true, relay_rate_limit_per_minute: DEFAULT_RELAY_RATE_LIMIT_PER_MINUTE, relay_durable_write: true, redact_fields: DEFAULT_REDACT_FIELDS, max_probe_labels: DEFAULT_MAX_PROBE_LABELS, max_probe_entries_per_label: DEFAULT_MAX_PROBE_ENTRIES_PER_LABEL, probe_flush_on_error: DEFAULT_PROBE_FLUSH_ON_ERROR, probes_poll_interval: DEFAULT_PROBES_POLL_INTERVAL) ⇒ Config
Returns a new instance of Config.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/debugbundle/config.rb', line 44 def initialize( project_token: nil, enabled: true, environment: nil, service: nil, endpoint: DEFAULT_ENDPOINT, project_mode: DEFAULT_PROJECT_MODE, local_events_dir: DEFAULT_LOCAL_EVENTS_DIR, spool_dir: DEFAULT_SPOOL_DIR, batch_size: DEFAULT_BATCH_SIZE, flush_interval: DEFAULT_FLUSH_INTERVAL, sample_rate: DEFAULT_SAMPLE_RATE, log_level: DEFAULT_LOG_LEVEL, relay_enabled: true, relay_rate_limit_per_minute: DEFAULT_RELAY_RATE_LIMIT_PER_MINUTE, relay_durable_write: true, redact_fields: DEFAULT_REDACT_FIELDS, max_probe_labels: DEFAULT_MAX_PROBE_LABELS, max_probe_entries_per_label: DEFAULT_MAX_PROBE_ENTRIES_PER_LABEL, probe_flush_on_error: DEFAULT_PROBE_FLUSH_ON_ERROR, probes_poll_interval: DEFAULT_PROBES_POLL_INTERVAL ) @project_token = project_token @enabled = enabled @environment = environment @service = service @endpoint = endpoint @project_mode = normalize_project_mode(project_mode) @local_events_dir = local_events_dir @spool_dir = spool_dir @batch_size = normalize_positive_integer(batch_size, DEFAULT_BATCH_SIZE) @flush_interval = normalize_positive_number(flush_interval, DEFAULT_FLUSH_INTERVAL) @sample_rate = normalize_sample_rate(sample_rate) @log_level = log_level @relay_enabled = relay_enabled @relay_rate_limit_per_minute = normalize_positive_integer( relay_rate_limit_per_minute, DEFAULT_RELAY_RATE_LIMIT_PER_MINUTE ) @relay_durable_write = relay_durable_write @redact_fields = normalize_redact_fields(redact_fields) @max_probe_labels = normalize_positive_integer(max_probe_labels, DEFAULT_MAX_PROBE_LABELS) @max_probe_entries_per_label = normalize_positive_integer( max_probe_entries_per_label, DEFAULT_MAX_PROBE_ENTRIES_PER_LABEL ) @probe_flush_on_error = probe_flush_on_error @probes_poll_interval = normalize_positive_number(probes_poll_interval, DEFAULT_PROBES_POLL_INTERVAL) freeze end |
Instance Attribute Details
#batch_size ⇒ Object (readonly)
Returns the value of attribute batch_size.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def batch_size @batch_size end |
#enabled ⇒ Object (readonly)
Returns the value of attribute enabled.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def enabled @enabled end |
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def endpoint @endpoint end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def environment @environment end |
#flush_interval ⇒ Object (readonly)
Returns the value of attribute flush_interval.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def flush_interval @flush_interval end |
#local_events_dir ⇒ Object (readonly)
Returns the value of attribute local_events_dir.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def local_events_dir @local_events_dir end |
#log_level ⇒ Object (readonly)
Returns the value of attribute log_level.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def log_level @log_level end |
#max_probe_entries_per_label ⇒ Object (readonly)
Returns the value of attribute max_probe_entries_per_label.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def max_probe_entries_per_label @max_probe_entries_per_label end |
#max_probe_labels ⇒ Object (readonly)
Returns the value of attribute max_probe_labels.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def max_probe_labels @max_probe_labels end |
#probe_flush_on_error ⇒ Object (readonly)
Returns the value of attribute probe_flush_on_error.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def probe_flush_on_error @probe_flush_on_error end |
#probes_poll_interval ⇒ Object (readonly)
Returns the value of attribute probes_poll_interval.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def probes_poll_interval @probes_poll_interval end |
#project_mode ⇒ Object (readonly)
Returns the value of attribute project_mode.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def project_mode @project_mode end |
#project_token ⇒ Object (readonly)
Returns the value of attribute project_token.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def project_token @project_token end |
#redact_fields ⇒ Object (readonly)
Returns the value of attribute redact_fields.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def redact_fields @redact_fields end |
#relay_durable_write ⇒ Object (readonly)
Returns the value of attribute relay_durable_write.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def relay_durable_write @relay_durable_write end |
#relay_enabled ⇒ Object (readonly)
Returns the value of attribute relay_enabled.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def relay_enabled @relay_enabled end |
#relay_rate_limit_per_minute ⇒ Object (readonly)
Returns the value of attribute relay_rate_limit_per_minute.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def relay_rate_limit_per_minute @relay_rate_limit_per_minute end |
#sample_rate ⇒ Object (readonly)
Returns the value of attribute sample_rate.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def sample_rate @sample_rate end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def service @service end |
#spool_dir ⇒ Object (readonly)
Returns the value of attribute spool_dir.
23 24 25 |
# File 'lib/debugbundle/config.rb', line 23 def spool_dir @spool_dir end |
Instance Method Details
#configured? ⇒ Boolean
99 100 101 |
# File 'lib/debugbundle/config.rb', line 99 def configured? !project_token.to_s.empty? end |
#enabled? ⇒ Boolean
95 96 97 |
# File 'lib/debugbundle/config.rb', line 95 def enabled? enabled end |