Spring Cloud GCP Trace Starter Example
This sample application demonstrates using the Spring Cloud GCP Trace Starter in your code.
You can read about the Spring Boot Starter for Stackdriver Trace in more detail at the Spring Cloud GCP Reference Document Stackdriver Trace section.
Similar content is also available in the Distributed tracing with Spring Cloud Sleuth codelab.
Setup & Configuration
Run the Example
Run the example from Maven:
$ mvn spring-boot:run
This will trigger the
ExampleController.work() method, which in turn will call other services, and also a remote RESTful call to
To see the traces, navigate to Stackdriver Trace console’s Trace List view.
You should see the trace information in detail.
Additionally, if you logged in with the Google Cloud SDK or have the
GOOGLE_CLOUD_PROJECT environment variable set to your GCP project ID, you can also click the
View link in front of the
Log to view the log entries related to that trace ID.
Note that the trace transmission delay default value is 10 seconds, so it can take a little while for the traces to show up in the Trace List page.
You can shorten this delay using the
Deploy to App Engine Flexible Environment
If you have Cloud SDK installed, Maven App Engine Plug-in can be used to deploy the application to App Engine Flexible environment:
$ mvn appengine:deploy