Version:

Advanced Topics for the AWS Metrics Gem

Console command

The AWS Metrics Gem provides two AWSMetricsSystemComponent console commands to dump statistics and enable/disable offline recording.

DumpStats

Used to show statistics for the metrics submission in the console. Statistics include the following.

  • Total number of events sent to the local file or AWS-backed backend.
  • Total number of successes.
  • Total number of failures.
  • Total number of drops.
AWSMetricsSystemComponent.DumpStats

EnableOfflineRecording

Used to enable/disable offline recording. If this feature is enabled, metrics events will be sent to a local file. You have the option to resubmit events stored in the local file by specifying the submit argument when disabling the feature.

AWSMetricsSystemComponent.EnableOfflineRecording false submit

Client configuration

You can change a few client settings in the client configuration file Gems\AWSMetrics\Code\Registry\awsMetricsClientConfiguration.setreg.

Configurable settings include the following.

SettingsDescription
OfflineRecordingWhether send metrics to a local file instead of the AWS-backed backend.
Defaults to false.
You can change this setting at runtime using the console command AWSMetricsSystemComponent.EnableOfflineRecording.
MaxQueueSizeInMbMaximum size (in MB) for the local buffer for sending metrics events in batch.
Defaults to 0.3.
Suggested to be less than 5 MB due to the limit for the Kinesis Data Stream. Refer to the Amazon Kinesis PutRecords documentation for more information.
QueueFlushPeriodInSecondsFlush period (in seconds) for flushing the metrics events queue.
Defaults to 60.
MaxNumRetriesMaximum number of retries for sending metrics events before dropping them.
Defaults to 1.

Metrics event schema

The AWS Metrics Gem uses an Event JSON Schema for validating the metrics events submitted from the client or sent to the Service API. Any metrics event that fails the validation will be dropped. Any custom metrics attributes that are not defined in the schema will be added to the event_data field of the metrics event as a flat JSON dictionary.

If you want to customize the schema, update it in both Gems\AWSMetrics\Code\Include\Public\AWSMetricsConstant.h and api_spec.json inside your AWS CDK application. You will need to rebuild your project and redeploy your AWS CDK application after this change.

Migrate to production-ready solution

The sample AWS CDK application provides a reasonable starting point to use AWS analytics services that is thoughtful with respect to security, cost, and usability. Experienced developers can also customize the AWS CDK application or even migrate it to the production-ready solution detailed in the AWS guide on the Game Analytics Pipeline .