deadtrickster / prometheus.ex

Prometheus.io Elixir client
411 stars 68 forks source link

Delegate functions calls instead of using macros #24

Closed hauleth closed 6 years ago

hauleth commented 6 years ago

This is semi-breaking change as the behaviour should stay the same, but the calling form will be different, from macros to functions.

Closes #23

deadtrickster commented 6 years ago

very nice Kernel.Utils.defdelegate, thanks

halostatue commented 6 years ago

This seems to break Prometheus.Registry.register_collector(:prometheus_process_collector), requiring the explicit call of Prometheus.Registry.register_collector(:default, :prometheus_process_collector).

warning: function Prometheus.Registry.register_collector/1 is undefined or private. Did you mean one of:

      * "MACRO-deregister_collector"/2
      * "MACRO-register_collector"/2
      * "MACRO-register_collector"/3
      * "MACRO-register_collectors"/2
      * "MACRO-register_collectors"/3
halostatue commented 6 years ago

Actually, I’m not sure that’s the case. I’m not sure if you’ve pushed this one live yet, but I’m getting this now even with both arguments.

hauleth commented 6 years ago

@halostatue it seems that you are using released version, not HEAD as it explicitly says that there are still macros there. Actually this PR will make your code work as is. To fix it using released version you need to add require Prometheus.Registry somewhere in your module.

halostatue commented 6 years ago

Makes sense. I’ll do that until the released version is updated. Thanks.