With APM's Ruby agent, you can monitor applications that reside in the Google App Engine (GAE) flexible environment. Adding New Relic to your GAE flex app gives you insight into the health and performance of your app and extends GAE with metrics you can view using Full-Stack Observability options like APM and browser monitoring.
This document explains how to add New Relic to your GAE flex app using either of these methods:
- Google App Engine's "native mode" installation with a standard GAE runtime
- Docker installation using a custom runtime
The custom runtime method includes an example of deploying a Sinatra app. If you need specific libraries or headers, New Relic recommends using the custom runtime method.
When using Google App Engine "native mode" installation, you provide your app code and an
app.yaml file. Google App Engine then deploys to a standard prebuilt Docker image.
To deploy with native support for Sinatra or Rails:
- Follow New Relic's standard procedures to install the gem, including your license key.
- Install the Ruby agent configuration file.
Once the gem and configuration file have been installed, the Ruby agent can automatically monitor applications that reside in the GAE flexible environment. Wait until the deployment completes, then view your GAE flex app data in the APM Summary page.
If your Ruby app needs specific libraries or headers, New Relic recommends using the custom runtime method. In addition, New Relic recommends that you allow Google App Engine to handle health checks.
See Google's documentation for building custom runtimes. This example describes how to add New Relic to your GAE flex app by building a custom runtime for Docker. The example uses a Sinatra app for Ruby.
For more information about deploying and configuring your Ruby app in the GAE flexible environment, see:
Google App Engine sends periodic health check requests to confirm that an instance has been successfully deployed, and to check that a running instance maintains a healthy status. A health check is an HTTP request to the URL
If you create a custom runtime, your app must be able to handle a large number of health check requests. Otherwise, your app data may not display correctly in APM.
New Relic recommends that you allow health checks for Ruby apps so that Google can check that your service is up and balanced properly. However, if excessive health checks cause congested transaction traces, you can set the Ruby agent to ignore the health check requests.
- To handle health checks, add a route for
_ah/healthin your app.
- To ignore health check requests, set the
rules.ignore_url_regexesconfig setting in the application’s Ruby agent config to include
Use these resources to troubleshoot your GAE flex environment app:
To connect to the GAE instance and start a shell in the Docker container running your code, see Debugging an instance.
- log_file_name: STDOUT
To view the logs, use the Cloud Platform Console's Log Viewer.