Open 3D Engine AWSMetrics Gem API Reference  24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AWSMetrics::MetricsQueue Class Reference

MetricsQueue is used to buffer the submitted metrics before sending them in batch to the backend or local file. More...

#include <MetricsQueue.h>

Public Member Functions

const MetricsEventoperator[] (int index) const
 
void AddMetrics (const MetricsEvent &metrics)
 
void AppendMetrics (MetricsQueue &metricsQueue)
 
void PushMetricsToFront (MetricsQueue &metricsQueue)
 
int FilterMetricsByPriority (size_t maxSizeInBytes)
 
void ClearMetrics ()
 
int GetNumMetrics () const
 
size_t GetSizeInBytes () const
 
AZStd::string SerializeToJson ()
 
bool SerializeToJson (AWSCore::JsonWriter &writer) const
 
void PopBufferedEventsByServiceLimits (MetricsQueue &bufferedEvents, int maxPayloadSizeInMb, int maxBatchedRecordsCount)
 
bool ReadFromJson (const AZStd::string &filePath)
 

Detailed Description

MetricsQueue is used to buffer the submitted metrics before sending them in batch to the backend or local file.

Member Function Documentation

◆ AddMetrics()

void AWSMetrics::MetricsQueue::AddMetrics ( const MetricsEvent metrics)

Add a new metrics to the queue.

Parameters
metricsMetrics to add.

◆ AppendMetrics()

void AWSMetrics::MetricsQueue::AppendMetrics ( MetricsQueue metricsQueue)

Append an existing metrics queue to the current queue.

Parameters
metricsQueuemetrics queue to append.

◆ ClearMetrics()

void AWSMetrics::MetricsQueue::ClearMetrics ( )

Empty the metrics queue. Unsubmitted metrics will be lost after this operation.

◆ FilterMetricsByPriority()

int AWSMetrics::MetricsQueue::FilterMetricsByPriority ( size_t  maxSizeInBytes)

Filter out lower priority metrics event in the queue if the queue size reaches the maximum capacity.

Parameters
maxSizeInBytesMaximum capacity of the queue.
Returns
Total number of metrics events dropped because of the size limit.

◆ GetSizeInBytes()

size_t AWSMetrics::MetricsQueue::GetSizeInBytes ( ) const

Get the total size of all the metrics inside the queue.

Returns
size of the queue in bytes

◆ PopBufferedEventsByServiceLimits()

void AWSMetrics::MetricsQueue::PopBufferedEventsByServiceLimits ( MetricsQueue bufferedEvents,
int  maxPayloadSizeInMb,
int  maxBatchedRecordsCount 
)

Pop buffered metrics events by the payload size and record count limits and add them to a new queue.

Parameters
bufferedEventsThe metrics queue to store poped metrics events.
maxPayloadSizeInMbMaximum size for the service API request payload.
maxBatchedRecordsCountMaximum number of records sent in a service API request.

◆ PushMetricsToFront()

void AWSMetrics::MetricsQueue::PushMetricsToFront ( MetricsQueue metricsQueue)

Push an existing metrics queue to the front of the current queue.

Parameters
metricsQueuemetrics queue to push.

◆ ReadFromJson()

bool AWSMetrics::MetricsQueue::ReadFromJson ( const AZStd::string &  filePath)

Read from a local JSON file to the metrics queue.

Parameters
filePathPath to the local JSON file.
Returns
Whether the metrics queue is created successfully.

◆ SerializeToJson() [1/2]

AZStd::string AWSMetrics::MetricsQueue::SerializeToJson ( )

Serialize the metrics events queue to a string.

Returns
Serialized string.

◆ SerializeToJson() [2/2]

bool AWSMetrics::MetricsQueue::SerializeToJson ( AWSCore::JsonWriter &  writer) const

Serialize the metrics queue to JSON for sending requests.

Parameters
writerJSON writer for the serialization.
Returns
Whether the metrics queue is serialized successfully.

The documentation for this class was generated from the following file: