AnalyticsET.PreventMultipleFlushesInOneFrame
AnalyticsET.PreventMultipleFlushesInOneFrame
#Overview
name: AnalyticsET.PreventMultipleFlushesInOneFrame
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When true, prevents more than one AnalyticsProviderET instance from flushing in the same frame, allowing the flush and HTTP cost to be amortized.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of AnalyticsET.PreventMultipleFlushesInOneFrame is to control the frequency of data flushing in the Unreal Engine’s Analytics system, specifically for the AnalyticsET provider.
This setting variable is primarily used by the Analytics subsystem, particularly within the AnalyticsET module. It is part of the Engine’s telemetry and data collection system.
The value of this variable is set through the Unreal Engine’s console variable system. It is initialized to true by default in the C++ code, but can be modified at runtime through console commands or configuration files.
The associated variable PreventMultipleFlushesInOneFrame directly interacts with it. They share the same value and purpose.
Developers must be aware that when this variable is set to true, it prevents multiple AnalyticsProviderET instances from flushing data in the same frame. This is designed to optimize performance by amortizing the flush and HTTP costs.
Best practices when using this variable include:
- Leaving it enabled (true) in most cases to optimize performance.
- Only disabling it if there’s a specific need for multiple flushes in a single frame, which should be rare.
- Monitoring analytics data to ensure that important information is not being delayed too long due to this optimization.
Regarding the associated variable PreventMultipleFlushesInOneFrame:
This is the actual boolean variable that stores the state controlled by the console variable. It is used in the FAnalyticsProviderET::Tick function to determine whether to allow a flush operation.
When PreventMultipleFlushesInOneFrame is true and a flush has already occurred in the current frame, the system will defer the flush until the next frame. This behavior is logged at the Verbose level for debugging purposes.
Developers should be aware that modifying the console variable AnalyticsET.PreventMultipleFlushesInOneFrame will directly affect the behavior of this associated variable. They should use the console variable for runtime modifications rather than attempting to change the associated variable directly in code.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Analytics/AnalyticsET/Private/IAnalyticsProviderET.cpp:27
Scope (from outer to inner):
file
namespace AnalyticsProviderETCvars
Source code excerpt:
static bool PreventMultipleFlushesInOneFrame = true;
FAutoConsoleVariableRef CvarPreventMultipleFlushesInOneFrame(
TEXT("AnalyticsET.PreventMultipleFlushesInOneFrame"),
PreventMultipleFlushesInOneFrame,
TEXT("When true, prevents more than one AnalyticsProviderET instance from flushing in the same frame, allowing the flush and HTTP cost to be amortized.")
);
TAutoConsoleVariable<bool> CVarDefaultUserAgentCommentsEnabled(
TEXT("AnalyticsET.UserAgentCommentsEnabled"),
#Associated Variable and Callsites
This variable is associated with another variable named PreventMultipleFlushesInOneFrame
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Analytics/AnalyticsET/Private/IAnalyticsProviderET.cpp:25
Scope (from outer to inner):
file
namespace AnalyticsProviderETCvars
Source code excerpt:
namespace AnalyticsProviderETCvars
{
static bool PreventMultipleFlushesInOneFrame = true;
FAutoConsoleVariableRef CvarPreventMultipleFlushesInOneFrame(
TEXT("AnalyticsET.PreventMultipleFlushesInOneFrame"),
PreventMultipleFlushesInOneFrame,
TEXT("When true, prevents more than one AnalyticsProviderET instance from flushing in the same frame, allowing the flush and HTTP cost to be amortized.")
);
TAutoConsoleVariable<bool> CVarDefaultUserAgentCommentsEnabled(
TEXT("AnalyticsET.UserAgentCommentsEnabled"),
true,
#Loc: <Workspace>/Engine/Source/Runtime/Analytics/AnalyticsET/Private/IAnalyticsProviderET.cpp:343
Scope (from outer to inner):
file
function bool FAnalyticsProviderET::Tick
Source code excerpt:
if (bShouldFlush)
{
if (GFrameCounter == LastFrameCounterFlushed && AnalyticsProviderETCvars::PreventMultipleFlushesInOneFrame)
{
UE_LOG(LogAnalytics, Verbose, TEXT("[%s] Tried to flush, but another analytics provider has already flushed this frame. Deferring until next frame."), *Config.APIKeyET);
}
else
{
// Just flush one payload, even if we may have more than one queued.