Skip to content
Centralized logging for Unity game clients; browse and search in Google Stackdriver Logging
C# JavaScript Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Backend
Frontend
.gitmodules
LICENSE.md
README.md

README.md

Centralized logging for Unity game clients

Stream debug logs from your game clients to Google Cloud Platform. Browse and search your game client logs in the Stackdriver Logging web UI. See common errors with callstacks in the Stackdriver Error Reporting web UI.

This is primarily intended for use during internal development. If you use this in production, be aware that streaming all logs from all game clients can be costly.

This consists of three parts:

  • An extension to UberLogger which regularly forwards logs from your client to Google Cloud Platform
  • A small bit of JavaScript glue code which receives logs from game clients, and forwards it to Stackdriver
  • The Stackdriver Logging & Stackdriver Error Reporting web UIs

Setup

Filtering and browsing results

Visit the Stackdriver Logging web UI. Find a single line of text from the session that you are interested in. Expand the entry, and filter on the given logName. This gives you all logs for a single session.

Visit the Stackdriver Error Reporting web UI. Here you can see statistics for the errors reported by your application.

Reliability, performance and scalability

Reliability

If there is a failure during posting to the Cloud Functions endpoint, the game clients will retry posting the same set of messages until it succeeds. With the current implementation this means that the game client will gradually consume more and more memory if the Cloud Function endpoint is down or not accepting the content. Temporary hiccups will result in entries with delayed timestamps but all messages will be delivered to the Stackdriver service.

Performance

If a game client posts messages to the Cloud Function when it is not actively deployed anywhere, it will take Google Cloud functions approximately 10 seconds to deploy it and accept the payload. Once the Cloud Function is deployed, messages are processed immediately. The Cloud Function does not buffer any messages.

The time between posting an exception message and seeing it in the Error Reporting view seems to be between 1 and 10 seconds when doing small-scale tests.

If a game client spams log messages at a high rate, it will result in rate limiting on the client side. More and more messages get queued up within the client, until either the client quits or the enqueue rate drops again.

Scalability

Each game client is by default configured to post any messages once every second. The Cloud Function takes 300ms to execute in the average case. Cloud Functions have a quota of max 400c concurrent invocations. Stackdriver Logging has a quota of max 500 write calls per second. The bottleneck is therefore with 500 concurrent clients spamming messages to the system non-stop, or with 150.000 concurrent clients that send messages (probably errors) once every 5 minutes.

Development

  • For local dev, install the Cloud Functions emulator ( https://cloud.google.com/functions/docs/emulator )
    • install nvm: follow instructions at https://github.com/creationix/nvm
    • install & switch to nodejs 6.11.1 via nvm install 6.11.1 / nvm use 6.11.1
    • install cloud functions emulator via npm install @google-cloud/functions-emulator
    • Deploy scripts to cloud functions emulator via ./commands/deploy_functions_local_emulator.sh
    • Run unit tests against cloud functions emulator & Stackdriver backend via ./commands/run_unit_tests_local_emulator.sh
    • Deploy to Cloud Functions via ./commands/deploy_functions.sh <storage bucket URL>
You can’t perform that action at this time.