Class: RubyEventStore::InstrumentedRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_event_store/instrumented_repository.rb

Instance Method Summary collapse

Constructor Details

#initialize(repository, instrumentation) ⇒ InstrumentedRepository

Returns a new instance of InstrumentedRepository.


7
8
9
10
# File 'lib/ruby_event_store/instrumented_repository.rb', line 7

def initialize(repository, instrumentation)
  @repository = repository
  @instrumentation = instrumentation
end

Instance Method Details

#append_to_stream(records, stream, expected_version) ⇒ Object


12
13
14
15
16
# File 'lib/ruby_event_store/instrumented_repository.rb', line 12

def append_to_stream(records, stream, expected_version)
  instrumentation.instrument("append_to_stream.repository.rails_event_store", events: records, stream: stream) do
    repository.append_to_stream(records, stream, expected_version)
  end
end

#count(specification) ⇒ Object


36
37
38
39
40
# File 'lib/ruby_event_store/instrumented_repository.rb', line 36

def count(specification)
  instrumentation.instrument("count.repository.rails_event_store", specification: specification) do
    repository.count(specification)
  end
end

#delete_stream(stream) ⇒ Object


24
25
26
27
28
# File 'lib/ruby_event_store/instrumented_repository.rb', line 24

def delete_stream(stream)
  instrumentation.instrument("delete_stream.repository.rails_event_store", stream: stream) do
    repository.delete_stream(stream)
  end
end

18
19
20
21
22
# File 'lib/ruby_event_store/instrumented_repository.rb', line 18

def link_to_stream(event_ids, stream, expected_version)
  instrumentation.instrument("link_to_stream.repository.rails_event_store", event_ids: event_ids, stream: stream) do
    repository.link_to_stream(event_ids, stream, expected_version)
  end
end

#read(specification) ⇒ Object


30
31
32
33
34
# File 'lib/ruby_event_store/instrumented_repository.rb', line 30

def read(specification)
  instrumentation.instrument("read.repository.rails_event_store", specification: specification) do
    repository.read(specification)
  end
end

#respond_to_missing?(method_name, _include_private) ⇒ Boolean

Returns:

  • (Boolean)

62
63
64
# File 'lib/ruby_event_store/instrumented_repository.rb', line 62

def respond_to_missing?(method_name, _include_private)
  repository.respond_to?(method_name)
end

#streams_of(event_id) ⇒ Object


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

def streams_of(event_id)
  instrumentation.instrument("streams_of.repository.rails_event_store", event_id: event_id) do
    repository.streams_of(event_id)
  end
end

#update_messages(messages) ⇒ Object


42
43
44
45
46
# File 'lib/ruby_event_store/instrumented_repository.rb', line 42

def update_messages(messages)
  instrumentation.instrument("update_messages.repository.rails_event_store", messages: messages) do
    repository.update_messages(messages)
  end
end