Skip to content

test(o11y): add tests for tracing, metrics and logging in java-compute#12730

Open
diegomarquezp wants to merge 21 commits intomainfrom
observability/test/compute-integration-test
Open

test(o11y): add tests for tracing, metrics and logging in java-compute#12730
diegomarquezp wants to merge 21 commits intomainfrom
observability/test/compute-integration-test

Conversation

@diegomarquezp
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces integration tests for observability "golden signals" (traces, metrics, and logs) in the Compute service. It adds necessary OpenTelemetry and logging dependencies to the POM, implements the ITComputeGoldenSignals test class, and updates CompositeTracer to delegate requestUrlResolved calls. Review feedback identifies an opportunity to prevent test flakiness by clearing the TestAppender state between tests and suggests removing a redundant call to getMDCPropertyMap in the appender's logic.

@diegomarquezp diegomarquezp marked this pull request as ready for review April 9, 2026 19:01
@diegomarquezp diegomarquezp requested a review from a team as a code owner April 9, 2026 19:01
Duration currentDelay = retrySettings.getInitialRetryDelayDuration();
com.google.monitoring.v3.TimeSeries targetTs = null;

while (metricsPollingStopwatch.elapsed().compareTo(retrySettings.getTotalTimeoutDuration())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a little too aggressive to put this in a while loop. Usually how long does it take for the metrics to show up?

validateMetricsInCloudMonitoring(expectError);
}

private void validateLogging(boolean expectError) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we want to test with Cloud Logging, but I know it is hard to test without a proper exporter, so this is good enough for now.

Neenu1995 pushed a commit that referenced this pull request Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants