API Stream Analytics
You can use the API Stream Analytics page to build custom queries against:
- The API request calls that have been made into the platform.
- The messages sent out from the platform.
The API Stream page is designed to allow you to quickly build a query for the API data you want to review and analyze:
- A Query Builder gives you virtually limitless scope to quickly add and refine query rules to obtain the specific data you want.
- The data returned for your query are displayed in three chart formats: a histogram, pie-chart, and data table, where each format gives you further tools for analyzing the data.
- You can control how your query data are organized within these charts.
- You can use the Preview/Live switch to select either Preview or Live game data to query against:
- Preview/Live will be enabled only if you have published a game configuration Snapshot to Live.
There are some constraints for this Analytics tool:
- You can only query against requests and messages.
- The data you can query against are purged regularly:
- In PREVIEW - Your query will return results for up to 7 days previously.
- In LIVE - Your query will return results for up to 5 days previously.
You can also use the API Stream to identify requests your game is making into the platform that are proving performance-costly:
- Run API Stream data without a query and then review the data returned for request duration.
- Identify requests that take longer to process and then check the performance metrics for these requests using the Cloud Code Profiler.
In this topic, we'll give examples to show:
- How to build an API Stream query and review and analyze the data returned from the query.
- How to use API Stream data to identify performance-costly requests you might have built into your game.
Example for Connection Requests API Stream Analytics Data
In this example, we pull API Stream analytics data for connection request calls into the platform:
1. Open the Analytics > API Stream page.
2. Build a query for each of the different types of connection request API calls into the platform your game has made:
- In this example, we have four kinds of connection request in the API Stream we can query for.
- For displaying the returned data, we've selected to group by Type, calculate for Count of Request / Messages, and to use a daily period for charts.
Building your Query! There are two things to note when you add rules to build your query. Firstly, the drop-down for the request or message you select to query for will be divided into In Use and Other - the In Use requests/messages are those that are currently "live" in the API Stream; those listed under Other are the requests/messages that are not currently live. Secondly, you can refine your query rule by adding a Filter on the rule.
3. Click Update. The current API Stream is queried and the data are returned and displayed:
4. You can read-off data from the charts:
- On the Histogram, hover your cursor over a data point to read-off individual measures at that point:
- On the Pie Chart, hover your cursor over a portion to read-off individual percentages:
- On the Data Table, click the view
icon:
- A Log Entry Details panel appears, which shows the individual Request and Response details:
Data Delay! When you query the API Stream, the data used to build the charts and display the query results will not be right up to date. This is because there is a slight delay of approximately ten minutes before the data for the request or message activity being queried becomes available to build the charts.
Using API Stream Data to Identify Performance Issues
You can use the API Stream Analytics tool as a starting point for investigating and addressing any calls your game is making into the platform that are proving performance-costly:
- We recommend you use the API Stream in this way for new games pre-launch, so that you are better placed to catch performance issues before you launch into the Live environment.
- Even after your game is Live, you can continue to use the API Stream as a useful live ops diagnostic tool.
- When you find a call that is causing performance issues, you can use the Cloud Code Profiler tool in the Test Harness to run the call and closely examine a range of performance metrics for the call, which are designed to help you to fix any performance issues.
To check the performance of requests your game is making into the platform:
1. Open the Analytics > API Stream page.
2. Click to Delete the default empty query.
3. For configuring the returned data:
- Group By - select Type.
- Calculation - select Duration.
- Chart Period - select Hour.
4. Click to Update API Stream data.
5. On the Histogram chart, you can quickly identify those calls into the platform that are taking longest to process:
- In this example, we can quickly see that the issuing of an AuthenticationRequest into the platform causes a spike in processing time. This is likely due to some Cloud Code associated with this call and by running the Cloud Code Profiler for this request in the Test Harness we can investigate this further.
- You can open the Log Entry Details panel for any suspect request from the Data Table and obtain the details you might need when running the request in the Test Harness and profiling its associated Cloud Code. See previous section.