class documentation
class MetricBuffer: (source)
Constructor: MetricBuffer(buffer_size, duration_format)
A buffer that can be set on TelemetryConfig to record
metrics instead of ignoring/exporting them.
Warning
It is important that the buffer size is set to a high number and that
retrieve_updates is called regularly to drain the buffer. If
the buffer is full, metric updates will be dropped and an error will be
logged.
| Method | __init__ |
Create a buffer with the given size. |
| Method | retrieve |
Drain the buffer and return all metric updates. |
| Instance Variable | _buffer |
Undocumented |
| Instance Variable | _durations |
Undocumented |
| Instance Variable | _runtime |
Undocumented |
def __init__(self, buffer_size:
int, duration_format: MetricBufferDurationFormat = MetricBufferDurationFormat.MILLISECONDS):
(source)
¶
Create a buffer with the given size.
Warning
It is important that the buffer size is set to a high number and is
drained regularly. See MetricBuffer warning.
| Parameters | |
bufferint | Size of the buffer. Set this to a large value. A value in the tens of thousands or higher is plenty reasonable. |
durationMetricBufferDurationFormat | Which duration format to use. |
Drain the buffer and return all metric updates.
Warning
It is important that this is called regularly. See
MetricBuffer warning.
| Returns | |
Sequence[ | A sequence of metric updates. |