zinc icon indicating copy to clipboard operation
zinc copied to clipboard

Can the server transaction event class used when log level = 1 be made configurable?

Open gcotelli opened this issue 4 years ago • 1 comments

Right now it's always ZnSimplifiedServerTransactionEvent. I'm implementing some metrics gathering on top of our APIs running on Zinc and I wanted to include one specific header in the simplified event.

By now we managed it by increasing the log level, but actually we don't need the full request and response, if we can provide a different kind of SimplifiedServerTransactionEvent we can just keep the information we need.

What do you think? If you want I can try to provide a PR providing this as an option.

gcotelli avatar Jul 06 '20 14:07 gcotelli

Hi Garbiel,

I looked a bit at the code you referenced.

Injecting custom headers in a request or response, possibly in a processing pipeline (like a proxy), is a well established HTTP technique. What you did makes sense to me, I have done similar things.

This is then picked up automatically by ZnServerTransactionEvent, as it captures the full request and response objects. I think this is quite elegant.

The cost (memory/processing) is very acceptable since these objects already exist during processing, it is almost no extra work.

ZnSimplifiedServerTransactionEvent at level 1 was added as a precaution for possible performance problems (or benchmarking). It was simplified by design.

I can't immediately see how custom log event classes could solve your issue, since you can not access them directly when they are generated.

In summary: I think you did the right thing and there is no need for a change.

Sven

svenvc avatar Jul 10 '20 09:07 svenvc