spandex-project / spandex

A platform agnostic tracing library
MIT License
335 stars 53 forks source link

Remove is_binary guard from macros #140

Closed reachfh closed 2 years ago

reachfh commented 2 years ago

The is_binary guards on trace/2 and span/2 macros cause problems when the span name is computed at runtime. If the span name is a variable or an interpolated string like "name.#{key}", then the guard fails, as the macro receives an AST structure instead of a string. This PR removes the guard.

To get the similar effect of protecting against incorrect usage, the guard could be added to Spandex.start_trace/2.

GregMefford commented 2 years ago

Already merged the same thing in #136 but thanks a lot for taking the time to open this PR! ❤️