Skip to content

Commit

Permalink
Move instrumentation to RubyEventStore
Browse files Browse the repository at this point in the history
Now, when it doesn't directly on ActiveSupport::Notifications, it can
be in RubyEventStore. ActiveSupport::Notifications still is present in
the tests, because it serves us as API standard.

Issue: #244
  • Loading branch information
swistak35 committed Aug 9, 2018
1 parent 111efbf commit 1b0ecbe
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
1 change: 0 additions & 1 deletion rails_event_store/lib/rails_event_store/all.rb
Expand Up @@ -7,7 +7,6 @@
require 'rails_event_store/version'
require 'rails_event_store/railtie'
require 'rails_event_store/deprecations'
require 'rails_event_store/instrumented_repository'

module RailsEventStore
Event = RubyEventStore::Event
Expand Down
2 changes: 1 addition & 1 deletion rails_event_store/lib/rails_event_store/client.rb
Expand Up @@ -8,7 +8,7 @@ def initialize(repository: RailsEventStoreActiveRecord::EventRepository.new,
dispatcher: ActiveJobDispatcher.new,
request_metadata: default_request_metadata,
page_size: PAGE_SIZE)
super(repository: InstrumentedRepository.new(repository, ActiveSupport::Notifications),
super(repository: RubyEventStore::InstrumentedRepository.new(repository, ActiveSupport::Notifications),
mapper: mapper,
subscriptions: subscriptions,
dispatcher: dispatcher,
Expand Down
1 change: 1 addition & 0 deletions ruby_event_store/lib/ruby_event_store.rb
Expand Up @@ -24,3 +24,4 @@
require 'ruby_event_store/async_dispatcher'
require 'ruby_event_store/debouncer'
require 'ruby_event_store/version'
require 'ruby_event_store/instrumented_repository'
@@ -1,4 +1,4 @@
module RailsEventStore
module RubyEventStore
class InstrumentedRepository
def initialize(repository, instrumentation)
@repository = repository
Expand Down
1 change: 1 addition & 0 deletions ruby_event_store/ruby_event_store.gemspec
Expand Up @@ -35,4 +35,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'unparser'
spec.add_development_dependency 'astrolabe'
spec.add_development_dependency 'google-protobuf', '~> 3.5.1.2'
spec.add_development_dependency 'activesupport', '~> 5.0'
end
@@ -1,7 +1,8 @@
require 'spec_helper'
require 'ruby_event_store/spec/event_repository_lint'
require 'active_support/notifications'

module RailsEventStore
module RubyEventStore
RSpec.describe InstrumentedRepository do
describe "#append_to_stream" do
specify "wraps around original implementation" do
Expand Down Expand Up @@ -154,10 +155,10 @@ def subscribe_to(name)
end
end

module RailsEventStore
module RubyEventStore
RSpec.describe InstrumentedRepository do
subject do
InstrumentedRepository.new(RubyEventStore::InMemoryRepository.new, ActiveSupport::Notifications)
InstrumentedRepository.new(InMemoryRepository.new, ActiveSupport::Notifications)
end

let(:test_race_conditions_any) { false }
Expand Down

0 comments on commit 1b0ecbe

Please sign in to comment.