Skip to content

tests: Add retry metrics tests to ITOtelGoldenMetrics#12672

Merged
blakeli0 merged 8 commits intomainfrom
add-retry-metrics-tests
Apr 3, 2026
Merged

tests: Add retry metrics tests to ITOtelGoldenMetrics#12672
blakeli0 merged 8 commits intomainfrom
add-retry-metrics-tests

Conversation

@blakeli0
Copy link
Copy Markdown
Contributor

@blakeli0 blakeli0 commented Apr 3, 2026

Add showcase tests for metrics for the following two cases per test plan:

  • A metric is recorded if an RPC timesout
  • A single metric is recorded if an RPC requires retry before succeeding.

@blakeli0 blakeli0 requested a review from a team as a code owner April 3, 2026 18:29
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 OpenTelemetry metrics across gRPC and HTTP/JSON transports, covering deadline exceeded scenarios and successful retries. It also adds utility methods to TestClientInitializer for configuring clients with custom retry settings and interceptors. The review feedback recommends replacing Thread.sleep() with polling mechanisms to prevent test flakiness, adding safety checks before accessing metric data points to avoid potential exceptions, avoiding fragile assertions on total metric counts, and explicitly specifying the UTF-8 charset when converting strings to bytes.

@blakeli0 blakeli0 requested review from diegomarquezp and lqiu96 April 3, 2026 19:23
}

@Test
void testMetrics_zeroDeadline_grpc() throws Exception {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what does zeroDeadline mean? Is this testing that the RPC returns deadline_exceeded status? I think it may be helpful if the test name could be a bit more specific

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated to make it more specific

}

@Test
void testMetrics_retryAndSucceed_grpc() throws Exception {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same here. Is this test intended to test that that multiple retry attempts results in one value for gcp.client.request.duration and that the final status is OK?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, exactly. Making sure that there is only one metric instead of multiple in case of retries.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Also updated to make it more specific

@blakeli0 blakeli0 enabled auto-merge (squash) April 3, 2026 20:18
@blakeli0 blakeli0 disabled auto-merge April 3, 2026 20:18
@blakeli0 blakeli0 enabled auto-merge (squash) April 3, 2026 20:53
@blakeli0 blakeli0 merged commit 239b186 into main Apr 3, 2026
124 of 126 checks passed
@blakeli0 blakeli0 deleted the add-retry-metrics-tests branch April 3, 2026 21:54
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.

2 participants