You should define an interface for the plugin class. When requiring the module, it should return the class (then you call new and place the instance in the map). When calling run, it should return a promise or a value instead calling monitoring.registerEvent (in this way you also remove the need for the nextTick call).