Module: Bulletin

Defined in:
lib/bulletin.rb,
lib/bulletin/store.rb,
lib/bulletin/engine.rb,
lib/bulletin/version.rb,
lib/bulletin/warning.rb,
lib/bulletin/middleware.rb,
lib/bulletin/store/base.rb,
lib/bulletin/store/null.rb,
lib/bulletin/fingerprint.rb,
app/models/bulletin/issue.rb,
lib/bulletin/configuration.rb,
app/jobs/bulletin/prune_job.rb,
app/jobs/bulletin/record_job.rb,
app/models/bulletin/occurrence.rb,
lib/bulletin/store/active_record.rb,
app/models/bulletin/application_record.rb,
lib/generators/bulletin/install_generator.rb,
app/controllers/bulletin/issues_controller.rb,
app/controllers/bulletin/application_controller.rb

Overview

Bulletin gives Bullet a memory. Bullet detects N+1 / unused-eager-loading / counter-cache problems per request but forgets them immediately; Bulletin reads Bullet’s per-request findings, fingerprints them into durable “issues” (Sentry-style), and exposes a mountable UI for triage.

Defined Under Namespace

Modules: Fingerprint, Generators, Store, Warning Classes: ApplicationController, ApplicationRecord, Configuration, Engine, Issue, IssuesController, Middleware, Occurrence, PruneJob, RecordJob

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.configObject



20
21
22
# File 'lib/bulletin.rb', line 20

def config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields:



24
25
26
# File 'lib/bulletin.rb', line 24

def configure
  yield config
end

.dispatch(payload) ⇒ Object

Routes a normalized payload to the store, inline or via ActiveJob, depending on the configured write strategy.



39
40
41
42
43
44
45
46
# File 'lib/bulletin.rb', line 39

def dispatch(payload)
  case config.write_strategy
  when :active_job
    RecordJob.perform_later(payload)
  else # :inline
    store.record(payload)
  end
end

.loggerObject



48
49
50
51
52
# File 'lib/bulletin.rb', line 48

def logger
  return Rails.logger if defined?(Rails) && Rails.respond_to?(:logger)

  nil
end

.reset_store!Object



33
34
35
# File 'lib/bulletin.rb', line 33

def reset_store!
  @store = nil
end

.storeObject

The active persistence backend (memoized). Reset when the store changes.



29
30
31
# File 'lib/bulletin.rb', line 29

def store
  @store ||= Store.build(config.store)
end