Constructs an Evaluator
instance with the two passed-in functions.
Constructs an Evaluator
instance with the two passed-in functions.
- a function which takes a Throwable
returned by the program whose execution is being traced by the
span using this 'Evaluator' and possibly converts it to a FailureDetail which is used to determine that the span execution has
succeeded or failed and how to render it. Generally, if the program itself has failed with a Throwable
, you'll
want to return a FailureDetail with a human-readable rendering of that error but there may be corner cases where the span itself
should still be reported as having succeeded (if, for instance, an IO
is failed with an exception meant to trigger some upstream
program logic rather than indicate an error - not recommended, usually, but there may be reasons why this is necessary).
- a function which takes the result of the program F[A]
whose execution is being traced by the span using this
Evaluator
and possibly uses it to create a FailureDetail. Usually, if a program succeeds with a result, you won't want to
generate a FailureDetail indicating that the span has failed; however, the program may be returning an application-specific data
type which could indicate an error (such as an Either[Error, Result]
or an enumerated ADT with values indicating failure). In those
cases, this function can be used to translate the application-specific error to a FailureDetail.
evaluator - a new instance of the Evaluator
.
The default Evaluator
instance, used if no custom Evaluator
is passed to the TraceT.newSpan
or TraceT.newAnnotatedSpan
functions.
The default Evaluator
instance, used if no custom Evaluator
is passed to the TraceT.newSpan
or TraceT.newAnnotatedSpan
functions. All program exceptions are converted to FailureDetail instances but otherwise no FailureDetails are generated.
- the result type of the effectful program being traced.
newEvaluator - a new Evaluator instance, compatible with the result type of the effectful program being traced.
Constructs an Evaluator
instance with the passed-in function used to convert a program failure Throwable
to a possible FailureDetail.
Constructs an Evaluator
instance with the passed-in function used to convert a program failure Throwable
to a possible FailureDetail. The
default value is used for the function which converts a successful program result to a possible FailureDetail (the default
function in this case always returns no FailureDetail for a successful program result).
evaluator - a new instance of the Evaluator
.
Constructs an Evaluator
instance with the passed-in function used to convert a program F[A]
's result A
to a possible FailureDetail.
Constructs an Evaluator
instance with the passed-in function used to convert a program F[A]
's result A
to a possible FailureDetail. The
default value is used for the function which converts a program failure Throwable
to a possible FailureDetail (the default
function in this case always returns a FailureDetail using the Throwable
to construct it).
evaluator - a new instance of the Evaluator
.
This companion object for
Evaluator
instances provides smart constructors and adefault
value should no customEvaluator
be used when recording a span.