![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <AnalyticsProviderETEventCache.h>
Classes | |
| class | Lock |
Static Public Member Functions | |
| static ANALYTICSET_API void | OnStartupModule () |
Friends | |
| class | Lock |
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 | ( | 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. |
| void FAnalyticsProviderETEventCache::AddToCache | ( | FString | EventName | ) |
| 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.
| bool FAnalyticsProviderETEventCache::CanFlush | ( | ) | const |
Determines whether we have anything we need to flush, either a queued flush or existing events in the payload.
| TArray< uint8 > FAnalyticsProviderETEventCache::CreateImmediatePayload | ( | const FString & | EventName, |
| const TArray< FAnalyticsEventAttribute > & | Attributes | ||
| ) | const |
Creates a immediate payload with the existing default attributes
| 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.
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.
| FAnalyticsEventAttribute FAnalyticsProviderETEventCache::GetDefaultAttribute | ( | int32 | AttributeIndex | ) | const |
Range checking is not done, similar to TArray. Use GetDefaultAttributeCount() first!
| int32 FAnalyticsProviderETEventCache::GetDefaultAttributeCount | ( | ) | const |
| TArray< FAnalyticsEventAttribute > FAnalyticsProviderETEventCache::GetDefaultAttributes | ( | ) | const |
| int FAnalyticsProviderETEventCache::GetNumCachedEvents | ( | ) | const |
Gets the number of cached events (doesn't include any flushes that are already queued for flush).
| int32 FAnalyticsProviderETEventCache::GetSetPreallocatedPayloadSize | ( | ) | const |
Gets the preallocated size of the payload buffer.
| 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.
|
static |
| 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.
| void FAnalyticsProviderETEventCache::SetPreallocatedPayloadSize | ( | int32 | InSetPreallocatedPayloadSize | ) |
Sets the preallocated payload size
| InPreallocatedCacheSize | size to preallocate the payload buffer to during init and after flushing. If negative, will match the INI-configured MaximumPayloadSize. |