engine
 
载入中...
搜索中...
未找到
类 | Public 成员函数 | 所有成员列表
FAnalyticsProviderETEventCache类 参考

Mixin class for Epic Telemetry implementors. 更多...

#include <AnalyticsProviderETEventCache.h>

类

class  Lock
 For when you need to take a lock across multiple API calls 更多...
 

Public 成员函数

void AddToCache (FString EventName, const TArray< FAnalyticsEventAttribute > &Attributes)
 Adds a new event to the cache. 更多...
 
bool CanFlush () const
 Determines whether we have anything we need to flush, either a queued flush or existing events in the payload.
 
 FAnalyticsProviderETEventCache (int32 MaximumPayloadSize=-1, int32 InPreallocatedPayloadSize=-1)
 Default ctor. 更多...
 
FString FlushCache (SIZE_T *OutEventCount=nullptr)
 Flushes the cache as a string. 更多...
 
TArray< uint8 > FlushCacheUTF8 ()
 Flushes the cache as a UTF8 char array. 更多...
 
FAnalyticsEventAttribute GetDefaultAttribute (int32 AttributeIndex) const
 Range checking is not done, similar to TArray. 更多...
 
int32 GetDefaultAttributeCount () const
 
TArray< FAnalyticsEventAttribute > GetDefaultAttributes () const
 
int GetNumCachedEvents () const
 Gets the number of cached events (doesn't include any flushes that are already queued for flush).
 
int32 GetSetPreallocatedPayloadSize () const
 Gets the preallocated size of the payload buffer.
 
bool HasFlushesQueued () const
 Lets external code know that there are payloads queued for flush. 更多...
 
void SetDefaultAttributes (TArray< FAnalyticsEventAttribute > &&DefaultAttributes)
 Sets an array of attributes that will automatically be appended to any event that is sent. 更多...
 
void SetPreallocatedPayloadSize (int32 InSetPreallocatedPayloadSize)
 Sets the preallocated payload size 更多...
 

详细描述

Mixin class for Epic Telemetry implementors.

The purpose of this class is to support the concept of caching events that are added via the standard RecordEvent API and serializing them into a payload in a Json format compatible with Epic's backend data collectors. The job of transporting these payloads to an external collector (generally expected to be via HTTP) is left to higher level classes to implement.

All public APIs in this class are threadsafe. Implemented via crappy critical sections for now, but they are safe.

构造及析构函数说明

◆ FAnalyticsProviderETEventCache()

FAnalyticsProviderETEventCache::FAnalyticsProviderETEventCache ( int32  MaximumPayloadSize = -1,
int32  InPreallocatedPayloadSize = -1 
)

Default ctor.

参数
InPreallocatedPayloadSize- size to preallocate the payload buffer to during init and after flushing. If negative, will match the INI-configured MaximumPayloadSize.
MaximumPayloadSize- size before a payload will be queued for flush. This ensures that no payload ever gets too large. See AddToCache() and HasFlushesQueued() for details. If negative, will use INI-configured value: Engine:[AnalyticsProviderETEventCache]MaximumPayloadSize, or 100KB if not configured.

成员函数说明

◆ AddToCache()

void FAnalyticsProviderETEventCache::AddToCache ( FString  EventName,
const TArray< FAnalyticsEventAttribute > &  Attributes 
)

Adds a new event to the cache.

If the estimated payload size will increase beyond MaximumPayloadSize then a flush will be queued here. This will make HasFlushesQueued() == true.

◆ FlushCache()

FString FAnalyticsProviderETEventCache::FlushCache ( SIZE_T *  OutEventCount = nullptr)

Flushes the cache as a string.

This method is inefficient because we build up the array directly as UTF8. If nothing is cached, returns an empty string.

◆ FlushCacheUTF8()

TArray< uint8 > FAnalyticsProviderETEventCache::FlushCacheUTF8 ( )

Flushes the cache as a UTF8 char array.

Returns a uint8 because that's what IHttpRequest prefers. If nothing is cached, returns an empty array.

◆ GetDefaultAttribute()

FAnalyticsEventAttribute FAnalyticsProviderETEventCache::GetDefaultAttribute ( int32  AttributeIndex) const

Range checking is not done, similar to TArray.

Use GetDefaultAttributeCount() first!

返回
one attribute of the default attributes so we don't have to copy the entire attribute array.

◆ GetDefaultAttributeCount()

int32 FAnalyticsProviderETEventCache::GetDefaultAttributeCount ( ) const
返回
the number of default attributes are currently being applied.

◆ GetDefaultAttributes()

TArray< FAnalyticsEventAttribute > FAnalyticsProviderETEventCache::GetDefaultAttributes ( ) const
返回
the current array of default attributes.

◆ HasFlushesQueued()

bool FAnalyticsProviderETEventCache::HasFlushesQueued ( ) const

Lets external code know that there are payloads queued for flush.

This happens when AddCache() calls cause the payload size to exceed MaxPayloadSize. Calling code needs to notice this and flush the queue.

◆ SetDefaultAttributes()

void FAnalyticsProviderETEventCache::SetDefaultAttributes ( TArray< FAnalyticsEventAttribute > &&  DefaultAttributes)

Sets an array of attributes that will automatically be appended to any event that is sent.

Logical effect is like adding them to all events before calling RecordEvent. Practically, it is implemented much more efficiently from a storage and allocation perspective.

◆ SetPreallocatedPayloadSize()

void FAnalyticsProviderETEventCache::SetPreallocatedPayloadSize ( int32  InSetPreallocatedPayloadSize)

Sets the preallocated payload size

参数
InPreallocatedCacheSizesize to preallocate the payload buffer to during init and after flushing. If negative, will match the INI-configured MaximumPayloadSize.

该类的文档由以下文件生成: