You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating an instance of the ShallowTrace class (using the ShallowTraceBuilder), two of the constructor parameters are ResultType resultType and String value. The value parameter seems like the most appropriate place to put some String representation of the result of an asynchronous operation or an error message if the operation failed.
However, the ShallowTrace class throws an exception if you try to set a value when using it with ResultType.EARLY_FINISH and ResultType.UNFINISHED. The problem with this is that there are cases where you'd want to set the value parameter to some specific message but still use a ResultType or EARLY_FINISH or UNFINISHED. For example, when some operation times out, I'd want ResultType to be EARLY_FINISH and the value to be the message from the TimeoutException, such as "this action exceeded its SLA of 500ms".
Is it possible to remove the "is value set" check from ShallowTrace or is it actually protecting against something I'm overlooking?
The text was updated successfully, but these errors were encountered:
Oh, also worth noting: I'm using the ShallowTraceBuilder directly because I'm adding parseq-style tracing to the Play/Scala asynchronous code. @cpettitt, remind me to demo it to you, it's cool stuff :)
EARLY_FINISH and UNFINISHED have very specific meanings that preclude having a value. EARLY_FINISH means that the task was never run because the parent task finished before getting to the task. UNFINISHED means that at the time the trace snapshot was taken the task was not yet finished. For the timeout example, SUCCESS or ERROR are appropriate result types and both allow a value to be set.
When creating an instance of the
ShallowTrace
class (using theShallowTraceBuilder
), two of the constructor parameters areResultType resultType
andString value
. Thevalue
parameter seems like the most appropriate place to put some String representation of the result of an asynchronous operation or an error message if the operation failed.However, the
ShallowTrace
class throws an exception if you try to set a value when using it withResultType.EARLY_FINISH
andResultType.UNFINISHED
. The problem with this is that there are cases where you'd want to set thevalue
parameter to some specific message but still use aResultType
orEARLY_FINISH
orUNFINISHED
. For example, when some operation times out, I'd wantResultType
to beEARLY_FINISH
and the value to be the message from theTimeoutException
, such as "this action exceeded its SLA of 500ms".Is it possible to remove the "is value set" check from
ShallowTrace
or is it actually protecting against something I'm overlooking?The text was updated successfully, but these errors were encountered: