Add param for indent size to LogRecord.to_json()#2870
Add param for indent size to LogRecord.to_json()#2870srikanthccv merged 5 commits intoopen-telemetry:mainfrom
Conversation
|
I just want to call out couple of things based on your usage. The |
Thank you for the call out! If the console exporter gets dropped, is it safe to assume that |
|
Maybe, but we do not guarantee anything about logs SDK. |
|
@dougramirez please fix the conflicts in this PR |
Description
This change will allow callers to the LogRecord.to_json() func to specify an
indent. Previously the func used4as theindent. The consequences of that hard coding meant that log records were being emitted on > 1 line.This PR will allow callers to send
Noneto the func, which allows the LogRecord to be emitted on a single line. This has the benefit of allowing downstream consumers to read the log as single line and index its keys for queries.The example below shows how this can be leveraged by sending the
indentlevel as a param to the LogRecord.to_json() func as part of a formatter to the exporter.This addresses an issue previously documented here: Single log line
logs.pyType of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Does This PR Require a Contrib Repo Change?
Checklist: