Class: Logtide::Configuration
- Inherits:
-
Object
- Object
- Logtide::Configuration
- Defined in:
- lib/logtide/configuration.rb
Overview
Holds the SDK configuration and the exact spec defaults (004 section 2).
Durations are expressed in seconds (Ruby has no duration type; seconds with an optional fractional part is the idiomatic choice and matches sleep, Net::HTTP timeouts, etc.).
Constant Summary collapse
- INGEST_SUFFIX =
"/api/v1/ingest"- OTLP_TRACES_SUFFIX =
"/v1/otlp/traces"
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#api_url ⇒ Object
readonly
Returns the value of attribute api_url.
-
#attach_stacktrace ⇒ Object
readonly
Returns the value of attribute attach_stacktrace.
-
#batch_size ⇒ Object
readonly
Returns the value of attribute batch_size.
-
#before_breadcrumb ⇒ Object
readonly
Returns the value of attribute before_breadcrumb.
-
#before_send ⇒ Object
readonly
Returns the value of attribute before_send.
-
#circuit_breaker_reset ⇒ Object
readonly
Returns the value of attribute circuit_breaker_reset.
-
#circuit_breaker_threshold ⇒ Object
readonly
Returns the value of attribute circuit_breaker_threshold.
-
#debug ⇒ Object
readonly
Returns the value of attribute debug.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#flush_interval ⇒ Object
readonly
Returns the value of attribute flush_interval.
-
#flush_timeout ⇒ Object
readonly
Returns the value of attribute flush_timeout.
-
#global_metadata ⇒ Object
readonly
Returns the value of attribute global_metadata.
-
#max_backoff ⇒ Object
readonly
Returns the value of attribute max_backoff.
-
#max_breadcrumbs ⇒ Object
readonly
Returns the value of attribute max_breadcrumbs.
-
#max_buffer_size ⇒ Object
readonly
Returns the value of attribute max_buffer_size.
-
#max_retries ⇒ Object
readonly
Returns the value of attribute max_retries.
-
#release ⇒ Object
readonly
Returns the value of attribute release.
-
#retry_delay ⇒ Object
readonly
Returns the value of attribute retry_delay.
-
#sample_rate ⇒ Object
readonly
Returns the value of attribute sample_rate.
-
#send_default_pii ⇒ Object
readonly
Returns the value of attribute send_default_pii.
-
#server_name ⇒ Object
readonly
Returns the value of attribute server_name.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#traces_sample_rate ⇒ Object
readonly
Returns the value of attribute traces_sample_rate.
Instance Method Summary collapse
- #ingest_url ⇒ Object
-
#initialize(dsn: nil, api_url: nil, api_key: nil, service: nil, environment: "production", release: nil, server_name: nil, batch_size: 100, flush_interval: 5, max_buffer_size: 10_000, max_retries: 3, retry_delay: 1, max_backoff: 60, circuit_breaker_threshold: 5, circuit_breaker_reset: 30, flush_timeout: 10, max_breadcrumbs: 100, sample_rate: 1.0, traces_sample_rate: 1.0, global_metadata: nil, attach_stacktrace: true, send_default_pii: false, debug: false, before_send: nil, before_breadcrumb: nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #otlp_traces_url ⇒ Object
Constructor Details
#initialize(dsn: nil, api_url: nil, api_key: nil, service: nil, environment: "production", release: nil, server_name: nil, batch_size: 100, flush_interval: 5, max_buffer_size: 10_000, max_retries: 3, retry_delay: 1, max_backoff: 60, circuit_breaker_threshold: 5, circuit_breaker_reset: 30, flush_timeout: 10, max_breadcrumbs: 100, sample_rate: 1.0, traces_sample_rate: 1.0, global_metadata: nil, attach_stacktrace: true, send_default_pii: false, debug: false, before_send: nil, before_breadcrumb: nil) ⇒ Configuration
Returns a new instance of Configuration.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/logtide/configuration.rb', line 25 def initialize(dsn: nil, api_url: nil, api_key: nil, service: nil, environment: "production", release: nil, server_name: nil, batch_size: 100, flush_interval: 5, max_buffer_size: 10_000, max_retries: 3, retry_delay: 1, max_backoff: 60, circuit_breaker_threshold: 5, circuit_breaker_reset: 30, flush_timeout: 10, max_breadcrumbs: 100, sample_rate: 1.0, traces_sample_rate: 1.0, global_metadata: nil, attach_stacktrace: true, send_default_pii: false, debug: false, before_send: nil, before_breadcrumb: nil) resolve_endpoint(dsn, api_url, api_key) @service = require_service(service) @environment = environment @release = release @server_name = server_name || Socket.gethostname @batch_size = batch_size @flush_interval = flush_interval @max_buffer_size = max_buffer_size @max_retries = max_retries @retry_delay = retry_delay @max_backoff = max_backoff @circuit_breaker_threshold = circuit_breaker_threshold @circuit_breaker_reset = circuit_breaker_reset @flush_timeout = flush_timeout @max_breadcrumbs = @sample_rate = sample_rate @traces_sample_rate = traces_sample_rate @global_metadata = || {} @attach_stacktrace = attach_stacktrace @send_default_pii = send_default_pii @debug = debug @before_send = before_send @before_breadcrumb = end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def api_key @api_key end |
#api_url ⇒ Object (readonly)
Returns the value of attribute api_url.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def api_url @api_url end |
#attach_stacktrace ⇒ Object (readonly)
Returns the value of attribute attach_stacktrace.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def attach_stacktrace @attach_stacktrace end |
#batch_size ⇒ Object (readonly)
Returns the value of attribute batch_size.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def batch_size @batch_size end |
#before_breadcrumb ⇒ Object (readonly)
Returns the value of attribute before_breadcrumb.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def @before_breadcrumb end |
#before_send ⇒ Object (readonly)
Returns the value of attribute before_send.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def before_send @before_send end |
#circuit_breaker_reset ⇒ Object (readonly)
Returns the value of attribute circuit_breaker_reset.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def circuit_breaker_reset @circuit_breaker_reset end |
#circuit_breaker_threshold ⇒ Object (readonly)
Returns the value of attribute circuit_breaker_threshold.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def circuit_breaker_threshold @circuit_breaker_threshold end |
#debug ⇒ Object (readonly)
Returns the value of attribute debug.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def debug @debug end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def environment @environment end |
#flush_interval ⇒ Object (readonly)
Returns the value of attribute flush_interval.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def flush_interval @flush_interval end |
#flush_timeout ⇒ Object (readonly)
Returns the value of attribute flush_timeout.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def flush_timeout @flush_timeout end |
#global_metadata ⇒ Object (readonly)
Returns the value of attribute global_metadata.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def @global_metadata end |
#max_backoff ⇒ Object (readonly)
Returns the value of attribute max_backoff.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def max_backoff @max_backoff end |
#max_breadcrumbs ⇒ Object (readonly)
Returns the value of attribute max_breadcrumbs.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def @max_breadcrumbs end |
#max_buffer_size ⇒ Object (readonly)
Returns the value of attribute max_buffer_size.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def max_buffer_size @max_buffer_size end |
#max_retries ⇒ Object (readonly)
Returns the value of attribute max_retries.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def max_retries @max_retries end |
#release ⇒ Object (readonly)
Returns the value of attribute release.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def release @release end |
#retry_delay ⇒ Object (readonly)
Returns the value of attribute retry_delay.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def retry_delay @retry_delay end |
#sample_rate ⇒ Object (readonly)
Returns the value of attribute sample_rate.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def sample_rate @sample_rate end |
#send_default_pii ⇒ Object (readonly)
Returns the value of attribute send_default_pii.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def send_default_pii @send_default_pii end |
#server_name ⇒ Object (readonly)
Returns the value of attribute server_name.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def server_name @server_name end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def service @service end |
#traces_sample_rate ⇒ Object (readonly)
Returns the value of attribute traces_sample_rate.
17 18 19 |
# File 'lib/logtide/configuration.rb', line 17 def traces_sample_rate @traces_sample_rate end |
Instance Method Details
#ingest_url ⇒ Object
61 62 63 |
# File 'lib/logtide/configuration.rb', line 61 def ingest_url "#{@api_url}#{INGEST_SUFFIX}" end |
#otlp_traces_url ⇒ Object
65 66 67 |
# File 'lib/logtide/configuration.rb', line 65 def otlp_traces_url "#{@api_url}#{OTLP_TRACES_SUFFIX}" end |