Module: Chronos
- Extended by:
- ObservabilityFacade
- Defined in:
- lib/chronos.rb,
lib/chronos/core.rb,
lib/chronos/agent.rb,
lib/chronos/ports.rb,
lib/chronos/rails.rb,
lib/chronos/errors.rb,
lib/chronos/version.rb,
lib/chronos/adapters.rb,
lib/chronos/internal.rb,
lib/chronos/rake_tasks.rb,
lib/chronos/application.rb,
lib/chronos/core/notice.rb,
lib/chronos/integrations.rb,
lib/chronos/configuration.rb,
lib/chronos/rails/railtie.rb,
lib/chronos/core/sanitizer.rb,
lib/chronos/core/breadcrumb.rb,
lib/chronos/ports/transport.rb,
lib/chronos/rails/installer.rb,
lib/chronos/core/runtime_info.rb,
lib/chronos/integrations/rack.rb,
lib/chronos/core/notice_builder.rb,
lib/chronos/core/sql_normalizer.rb,
lib/chronos/ports/context_store.rb,
lib/chronos/core/safe_serializer.rb,
lib/chronos/core/telemetry_event.rb,
lib/chronos/integrations/sidekiq.rb,
lib/chronos/internal/safe_logger.rb,
lib/chronos/internal/worker_pool.rb,
lib/chronos/observability_facade.rb,
lib/chronos/core/backtrace_parser.rb,
lib/chronos/core/cache_normalizer.rb,
lib/chronos/core/metric_aggregate.rb,
lib/chronos/integrations/net_http.rb,
lib/chronos/configuration/snapshot.rb,
lib/chronos/core/deploy_normalizer.rb,
lib/chronos/internal/bounded_queue.rb,
lib/chronos/core/payload_serializer.rb,
lib/chronos/integrations/active_job.rb,
lib/chronos/integrations/capistrano.rb,
lib/chronos/internal/memory_backlog.rb,
lib/chronos/application/retry_policy.rb,
lib/chronos/configuration/validation.rb,
lib/chronos/core/correlation_context.rb,
lib/chronos/integrations/job_payload.rb,
lib/chronos/application/ignore_policy.rb,
lib/chronos/application/apm_aggregator.rb,
lib/chronos/adapters/net_http_transport.rb,
lib/chronos/application/circuit_breaker.rb,
lib/chronos/core/sensitive_value_filter.rb,
lib/chronos/configuration/apm_validation.rb,
lib/chronos/integrations/rack/middleware.rb,
lib/chronos/application/capture_exception.rb,
lib/chronos/application/capture_telemetry.rb,
lib/chronos/application/delivery_pipeline.rb,
lib/chronos/application/verify_integration.rb,
lib/chronos/core/exception_cause_collector.rb,
lib/chronos/rails/notifications_subscriber.rb,
lib/chronos/application/dependency_reporter.rb,
lib/chronos/application/apm_error_classifier.rb,
lib/chronos/application/remote_configuration.rb,
lib/chronos/adapters/thread_local_context_store.rb,
lib/chronos/core/integration_verification_result.rb,
lib/generators/chronos/install/install_generator.rb
Overview
Framework-independent public facade for the Chronos Ruby agent.
Defined Under Namespace
Modules: Adapters, Application, Core, Generators, Integrations, Internal, ObservabilityFacade, Ports, Rails, RakeTasks
Classes: Agent, Configuration, ConfigurationError, Error, IntegrationVerificationError
Constant Summary
collapse
- VERSION =
Current version of the legacy Chronos Ruby agent.
"0.9.0.pre.4".freeze
Class Method Summary
collapse
cache_integration_options, external_http_integration_options, instrument_net_http, notify_deploy, report_dependencies
Class Method Details
.add_breadcrumb(attributes = {}) ⇒ Object
122
123
124
125
126
127
|
# File 'lib/chronos.rb', line 122
def add_breadcrumb(attributes = {})
agent = current_agent
agent ? agent.add_breadcrumb(attributes) : false
rescue StandardError
false
end
|
.apm_integration_options ⇒ Object
143
144
145
146
147
148
|
# File 'lib/chronos.rb', line 143
def apm_integration_options
agent = current_agent
agent ? agent.apm_integration_options : {:enabled => false}
rescue StandardError
{:enabled => false}
end
|
.close(timeout = Agent::DEFAULT_FLUSH_TIMEOUT) ⇒ Object
190
191
192
193
194
195
196
197
198
199
|
# File 'lib/chronos.rb', line 190
def close(timeout = Agent::DEFAULT_FLUSH_TIMEOUT)
agent = @mutex.synchronize do
current = @agent
@agent = nil
current
end
agent ? agent.close(timeout) : true
rescue StandardError
false
end
|
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/chronos.rb', line 73
def configure
configuration = Configuration.new
yield configuration if block_given?
agent = Agent.new(configuration.snapshot)
previous = nil
@mutex.synchronize do
previous = @agent
@agent = agent
end
previous.close if previous
configuration
end
|
179
180
181
|
# File 'lib/chronos.rb', line 179
def configured?
!current_agent.nil?
end
|
.flush(timeout = Agent::DEFAULT_FLUSH_TIMEOUT) ⇒ Object
183
184
185
186
187
188
|
# File 'lib/chronos.rb', line 183
def flush(timeout = Agent::DEFAULT_FLUSH_TIMEOUT)
agent = current_agent
agent ? agent.flush(timeout) : true
rescue StandardError
false
end
|
.ignore_if(&block) ⇒ Object
165
166
167
168
169
170
|
# File 'lib/chronos.rb', line 165
def ignore_if(&block)
agent = current_agent
agent ? agent.ignore_if(&block) : false
rescue StandardError
false
end
|
.notify(exception, context = {}) ⇒ Object
86
87
88
89
90
91
|
# File 'lib/chronos.rb', line 86
def notify(exception, context = {})
agent = current_agent
agent ? agent.notify(exception, context) : false
rescue StandardError
false
end
|
.notify_once(exception, context = {}) ⇒ Object
158
159
160
161
162
163
|
# File 'lib/chronos.rb', line 158
def notify_once(exception, context = {})
agent = current_agent
agent ? agent.notify_once(exception, context) : false
rescue StandardError
false
end
|
.notify_sync(exception, context = {}) ⇒ Object
93
94
95
96
97
98
|
# File 'lib/chronos.rb', line 93
def notify_sync(exception, context = {})
agent = current_agent
agent ? agent.notify_sync(exception, context) : false
rescue StandardError
false
end
|
.propagation_context ⇒ Object
Returns only trace/request identifiers for optional process-boundary adapters.
151
152
153
154
155
156
|
# File 'lib/chronos.rb', line 151
def propagation_context
agent = current_agent
agent ? agent.propagation_context : {}
rescue StandardError
{}
end
|
.rails_integration_options(environment = nil, console = false) ⇒ Object
172
173
174
175
176
177
|
# File 'lib/chronos.rb', line 172
def rails_integration_options(environment = nil, console = false)
agent = current_agent
agent ? agent.rails_integration_options(environment, console) : {:enabled => false}
rescue StandardError
{:enabled => false}
end
|
.record_event(event_type, payload = {}, context = {}) ⇒ Object
129
130
131
132
133
134
|
# File 'lib/chronos.rb', line 129
def record_event(event_type, payload = {}, context = {})
agent = current_agent
agent ? agent.record_event(event_type, payload, context) : false
rescue StandardError
false
end
|
.record_event_once(key, event_type, payload = {}, context = {}) ⇒ Object
136
137
138
139
140
141
|
# File 'lib/chronos.rb', line 136
def record_event_once(key, event_type, payload = {}, context = {})
agent = current_agent
agent ? agent.record_event_once(key, event_type, payload, context) : false
rescue StandardError
false
end
|
.verify_integration ⇒ Object
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
# File 'lib/chronos.rb', line 100
def verify_integration
agent = current_agent
return agent.verify_integration if agent
verification_failure(
"not_configured", "Chronos is not configured.",
"Run Chronos.configure before verifying the integration."
)
rescue StandardError
verification_failure(
"verification_failed", "Chronos integration verification failed locally.",
"Review the Chronos configuration and retry."
)
end
|
.with_context(context = {}) ⇒ Object
115
116
117
118
119
120
|
# File 'lib/chronos.rb', line 115
def with_context(context = {})
agent = current_agent
return yield unless agent
agent.with_context(context) { yield }
end
|