Module: Observed

Extended by:
Forwardable, Observed
Included in:
Observed
Defined in:
lib/observed.rb,
lib/observed/task.rb,
lib/observed/config.rb,
lib/observed/system.rb,
lib/observed/context.rb,
lib/observed/logging.rb,
lib/observed/version.rb,
lib/observed/observer.rb,
lib/observed/reporter.rb,
lib/observed/event_bus.rb,
lib/observed/pluggable.rb,
lib/observed/config_dsl.rb,
lib/observed/translator.rb,
lib/observed/configurable.rb,
lib/observed/hash/builder.rb,
lib/observed/hash/fetcher.rb,
lib/observed/config_builder.rb,
lib/observed/basic_event_bus.rb,
lib/observed/default/observer.rb,
lib/observed/application/oneshot.rb,
lib/observed/builtin_plugins/file.rb,
lib/observed/observed_task_factory.rb,
lib/observed/builtin_plugins/stdout.rb,
lib/observed/hash/key_path_encoding.rb,
lib/observed/observer_helpers/timer.rb,
lib/observed/reporter/regexp_matching.rb,
lib/observed/reporter/report_formatting.rb

Overview

The module to provide DSL to describe Observed configuration, intended to be used by including to Ruby’s ‘main` object like Clockwork(github.com/tomykaira/clockwork) does in their configuration file(a.k.a `clockwork.rb`).

Take this as the ‘Builder` for Observed’s configuration which is has global state. As it has global state, we have to call ‘Observed#init!` before building multiple Observed configurations through this module.

require ‘observed’ include Observed

require ‘observed/http’ require_relative ‘your_plugin’

observe ‘myservice.response’, { plugin: ‘http’, method: ‘get’, url: ‘localhost:3000’ } report /myservice.response/, { plugin: ‘stdout’ }

#=> Now we can obtain the described configuration by calling ‘Observed.config`

Defined Under Namespace

Modules: Application, BuiltinPlugins, Configurable, Default, Hash, Logging, ObserverHelpers, Pluggable Classes: BasicEventBus, BlockingExecutor, Config, ConfigBuilder, ConfigDSL, Context, EventBus, Executor, FakeSystem, MutableTask, NoOpTask, ObservedTaskFactory, Observer, ParallelTask, ProcObserver, ProcReporter, ProcTask, ProcTranslator, Reporter, SequenceTask, Singleton, System, Task, TaskFactory, TaskListener, ThreadExecutor, Translator

Constant Summary collapse

VERSION =
'0.2.0'

Class Method Summary collapse

Class Method Details

.ensure_singleton_initializedObject



59
60
61
62
63
64
65
# File 'lib/observed.rb', line 59

def ensure_singleton_initialized
  @@singleton ||= begin
    s = Singleton.new
    s.init!
    s
  end
end

.extended(klass) ⇒ Object



55
56
57
# File 'lib/observed.rb', line 55

def extended(klass)
  ensure_singleton_initialized
end

.included(klass) ⇒ Object



51
52
53
# File 'lib/observed.rb', line 51

def included(klass)
  ensure_singleton_initialized
end