Module: Chronos

Defined in:
lib/chronos.rb,
lib/chronos/core.rb,
lib/chronos/agent.rb,
lib/chronos/ports.rb,
lib/chronos/errors.rb,
lib/chronos/version.rb,
lib/chronos/adapters.rb,
lib/chronos/internal.rb,
lib/chronos/application.rb,
lib/chronos/core/notice.rb,
lib/chronos/configuration.rb,
lib/chronos/ports/transport.rb,
lib/chronos/core/runtime_info.rb,
lib/chronos/core/notice_builder.rb,
lib/chronos/internal/safe_logger.rb,
lib/chronos/internal/worker_pool.rb,
lib/chronos/core/backtrace_parser.rb,
lib/chronos/internal/bounded_queue.rb,
lib/chronos/core/payload_serializer.rb,
lib/chronos/adapters/net_http_transport.rb,
lib/chronos/application/capture_exception.rb,
lib/chronos/core/exception_cause_collector.rb

Overview

Framework-independent public facade for the Chronos Ruby agent.

Examples:

Chronos.configure do |config|
  config.project_id = "project-id"
  config.project_key = "project-key"
  config.host = "https://chronos.example.com"
end
Chronos.notify(RuntimeError.new("failed"))

Defined Under Namespace

Modules: Adapters, Application, Core, Internal, Ports Classes: Agent, Configuration, ConfigurationError, Error

Constant Summary collapse

VERSION =

Current version of the legacy Chronos Ruby agent.

"0.1.0.pre.2".freeze

Class Method Summary collapse

Class Method Details

.close(timeout = Agent::DEFAULT_FLUSH_TIMEOUT) ⇒ Object



81
82
83
84
85
86
87
88
89
90
# File 'lib/chronos.rb', line 81

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

.configure {|configuration| ... } ⇒ Object

Yields:

  • (configuration)


43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/chronos.rb', line 43

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

.configured?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/chronos.rb', line 70

def configured?
  !current_agent.nil?
end

.flush(timeout = Agent::DEFAULT_FLUSH_TIMEOUT) ⇒ Object



74
75
76
77
78
79
# File 'lib/chronos.rb', line 74

def flush(timeout = Agent::DEFAULT_FLUSH_TIMEOUT)
  agent = current_agent
  agent ? agent.flush(timeout) : true
rescue StandardError
  false
end

.notify(exception, context = {}) ⇒ Object



56
57
58
59
60
61
# File 'lib/chronos.rb', line 56

def notify(exception, context = {})
  agent = current_agent
  agent ? agent.notify(exception, context) : false
rescue StandardError
  false
end

.notify_sync(exception, context = {}) ⇒ Object



63
64
65
66
67
68
# File 'lib/chronos.rb', line 63

def notify_sync(exception, context = {})
  agent = current_agent
  agent ? agent.notify_sync(exception, context) : false
rescue StandardError
  false
end