<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.20.0-rc.1" />

OpenTelemetry.Exporter.OpenTelemetryProtocol.Implementation.Serializer.SerializationBuffer

sealed class SerializationBuffer
Manages the buffer used to serialize a single OTLP export request. The buffer is sized from the previous export's serialized length (to avoid resizing without preserving excess capacity) and is sourced via ProtobufSerializer from an array pool, the shared pool unless one is supplied.
public SerializationBuffer(int initialSize, ArrayPool<byte> pool = null)

Manages the buffer used to serialize a single OTLP export request. The buffer is sized from the previous export's serialized length (to avoid resizing without preserving excess capacity) and is sourced via ProtobufSerializer from an array pool, the shared pool unless one is supplied.

public void Discard(byte[] buffer)

Returns a buffer after serialization failed and resets the next rental to the initial size.

public void Release()

Releases any oversized buffer retained for reuse. Called when the exporter shuts down.

public byte[] Rent()

Obtains a buffer for the next export, sized from the previous serialized payload. The buffer contents are not cleared.

public void Return(byte[] buffer, int serializedLength)

Hands a buffer (possibly grown during serialization) back after successful serialization.