User Guide (Version 1.15)

Sending Test Metrics with the Metrics Sample Level

After you complete the Prerequisites, you can send test metrics with the Metrics Sample level. You can then view these metrics in the Cloud Gem Portal.

To send test metrics with the Metrics Sample level

  1. Set the CloudGemsSamples as your default project. For more information, see Switching Game Projects.

  2. In Lumberyard Editor, choose File, Open, select MetricsSample, and then click Open.

  3. Press Ctrl+G to enter game mode.

                        Create gameplay events with the Metrics Sample level to send them to
                            the Cloud Gem Portal.
  4. To move forward, strafe left, move backward, and strafe right, press the W, A, S, and D keys, respectively.

  5. Click Send Position to send the translation coordinates of the controllable entity directly to AWS.

  6. Click Send Position (Buffered) to send the translation coordinates of the controllable entity to your local machine.

  7. Click Flush Metrics to send the buffered game events from your local machine to the Cloud Gem Portal.

  8. For Encryption, select Enabled to send generated game events with encryption.

  9. For Compression, select Enabled to compress game events.


    If you select this option, the time to process events in AWS can increase. This can incur additional costs for your AWS account.

  10. Press Esc to exit game mode.

  11. In Lumberyard Editor, choose AWS, Open Cloud Gem Portal.

  12. In the Cloud Gem Portal, on the Cloud Gems page, choose Gem Metrics.

  13. In the Cloud Gem Metrics Portal, you can view metrics for your game. See Using the Game Metrics Cloud Gem Portal.

Examples for Sending Test Metrics

On the UICanvas entity, the Lua Script component references the metricsmainmenu.lua file.

Example Lua Script

The following is a snippet of the metricsmainmenu.lua file. The Lua script specifies the events to collect from the game. You can find the Lua script in the lumberyard_version\dev\CloudGemSamples\Scripts directory.

function MetricsMainMenu:SendPosition(disableBuffer) translationXAttr = CloudGemMetric_MetricsAttribute() translationXAttr:SetName("translationx") translationXAttr:SetDoubleValue(playerTranslation.x) translationYAttr = CloudGemMetric_MetricsAttribute() translationYAttr:SetName("translationy") translationYAttr:SetDoubleValue(playerTranslation.y) translationZAttr = CloudGemMetric_MetricsAttribute() translationZAttr:SetName("translationz") translationZAttr:SetDoubleValue(playerTranslation.z) attribute_list = CloudGemMetric_AttributesSubmissionList() attribute_list.attributes:push_back(translationXAttr) attribute_list.attributes:push_back(translationYAttr) attribute_list.attributes:push_back(translationZAttr) parameter_sensitive = CloudGemMetric_MetricsEventParameter() parameter_sensitive:SetName(parameter_sensitive:GetSensitivityTypeName()) parameter_sensitive:SetVal(self.encrypt) parameter_compression = CloudGemMetric_MetricsEventParameter() parameter_compression:SetName(parameter_compression:GetCompressionModeName()) parameter_compression:SetVal(self.compress) params = CloudGemMetric_EventParameterList() params.parameters:push_back(parameter_sensitive) params.parameters:push_back(parameter_compression) if disableBuffer then -- Send metrics with no file buffer Debug.Log("Sending Metrics with no buffer") UiTextBus.Event.SetText(displayText, "Sending metrics with no file buffer") -- self.UpdateMessage("Sending Metrics with no buffer") CloudGemMetricRequestBus.Broadcast.SendMetrics("translation", attribute_list.attributes, params.parameters) else -- Send metrics with a file buffer Debug.Log("Sending Metrics to buffer") UiTextBus.Event.SetText(displayText, "Sending metrics to buffer") CloudGemMetricRequestBus.Broadcast.SubmitMetrics("translation", attribute_list.attributes, params.parameters) end end

Example C++

The following is a snippet of the MetricManager.cpp file. The C++ file specifies the events to collect from the game. You can find the C++ file in the lumberyard_version\dev\v1\Code\Source directory.

void MetricManager::SendStartEvents() { SubmitMetrics("clientinitcomplete", AZStd::vector<MetricsAttribute>()); SubmitMetrics("sessionstart", AZStd::vector<MetricsAttribute>()); }

Event Attributes

When an event is registered from the game client, the following default attributes are appended to the event.

Client Side Event Attributes

Attributes Description


Identifier of the service provider. The default value is cloudgemmetric.


Build identifier. You can find this value from Lumberyard or as a parameter on the registerEvent function.


Locale in ISO 639-1.


GUID that identifies the message batch of events.


Platform identifier.


Sequence number of the event.


Time stamp of the event in ISO 8601.


Time zone hour of the offset of the player.


Time zone minute of the offset of the player.


Time zone sign of the offset of the player.


Player ID.


Session identifier.

Server Side Event Attributes

Attributes Description


Unique metric identifer created by AWS when the event is received.

srv_tmutc The time stamp in UTC when the event was received.


The following is an event with the attributes.

{ "event": "shot_fired", "weapon_type": "laser", "x": 123, "y": 123, "z": 123, "seqno": 1, "tzs": "-", "tzh": 8, "tzm": 0, "loc": "ISO 639-1", "uid": "cognito-id", "msgid": "GUID", "bldid": "", "pltf": "XBOX|PS4|PC|IOS|ANDROID", "tmutc": "ISO 639-1", "session_id": "GUID", "source": "cloudgemmetric" }