kiev icon indicating copy to clipboard operation
kiev copied to clipboard

Why can't we just automatically persist all fields from payload instead of `persistent_log_fields` setting

Open ababich opened this issue 5 years ago • 1 comments

Hi! I'm trying to understand the idea behind this limitation to put a set of fields as persistent_log_fields

when we build payload (or Kiev[:]) during the request execution we can expect that all fields in execution stack will accumulate. If the same key used - it is safe to assume that they will be overridden

in this case, payload object serves as a global context which you may expand dynamically during the request

in fact, right now, I need to put all possible values as persistent_log_fields and as they will be in log only if not nil I just add context information where possible - this creates some sort of code smell when I need to list all possible fields in one place

Thanks!

ababich avatar Jul 11 '20 00:07 ababich

IF you need some fields every time you log an event then yes. you have to use the payload fields whitelisting. But in most cases the Kiev.event(:some_name, here: "any", fields: "you", can: "think, of: 1) is enough :)

RaVbaker avatar Jul 29 '20 19:07 RaVbaker