Allow users to pass an io.Writer
to protojson
#20049
Labels
untriaged
auto added to all issues by default when created.
What language does this apply to?
Golang (protocolbuffers/protobuf-go)
Describe the problem you are trying to solve.
As part of open-telemetry/opentelemetry-collector#7095 we would like to switch to the new Protobuf Opaque API to increase the performance of opentelemetry-collector (specifically when exporting telemetry as JSON).
We would like to use encoding/protojson for this, but the current implementation doesn't allow users to pass an
io.Writer
.The only method available to encode JSON is:
Describe the solution you'd like
We would like to see a solution similar to
encoding/json
'sEncoder
, where a new encoder can be created by passing anio.Writer
and we can callEncode(obj)
.This will prevent the use of a buffer that will only impact the encoding performance.
Describe alternatives you've considered
None
Additional context
cc/ @stapelberg, @els0r
The text was updated successfully, but these errors were encountered: