Class: SolidOps::Configuration
- Inherits:
-
Object
- Object
- SolidOps::Configuration
- Defined in:
- lib/solid_ops/configuration.rb
Instance Attribute Summary collapse
-
#actor_resolver ⇒ Object
Returns the value of attribute actor_resolver.
-
#auth_check ⇒ Object
Returns the value of attribute auth_check.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#max_payload_bytes ⇒ Object
Returns the value of attribute max_payload_bytes.
-
#redactor ⇒ Object
Returns the value of attribute redactor.
-
#retention_period ⇒ Object
Returns the value of attribute retention_period.
-
#sample_rate ⇒ Object
Returns the value of attribute sample_rate.
-
#tenant_resolver ⇒ Object
Returns the value of attribute tenant_resolver.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #sample? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/solid_ops/configuration.rb', line 10 def initialize @enabled = true @max_payload_bytes = 10_000 @redactor = nil @retention_period = 7.days # Auto-purge events older than this @sample_rate = 1.0 # 1.0 = capture everything, 0.1 = 10% @tenant_resolver = nil # ->(request) { request.subdomain } @actor_resolver = nil # ->(request) { request.env["warden"]&.user&.id } @auth_check = nil # ->(controller) { controller.current_user&.admin? } end |
Instance Attribute Details
#actor_resolver ⇒ Object
Returns the value of attribute actor_resolver.
5 6 7 |
# File 'lib/solid_ops/configuration.rb', line 5 def actor_resolver @actor_resolver end |
#auth_check ⇒ Object
Returns the value of attribute auth_check.
5 6 7 |
# File 'lib/solid_ops/configuration.rb', line 5 def auth_check @auth_check end |
#enabled ⇒ Object
Returns the value of attribute enabled.
5 6 7 |
# File 'lib/solid_ops/configuration.rb', line 5 def enabled @enabled end |
#max_payload_bytes ⇒ Object
Returns the value of attribute max_payload_bytes.
5 6 7 |
# File 'lib/solid_ops/configuration.rb', line 5 def max_payload_bytes @max_payload_bytes end |
#redactor ⇒ Object
Returns the value of attribute redactor.
5 6 7 |
# File 'lib/solid_ops/configuration.rb', line 5 def redactor @redactor end |
#retention_period ⇒ Object
Returns the value of attribute retention_period.
5 6 7 |
# File 'lib/solid_ops/configuration.rb', line 5 def retention_period @retention_period end |
#sample_rate ⇒ Object
Returns the value of attribute sample_rate.
5 6 7 |
# File 'lib/solid_ops/configuration.rb', line 5 def sample_rate @sample_rate end |
#tenant_resolver ⇒ Object
Returns the value of attribute tenant_resolver.
5 6 7 |
# File 'lib/solid_ops/configuration.rb', line 5 def tenant_resolver @tenant_resolver end |
Instance Method Details
#sample? ⇒ Boolean
21 22 23 24 25 26 |
# File 'lib/solid_ops/configuration.rb', line 21 def sample? return true if sample_rate >= 1.0 return false if sample_rate <= 0.0 rand < sample_rate end |