Skip to content

Commit f1faf60

Browse files
diegomarquezpcloud-java-botblakeli0
authored
test(o11y): add tests for tracing, metrics and logging in java-compute (#12730)
This PR adds tests for java-compute to confirm behavior of recently added o11y features. Key changes: - **`sdk-platform-java/gax-java`**: Overrode `requestUrlResolved` in `CompositeTracer` to ensure `url.full` is recorded in HTTP/REST transport. This was a fix found during testing. - **`java-compute`**: Introduced `ITComputeGoldenSignals.java` to validate tracing, metrics, and logging. - **`java-compute`**: Added `GOOGLE_SDK_JAVA_LOGGING=true` environment variable to `maven-surefire-plugin` in `pom.xml` to enable logging for verification in tests. --------- Co-authored-by: cloud-java-bot <cloud-java-bot@google.com> Co-authored-by: Blake Li <blakeli@google.com>
1 parent c88e3f2 commit f1faf60

6 files changed

Lines changed: 714 additions & 2 deletions

File tree

generation/check_non_release_please_versions.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ for pomFile in $(find . -mindepth 2 -name pom.xml | sort ); do
2222
[[ "${pomFile}" =~ .*java-storage.* ]] || \
2323
[[ "${pomFile}" =~ .*java-storage-nio.* ]] || \
2424
[[ "${pomFile}" =~ .*java-vertexai.* ]] || \
25+
[[ "${pomFile}" =~ .*java-compute.* ]] || \
2526
[[ "${pomFile}" =~ .*.github*. ]]; then
2627
continue
2728
fi

google-cloud-jar-parent/pom.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@
7777
<version>4.13.2</version>
7878
<scope>test</scope>
7979
</dependency>
80+
<dependency>
81+
<groupId>ch.qos.logback</groupId>
82+
<artifactId>logback-classic</artifactId>
83+
<version>1.5.25</version>
84+
<scope>test</scope>
85+
</dependency>
86+
<dependency>
87+
<groupId>ch.qos.logback</groupId>
88+
<artifactId>logback-core</artifactId>
89+
<version>1.5.25</version>
90+
<scope>test</scope>
91+
</dependency>
8092
<dependency>
8193
<groupId>joda-time</groupId>
8294
<artifactId>joda-time</artifactId>

java-compute/google-cloud-compute/pom.xml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,49 @@
9292
<artifactId>google-cloud-core</artifactId>
9393
<scope>test</scope>
9494
</dependency>
95+
<dependency>
96+
<groupId>com.google.cloud</groupId>
97+
<artifactId>google-cloud-monitoring</artifactId>
98+
<version>3.93.0-SNAPSHOT</version> <!-- {x-version-update:google-cloud-monitoring:current} -->
99+
<scope>test</scope>
100+
</dependency>
101+
<dependency>
102+
<groupId>io.opentelemetry</groupId>
103+
<artifactId>opentelemetry-sdk</artifactId>
104+
<scope>test</scope>
105+
</dependency>
106+
<dependency>
107+
<groupId>io.opentelemetry</groupId>
108+
<artifactId>opentelemetry-exporter-otlp</artifactId>
109+
<scope>test</scope>
110+
</dependency>
111+
<dependency>
112+
<groupId>io.opentelemetry</groupId>
113+
<artifactId>opentelemetry-sdk-testing</artifactId>
114+
<scope>test</scope>
115+
</dependency>
116+
<!-- Logback dependencies are used to intercept logs for validation in tests, consistent with ITActionableErrorsLogging -->
117+
<dependency>
118+
<groupId>ch.qos.logback</groupId>
119+
<artifactId>logback-classic</artifactId>
120+
<scope>test</scope>
121+
</dependency>
122+
<dependency>
123+
<groupId>ch.qos.logback</groupId>
124+
<artifactId>logback-core</artifactId>
125+
<scope>test</scope>
126+
</dependency>
127+
<dependency>
128+
<groupId>com.google.cloud</groupId>
129+
<artifactId>google-cloud-trace</artifactId>
130+
<version>2.92.0-SNAPSHOT</version><!-- {x-version-update:google-cloud-trace:current} -->
131+
<scope>test</scope>
132+
</dependency>
133+
<dependency>
134+
<groupId>com.google.truth</groupId>
135+
<artifactId>truth</artifactId>
136+
<scope>test</scope>
137+
</dependency>
95138

96139
<!-- Need testing utility classes for generated REST clients tests -->
97140
<dependency>
@@ -105,6 +148,53 @@
105148
<artifactId>gax</artifactId>
106149
<classifier>testlib</classifier>
107150
<scope>test</scope>
151+
</dependency>
152+
<!-- Needed for trace client -->
153+
<dependency>
154+
<groupId>io.grpc</groupId>
155+
<artifactId>grpc-netty-shaded</artifactId>
156+
<scope>test</scope>
157+
</dependency>
158+
<dependency>
159+
<groupId>io.grpc</groupId>
160+
<artifactId>grpc-auth</artifactId>
161+
<scope>test</scope>
108162
</dependency>
109163
</dependencies>
164+
165+
<build>
166+
<plugins>
167+
<plugin>
168+
<groupId>org.apache.maven.plugins</groupId>
169+
<artifactId>maven-surefire-plugin</artifactId>
170+
<configuration>
171+
<environmentVariables>
172+
<GOOGLE_SDK_JAVA_LOGGING>true</GOOGLE_SDK_JAVA_LOGGING>
173+
</environmentVariables>
174+
</configuration>
175+
</plugin>
176+
<plugin>
177+
<groupId>org.apache.maven.plugins</groupId>
178+
<artifactId>maven-failsafe-plugin</artifactId>
179+
<configuration>
180+
<environmentVariables>
181+
<GOOGLE_SDK_JAVA_LOGGING>true</GOOGLE_SDK_JAVA_LOGGING>
182+
</environmentVariables>
183+
</configuration>
184+
</plugin>
185+
</plugins>
186+
</build>
187+
<profiles>
188+
<profile>
189+
<id>enable-integration-tests</id>
190+
<dependencies>
191+
<dependency>
192+
<groupId>org.slf4j</groupId>
193+
<artifactId>slf4j-api</artifactId>
194+
<version>2.0.16</version>
195+
<scope>test</scope>
196+
</dependency>
197+
</dependencies>
198+
</profile>
199+
</profiles>
110200
</project>

0 commit comments

Comments
 (0)