Closed ercpe closed 3 years ago
Looks good to me, thanks!
One minor remark: would you mind changing value_repr
to _value_repr
to mark it as private? Even on subclassing, this should not cause any issues.
I'm going to test the changes a bit and then probably merge it
Sure. I've updated the PR.
Thank you for merging. Any ETA on a release which includes this commit? :innocent:
I hope on the upcoming weekend :).
Done.
When building the logstash JSON document, the
_get_record_fields
tests for various types to provide a sane default configuration to convert values into JSON-serializable values. We noticed that the_get_record_fields
spend a lot of time inisinstance
checks, which hurts performance as it has to check every entry in the class hierarchy. Before,_get_record_fields
would do 4 extraisinstance
tests before deciding that the value can be passed along without modification. Since most log kwargs are probably simple types, reorder the tests so that simple types are tested first.Additionally, move the inner
value_repr
into the class to allow subclasses to override the implementation without having to reimplement_get_record_fields
.