effect icon indicating copy to clipboard operation
effect copied to clipboard

Carry stack location in span

Open mikearnaldi opened this issue 1 year ago • 0 comments

We could add an option to carry the location of a span by generating a new Error() and forward that to the attributes, we could do it optionally by adding a new positional parameter that enable/disable generation. This would allow enhancing the stack print of errors with source location for the spans.

Additionally we could also expose a functionWithSpan API that allows a user to define a function that is automatically traced, something like:

const myUtility = Effect.functionWithSpan({
  body: (...args) => ...,
  options: (...args) => spanOptions + name,
  traced: true / false
})

cc @tim-smart

mikearnaldi avatar Apr 30 '24 17:04 mikearnaldi