- Notifications
You must be signed in to change notification settings - Fork776
Closed
Description
Describe your environment
No response
What happened?
When exporting a log with bytes in the body, the exporter fails withTypeError: Object of type bytes is not JSON serializable when trying tojson.dumps() it.
Steps to Reproduce
fromtimeimporttime_nsfromopentelemetry.sdk._logs.exportimportConsoleLogExporterfromopentelemetry.sdk._logsimportLogData,LogRecordfromopentelemetry.sdk.util.instrumentationimportInstrumentationScopeexporter=ConsoleLogExporter()exporter.export( [LogData(instrumentation_scope=InstrumentationScope(name="foo"),log_record=LogRecord(timestamp=time_ns(),body={"foo":b"bar"}), ) ])
Expected Result
bytes are a validAnyValue so it should be encoded and exported properly. Check the specification for details.
Actual Result
TypeError: Object of type bytes is not JSON serializableAdditional context
No response
Would you like to implement a fix?
None
Metadata
Metadata
Assignees
Type
Projects
Status
Done