I’m trying to set the sampling probability for GCP tracing to 100% but the property seems to have no effect, only about 0.1% of all requests appear in the GCP Trace Explorer. All Request get a traceId assigned and 100% of all requests with header X-B3-Sampled=1
appear in the Trace Explorer.
I tried to set management.tracing.sampling.probability=1.0
to have all requests traced, but that property seems to have no effect.
Could anyone please help with that and advise, how to correctly set the sampling rate?
Our setup:
- Spring Boot 3.2.6 (downgraded from 3.3.0 because of https://github.com/GoogleCloudPlatform/spring-cloud-gcp/issues/2917)
- Micrometer for observability
- spring-cloud-gcp 5.4.3
Part of our pom.xml:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.6</version>
<relativePath/>
</parent>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-dependencies</artifactId>
<version>5.4.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-starter-logging</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>spring-cloud-gcp-starter-trace</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.j2objc</groupId>
<artifactId>j2objc-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
Part of our application.yaml:
management:
tracing:
sampling:
probability: 1.0
enabled: true