Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does ShallowTrace not allow value string for UNFINISHED and EARLY_FINISH ResultType? #31

Closed
brikis98 opened this issue Jun 16, 2013 · 2 comments

Comments

@brikis98
Copy link

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?

@brikis98
Copy link
Author

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 :)

@cpettitt
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants