rails_event_store: Instrumented wrappers could break backward compatibility

Current RailsEventStore version: 0.36.0 Failing RailsEventStore version: 0.37.0+

I’m using custom mapper with additional API. Tried to upgrade the gem version and found that everything is broken)

InstrumentedMapper only takes care of the basic mapper APIs assuming there is no additional methods. Which, I guess, true in most cases. Though it still looks too opinionated (and blocks me from upgrading 🙂).

I’ve been thinking about a ways to solve it:

  1. make wrapper to be a delegate (e.g. via SimpleDelegator)
  2. prepend instrumentation functionality (via mapper.prepend – involves singleton class creation, though not a big deal in this case)
  3. let users use the exact mappers their provide to Client.new and add a separate InstrumentedClient.new with automatic wrapping (and add a module that could be included to custom mappers to seamlessly add instrumentation)

All the applied are also applied to instrumented dispatchers and repositories.

Would be glad to provide a PR when/if we decide on a way to solve this.

Thanks)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

@palkan I’ve made an instrumented repository to pass through any other custom methods, with the idea being that the instrumentation should be transparent to the repository being used.

I don’t know whether you still need that, but feel free to check c23a973bd071e0b66ae44f7be433a1ec2ce66920 😃

@palkan Thank you, I will need to think about your answer 😃