scoutapp / scout_apm_elixir

ScoutAPM Elixir Agent. Supports Phoenix and other frameworks.
https://scoutapm.com
Other
36 stars 20 forks source link

Support non-import use #66

Closed jstr closed 5 years ago

jstr commented 6 years ago

The recent releases of scout_apm deprecate the use method and require the use of import ScoutApm.Tracing.

This poses challenges for interoperability with some other packages, e.g. https://github.com/Nebo15/sage, and also unnecessary pollutes the function space by importing transaction, etc.

Ideally scout_apm should be useable without importing its functions and creating potential conflicts.

cschneid commented 6 years ago

@jstr - thank you for the report. The transaction and timing "functions" are actually macros, so will require some sort of "import" to work.

Instead of import, which brings names into the module's namespace, can you try require ScoutApm.Tracing, which shouldn't affect namespace, but does enable macros from the Tracing package. After that you should be able to refer to them by their full name ScoutApm.Tracing.transaction(....) do ... end

In addition, you can scope import and require calls inside individual functions, which may be another way to minimize name leakage.

jstr commented 6 years ago

Thanks @cschneid, this what I ended up doing. I do think the documentation could be clearer about usage in this respect.

mitchellhenke commented 5 years ago

Closing this issue as I've added a note about collisions and a link to the Elixir documentation on it. Thanks for opening the issue 🙂