asynquence icon indicating copy to clipboard operation
asynquence copied to clipboard

Investigate: long stack traces support

Open getify opened this issue 11 years ago • 14 comments

getify avatar Nov 14 '14 00:11 getify

Why do you mean by long stack traces?

legodude17 avatar Jul 28 '16 03:07 legodude17

check out bluebird's "long stack traces". It has to do with being able to trace/inspect the entire async stack of operations that preceded an error.

getify avatar Jul 28 '16 14:07 getify

Ah, so something like what bluebird does, just put into asynquence.

On Thu, Jul 28, 2016 at 7:09 AM, Kyle Simpson [email protected] wrote:

check out bluebird's "long stack traces". It has to do with being able to trace/inspect the entire async stack of operations that preceded an error.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/getify/asynquence/issues/57#issuecomment-235905548, or mute the thread https://github.com/notifications/unsubscribe-auth/AKr56KXTk5igMlFyv1kfzrdzy0rMhs_hks5qaLg2gaJpZM4C6-yA .

legodude17 avatar Jul 28 '16 20:07 legodude17

Early investigation shows that bluebird and when do this, and it would be at least 150 lines, probably around 250 - 300.

legodude17 avatar Jul 31 '16 00:07 legodude17

Thank you for the estimates. I am partially concerned about "cost" (file size, perf) and partially concerned about the best way to configure it (per chain) -- default on or off? -- and also concerned about the best way to make the stack trace available. lots to think about.

getify avatar Jul 31 '16 00:07 getify

The cost is quite big. One way is to have it on according to environment variables. You could also add a ASQ.config function.

legodude17 avatar Jul 31 '16 00:07 legodude17

Want this to work in browser too. So no on env vars. Should also investigate if there are other things that should be configurable per instance and if so, make sure we expose this config consistently.

getify avatar Jul 31 '16 01:07 getify

I now think the best way to do this would be to just provide a platform so that a monitor and reporter can be built in separate files. This will also allow people to make thier own monitoring functionality. This is what when does.

legodude17 avatar Jul 31 '16 16:07 legodude17

Do you have any links to read more about this?

getify avatar Jul 31 '16 19:07 getify

Perhaps a way to specify a listener on a sequence that is notified for each step, so someone else could hook into that from the outside and listen to an entire sequence, whether it's error or not.

getify avatar Jul 31 '16 19:07 getify

I got this from reading when's code. Relevant files:

The main limit to doing this as a plugin is that plugins can't listen for events. Maybe we could add that?

legodude17 avatar Jul 31 '16 19:07 legodude17

Basics are done now: Output without long trace:

Error: Ahhh!
    at Timeout.$$timeout [as _onTimeout] (/home/jdb/Desktop/Code/ASQDev/asynquence/test-long-trace.js:9:45)
    at tryOnTimeout (timers.js:224:11)
    at Timer.listOnTimeout (timers.js:198:5)

Output with lone trace:

Error: Ahhh!
    at Timeout.$$timeout [as _onTimeout] (/home/jdb/Desktop/Code/ASQDev/asynquence/test-long-trace.js:9:45)
    at Object.<anonymous> (/home/jdb/Desktop/Code/ASQDev/asynquence/test-long-trace.js:5:1)

With this code:

var ASQ = require("./contrib/contrib.src.js");
try { ASQ.messages(); } catch (err) {
    ASQ = ASQ( require("./asq.src.js") );
}
ASQ().then(function $$handle(done) {
    setTimeout(function () {ASQ().then(handle).pipe(done); }, 100);
});
function handle(done) {
    setTimeout(function $$timeout() {done.fail(new Error('Ahhh!'))}, 100);
}

legodude17 avatar Aug 01 '16 16:08 legodude17

The method to do this adds 27 unminified lines to asq.src.js and adds a 153 line plugin in contrib.

legodude17 avatar Aug 01 '16 16:08 legodude17

Full fork is here

legodude17 avatar Aug 09 '16 23:08 legodude17