Search code examples
spring-bootgoogle-cloud-platformgoogle-cloud-stackdriver

Google Cloud Java Client for Stackdriver Trace


I am running my spring boot( 1.4 version) application in GKE.I have added the following dependencies in my pom.xml

<dependency>
  <groupId>com.google.cloud</groupId>
  <artifactId>google-cloud-trace</artifactId>
  <version>0.56.0-beta</version>
</dependency>

I have my authentication setup by enabling stackdriver trace in a service account (key.json file) and set it in my env variable(GOOGLE_APPLICATION_CREDENTIALS).

I am not seeing any traces from my application,I am not seeing any exception in the logs. Am I missing anything or Is there any working examples for the same?


Solution

  • Adding that dependency is not sufficient to start collecting traces automatically. You need to add spring-cloud-gcp-starter-trace:

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-gcp-starter-trace</artifactId>
    </dependency>
    

    See Spring Cloud GCP docs.