AnalyticsET.PayloadPercentageOfMaxForWarning

AnalyticsET.PayloadPercentageOfMaxForWarning

#Overview

name: AnalyticsET.PayloadPercentageOfMaxForWarning

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of AnalyticsET.PayloadPercentageOfMaxForWarning is to set a threshold for triggering warning messages about large payloads in the Analytics Event Tracker (ET) system. This setting is part of Unreal Engine’s analytics subsystem, specifically within the AnalyticsET module.

This setting variable is primarily used in the AnalyticsET module, which is responsible for tracking and sending analytics events. It’s particularly relevant to the FAnalyticsProviderETEventCache class, which handles caching and flushing of analytics events.

The value of this variable is set through an FAutoConsoleVariableRef, which means it can be adjusted at runtime via console commands. By default, it’s set to 1.00f (100%).

This variable interacts closely with another variable named PayloadPercentageOfMaxForWarning within the EventCacheStatic namespace. They share the same value and purpose.

Developers must be aware that this variable affects when warning messages are triggered for large payloads. If the size of the cached events exceeds the percentage of the maximum payload size specified by this variable, a warning message will be logged, listing all the events in the payload. This is intended to help investigate cases of spammy or slow telemetry.

Best practices when using this variable include:

  1. Monitoring the warning messages to identify and address potential issues with analytics event generation.
  2. Adjusting the value based on your project’s specific needs and performance characteristics.
  3. Using it in conjunction with other analytics settings to fine-tune the behavior of the analytics system.

Regarding the associated variable PayloadPercentageOfMaxForWarning: This is the actual float variable that stores the percentage value. It’s defined within the EventCacheStatic namespace and is directly referenced by the FAnalyticsProviderETEventCache::QueueFlush function to determine if a payload is too large.

The purpose and usage of this associated variable are identical to AnalyticsET.PayloadPercentageOfMaxForWarning. It’s the internal representation of the console variable and is used in the actual comparison logic within the analytics system.

Developers should note that modifying the console variable AnalyticsET.PayloadPercentageOfMaxForWarning will directly affect this associated variable, and thus the behavior of the analytics event caching system.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Analytics/AnalyticsET/Private/AnalyticsProviderETEventCache.cpp:17

Scope (from outer to inner):

file
namespace    EventCacheStatic

Source code excerpt:

	static float PayloadPercentageOfMaxForWarning = 1.00f;
	FAutoConsoleVariableRef CvarPayloadPercentageOfMaxForWarning(
		TEXT("AnalyticsET.PayloadPercentageOfMaxForWarning"),
		PayloadPercentageOfMaxForWarning,
		TEXT("Percentage of the maximum payload for an EventCache that will trigger a warning message, listing the events in the payload. This is intended to be used to investigate spammy or slow telemetry.")
	);

	static float PayloadFlushTimeSecForWarning = 0.001f;
	FAutoConsoleVariableRef CvarPayloadFlushTimeSecForWarning(

#Associated Variable and Callsites

This variable is associated with another variable named PayloadPercentageOfMaxForWarning. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Analytics/AnalyticsET/Private/AnalyticsProviderETEventCache.cpp:15

Scope (from outer to inner):

file
namespace    EventCacheStatic

Source code excerpt:

namespace EventCacheStatic
{
	static float PayloadPercentageOfMaxForWarning = 1.00f;
	FAutoConsoleVariableRef CvarPayloadPercentageOfMaxForWarning(
		TEXT("AnalyticsET.PayloadPercentageOfMaxForWarning"),
		PayloadPercentageOfMaxForWarning,
		TEXT("Percentage of the maximum payload for an EventCache that will trigger a warning message, listing the events in the payload. This is intended to be used to investigate spammy or slow telemetry.")
	);

	static float PayloadFlushTimeSecForWarning = 0.001f;
	FAutoConsoleVariableRef CvarPayloadFlushTimeSecForWarning(
		TEXT("AnalyticsET.PayloadFlushTimeSecForWarning"),

#Loc: <Workspace>/Engine/Source/Runtime/Analytics/AnalyticsET/Private/AnalyticsProviderETEventCache.cpp:389

Scope (from outer to inner):

file
function     void FAnalyticsProviderETEventCache::QueueFlush

Source code excerpt:

	// see if it took too long or we have a really large payload. If so, log out the events.
	const double EndTime = FPlatformTime::Seconds();
	const bool bPlayloadTooLarge = CachedEventUTF8Stream.Num() > (int32)((float)MaximumPayloadSize * EventCacheStatic::PayloadPercentageOfMaxForWarning);
	const bool bTookTooLongToFlush = (EndTime - StartTime) > EventCacheStatic::PayloadFlushTimeSecForWarning;
	if (bPlayloadTooLarge)
	{
		
		UE_LOG(LogAnalytics, Warning, TEXT("EventCache payload exceeded the maximum allowed size (%.3f KB > %.3f KB), containing %d events. Listing events in the payload for investigation:"),
			(float)CachedEventUTF8Stream.Num() / 1024.f,
			((float)MaximumPayloadSize * EventCacheStatic::PayloadPercentageOfMaxForWarning) / 1024.f,
			CachedEventEntries.Num());
		for (const FAnalyticsEventEntry& Entry : CachedEventEntries)
		{
			UE_LOG(LogAnalytics, Warning, TEXT("    %s,%d"), *Entry.EventName, Entry.EventSizeChars);
		}
	}