Fork me on GitHub
#pedestal
<
2024-04-01
>
hlship18:04:04

An idea I had: what if, after each interceptor executes, we could (when tracing) log which interceptor executed and what changes to the context occurred?

🆒 4
souenzzo20:04:03

I've needed this a few times

phill23:04:27

Yes, if an outer interceptor or routing map could stick something into the context that meant "please log the interceptor transitions for this request" [which could even be retroactive to any prior interceptors that had already handled it], that would be super! As to the level of detail - I would be happy with the minimum, i.e., name of interceptor and whether it made any changes at all. Once the systemic logging has brought me up to speed on which interceptors are relevant, then I can expressly log further details myself. In other words, it would be a matter of diminishing returns for Pedestal to try to figure out the helpful level of detail.

hlship23:04:26

I’ve also been thinking about a event based system, where events would be broadcast (i..e, a function would be invoked) after each interceptor’s execution, passing before-and-after context map (possibly, with some internal-use-only keys dissoc’ed). What I described above could be built on top of that, though not necessarily phill’s suggestion (as it is retroactive and stateful).

souenzzo00:04:19

A function: tap> Maybe this can be part of "interceptor compiling" step.

hlship02:04:06

I’ve felt that tap> should be reserved for the application to do as it sees fit; the moment we have libraries/frameworks using tap> is the moment we start having issues with conflicting things being tap-ed.

jmv03:04:41

Will there be otel trace spans for these events? That seems like it could be useful and would remove a lot of the manual span creation in my apps.

hlship04:04:32

I don’t have a detailed design. That being said, the challenge is knowing when to stop a started span. Also, spans that last microseconds aren’t useful; just those that do I/o and can block for an appreciable amount of time.

hlship04:04:17

So span for each interceptor is not useful and will generate a lot of noise.

jmv04:04:21

Good point

Ludger Solbach21:04:03

interceptor interceptors 😜. But it could be helpful in debugging.