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

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

Open
gcotelli opened this issue Jul 6, 2020 · 1 comment

Comments

@gcotelli
Copy link
Contributor

gcotelli commented Jul 6, 2020

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.

@svenvc
Copy link
Owner

svenvc commented Jul 10, 2020

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

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