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/trace_context.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/faraday.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/ports/query_inspector.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/core/sql_query_analyzer.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/integrations/opentelemetry.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/rails/error_reporter_subscriber.rb,
lib/chronos/application/apm_error_classifier.rb,
lib/chronos/application/remote_configuration.rb,
lib/chronos/adapters/fiber_local_context_store.rb,
lib/chronos/adapters/thread_local_context_store.rb,
lib/chronos/rails/active_record_query_inspector.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 transitional Chronos Ruby agent.
"1.2.0.pre.2".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
128
129
130
131
132
133
|
# File 'lib/chronos.rb', line 128
def add_breadcrumb(attributes = {})
agent = current_agent
agent ? agent.add_breadcrumb(attributes) : false
rescue StandardError
false
end
|
.apm_integration_options ⇒ Object
149
150
151
152
153
154
|
# File 'lib/chronos.rb', line 149
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
196
197
198
199
200
201
202
203
204
205
|
# File 'lib/chronos.rb', line 196
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
|
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/chronos.rb', line 79
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
|
185
186
187
|
# File 'lib/chronos.rb', line 185
def configured?
!current_agent.nil?
end
|
.flush(timeout = Agent::DEFAULT_FLUSH_TIMEOUT) ⇒ Object
189
190
191
192
193
194
|
# File 'lib/chronos.rb', line 189
def flush(timeout = Agent::DEFAULT_FLUSH_TIMEOUT)
agent = current_agent
agent ? agent.flush(timeout) : true
rescue StandardError
false
end
|
.ignore_if(&block) ⇒ Object
171
172
173
174
175
176
|
# File 'lib/chronos.rb', line 171
def ignore_if(&block)
agent = current_agent
agent ? agent.ignore_if(&block) : false
rescue StandardError
false
end
|
.notify(exception, context = {}) ⇒ Object
92
93
94
95
96
97
|
# File 'lib/chronos.rb', line 92
def notify(exception, context = {})
agent = current_agent
agent ? agent.notify(exception, context) : false
rescue StandardError
false
end
|
.notify_once(exception, context = {}) ⇒ Object
164
165
166
167
168
169
|
# File 'lib/chronos.rb', line 164
def notify_once(exception, context = {})
agent = current_agent
agent ? agent.notify_once(exception, context) : false
rescue StandardError
false
end
|
.notify_sync(exception, context = {}) ⇒ Object
99
100
101
102
103
104
|
# File 'lib/chronos.rb', line 99
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.
157
158
159
160
161
162
|
# File 'lib/chronos.rb', line 157
def propagation_context
agent = current_agent
agent ? agent.propagation_context : {}
rescue StandardError
{}
end
|
.rails_integration_options(environment = nil, console = false) ⇒ Object
178
179
180
181
182
183
|
# File 'lib/chronos.rb', line 178
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
135
136
137
138
139
140
|
# File 'lib/chronos.rb', line 135
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
142
143
144
145
146
147
|
# File 'lib/chronos.rb', line 142
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
# File 'lib/chronos.rb', line 106
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
121
122
123
124
125
126
|
# File 'lib/chronos.rb', line 121
def with_context(context = {})
agent = current_agent
return yield unless agent
agent.with_context(context) { yield }
end
|