Google.Cloud.Diagnostics.Common - Class BufferOptions (5.1.0)

public sealed class BufferOptions

Reference documentation and code samples for the Google.Cloud.Diagnostics.Common class BufferOptions.

Options that define a buffer.

Inheritance

object > BufferOptions

Namespace

GoogleCloudGoogle.Cloud.DiagnosticsCommon

Assembly

Google.Cloud.Diagnostics.Common.dll

Properties

BufferSizeBytes

public int BufferSizeBytes { get; }

The size of the buffer in bytes, only used for Sized

Property Value
TypeDescription
int

BufferType

public BufferType BufferType { get; }

The type of buffer to be used.

Property Value
TypeDescription
BufferType

BufferWaitTime

public TimeSpan BufferWaitTime { get; }

The time to wait before the buffer is flushed, only used for Timed

Property Value
TypeDescription
TimeSpan

TimerExceptionHandler

public Action<Exception> TimerExceptionHandler { get; }

An action that will be called whenever an exception is thrown during a timed flush of the buffer. May be null. Only used for Timed.

Property Value
TypeDescription
ActionException
Remarks

Throwing an exception within the timer thread risks inmediately crashing the applicaiton, so we never do that, even if ExceptionHandling has been set to Propagate because propagating exceptions is different than crashing an application. Instead, client code can specify a value for this action, that will be called when an exception is thrown within the timer thread. Client code may decide what to do in such cases.

Methods

NoBuffer()

public static BufferOptions NoBuffer()

Create BufferOptions for None

Returns
TypeDescription
BufferOptions

SizedBuffer(int)

public static BufferOptions SizedBuffer(int bufferSizeBytes = 65536)

Create BufferOptions for Sized

Parameter
NameDescription
bufferSizeBytesint

Optional, The buffer size in bytes.

Returns
TypeDescription
BufferOptions

TimedBuffer(TimeSpan?)

public static BufferOptions TimedBuffer(TimeSpan? bufferWaitTime = null)

Create BufferOptions for Timed

Parameter
NameDescription
bufferWaitTimeTimeSpan

Optional, The minimum amount of time between flushes.

Returns
TypeDescription
BufferOptions

WithTimerExceptionHandler(Action<Exception>)

public BufferOptions WithTimerExceptionHandler(Action<Exception> handler)

Creates a new BufferOptions instance which is identical to this one but with the given timer exception handler.

Parameter
NameDescription
handlerActionException
Returns
TypeDescription
BufferOptions