IN THIS ARTICLE
Advanced Topics for the AWS Metrics Gem
The AWS Metrics Gem provides two
AWSMetricsSystemComponent console commands to dump statistics and enable/disable offline recording.
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.
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
You can change a few client settings in the client configuration file
Configurable settings include the following.
|OfflineRecording||Whether 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
|MaxQueueSizeInMb||Maximum 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.
|QueueFlushPeriodInSeconds||Flush period (in seconds) for flushing the metrics events queue.|
Defaults to 60.
|MaxNumRetries||Maximum number of retries for sending metrics events before dropping them.|
Defaults to 1.
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
api_spec.json inside your AWS CDK application. You will need to rebuild your project and redeploy your AWS CDK application after this change.
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 .