Skip to content

feat: add periodic WARNING metrics to assist in debugging#12976

Open
agrawal-siddharth wants to merge 1 commit intogoogleapis:mainfrom
agrawal-siddharth:dump_warning
Open

feat: add periodic WARNING metrics to assist in debugging#12976
agrawal-siddharth wants to merge 1 commit intogoogleapis:mainfrom
agrawal-siddharth:dump_warning

Conversation

@agrawal-siddharth
Copy link
Copy Markdown
Contributor

No description provided.

@agrawal-siddharth agrawal-siddharth requested review from a team as code owners May 1, 2026 01:56
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 a HealthCheckMetrics system within ConnectionWorker to monitor and log stream health, including latency, retry counts, and error responses. It also adds corresponding unit tests to verify metric gathering and threshold logic. The review feedback highlights several critical thread-safety concerns, recommending synchronization for metric updates and ensuring that shared state, such as the retry count and request queues, is accessed within existing locks to prevent race conditions. Additionally, there are suggestions to improve resource efficiency by caching the Gson instance and declaring constants as static final.

@agrawal-siddharth agrawal-siddharth force-pushed the dump_warning branch 2 times, most recently from f2bf77d to 4b9d050 Compare May 1, 2026 22:20
@@ -249,6 +257,7 @@ class ConnectionWorker implements AutoCloseable {

private final RequestProfiler.RequestProfilerHook requestProfilerHook;
private final TelemetryMetrics telemetryMetrics;
private final HealthCheckMetrics healthCheckMetrics;
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.

can we mark the whole healthCheckMetrics guarded by lock ?

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.

Added the GuardedBy annotation.

However, at present this does not seem to be enforced on this project.

@agrawal-siddharth agrawal-siddharth force-pushed the dump_warning branch 2 times, most recently from 6a18928 to 865d277 Compare May 6, 2026 16:39
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