Google Cloud API Showcase: Cloud BigQuery & StackDriver Monitoring in App Engine Standard Environment for Java 11
This API Showcase demonstrates how to run an AppEngine standard environment application with dependencies on both Google BigQuery and StackDriver Monitoring.
The home page of this application provides a form to initiate a query of public data, in this case StackOverflow
questions tagged with google-bigquery.
The home page also provides a summary view of the metrics that have been logged in the past 30 days.
- Copy the sample apps to your local machine:
git clone https://github.com/GoogleCloudPlatform/java-docs-samples
- Add the appengine-simple-jetty-main Main class to your classpath:
cd appengine-java11/appengine-simple-jetty-main
mvn install
- Move into the
appengine-java11/bigquerydirectory and compile the app:
cd ../bigquery
mvn package
- Make sure
gcloudis installed and initialized:
gcloud init
- If this is the first time you are creating an App Engine project
gcloud app create
- For local development, set up authentication
- Enable BigQuery and Monitoring APIs
- If you have not already enabled your project for StackDriver, do so by following these instructions.
- Deploy to AppEngine standard environment using the following Maven command.
mvn appengine:deploy -Dapp.deploy.projectId=<your-project-id>
- Direct your browser to
https://<your-project-id>.appspot.com. - View more in-depth metrics data on the StackDriver Monitoring Dashboard
Note: The first time the app is run (or after any metrics definitions have been deleted) it may take up to 5 minutes for the MetricDescriptors to sync with StackDriver before any results are shown. If you do not see results, please wait a few moments and try again.