Closed lindig closed 1 year ago
Indeed! However it's up to collectors to make use of this option, so far none of them do. __FILE__
and __LINE__
are directly used by Tracy (which can then display source code), but otherwise it remains to be seen what use can be made of __FUNCTION__
.
For example I think the trace-tef
collector could, if __FUNCTION__
is passed, add it as a key/value metadata.
One thing worth noting, is that "span name" should probably contain additional data, besides __FUNCTION__
— as a random example, consider an http_handle
function; having every single span have the same name of Web.http_handle
(or whatever) would be fairly useless. To some extent, the point-of-instrumentation, and the "what does this do, at a glance" are two reasonably different things (in particular, the latter is likely to rely on runtime state.)
Just a tip, hope that's helpful.
And that's what the ?data
argument is all about, indeed :-). For an
instrumentation middleware in an http service, you'd typically include
the query path and maybe some headers in there.
I have not yet used the library but assume that most users at least initially would instrument functions by saying:
Only when you need to trace parts inside a function, you would need a different name. There is also
__LOC__
available. I was wondering, why you didn't suggest to use__FUNCTION__
? The code above could be easily inserted using search/replace in an editor.Addendum: I looked at the implementation and indeed it encourages to use
__FUNCTION__
:So you can ignore my comment.