Skip to content

Using orjson for serialization #112

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

Closed
mj0nez opened this issue May 9, 2024 · 3 comments · Fixed by #114
Closed

Using orjson for serialization #112

mj0nez opened this issue May 9, 2024 · 3 comments · Fixed by #114

Comments

@mj0nez
Copy link
Contributor

mj0nez commented May 9, 2024

Hi,

While reading Structlog’s performance guide, I wondered how to integrate orjson with ecs_logging.StructlogFormatter. From what I gathered, the standard library’s json module is used in _utils.json_dumps to provide encoding for both formatters. Would you consider a configurable serializer for this project, to gain some performance? I assume the integration would be pretty straightforward, besides some minor changes in json_dumps and a new optional argument for the formatters’ initializers. If you agree, I would be happy to contribute. :)

@xrmx
Copy link
Member

xrmx commented May 10, 2024

This may be interesting but before making overriding the json serializer a first class citizen I would make it possible for users to provide custom classes inherited from ours. So after making to possible to pass another serializer to json_dumps I'll just move the json_dumps call in StructlogFormatter.__call__ to an internal helper that may be overridden.

@thijsmie
Copy link

Hi @xrmx, is there a timeline for the next release? This and another small feature are on my wish list for sure!

@xrmx
Copy link
Member

xrmx commented Jun 13, 2024

@thijsmie there's no timeline, but we'll cut a new release eventually in the near future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants