Skip to content

impl(o11y): introduce resend_count logic#4156

Open
diegomarquezp wants to merge 2 commits intomainfrom
observability/tracing-attr/resend_count
Open

impl(o11y): introduce resend_count logic#4156
diegomarquezp wants to merge 2 commits intomainfrom
observability/tracing-attr/resend_count

Conversation

@diegomarquezp
Copy link
Contributor

@diegomarquezp diegomarquezp commented Mar 18, 2026

Introduces gcp.grpc.resend_count and http.request.resend_count.

Although ApiTracer offers attemptStarted(int attemptNumber), here we use an internal counter in order to not depend on external logic that would produce such an argument.

@product-auto-label product-auto-label bot added the size: l Pull request size is large. label Mar 18, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the observability of client-side operations by introducing a resend_count attribute to tracing spans. This attribute, applied to both gRPC and HTTP requests, provides crucial context for understanding and analyzing retry behavior, which is vital for debugging transient errors and optimizing performance in distributed systems.

Highlights

  • New Observability Attributes: Introduced new constants, "HTTP_RESEND_COUNT_ATTRIBUTE" and "GRPC_RESEND_COUNT_ATTRIBUTE", to ObservabilityAttributes for tracking the number of times a request has been resent due to retries.
  • SpanTracer Enhancement: Modified SpanTracer to track and include a resendCount attribute in attempt spans for retried requests, differentiating between HTTP and gRPC transports.
  • Attribute Type Handling: Updated ObservabilityUtils to correctly handle Long type attributes when converting them to OpenTelemetry attributes.
  • Comprehensive Testing: Added new unit tests in SpanTracerTest and integration tests in ITOtelTracing to validate the correct propagation and value of the resend_count attribute for both gRPC and HTTP retries.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
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 logic to add a resend_count attribute to observability spans for retried requests. The implementation in SpanTracer is solid, correctly incrementing the count for each retry and adding the appropriate transport-specific attribute. The unit tests for this logic are also well-written.

However, I've found issues in the new integration tests in ITOtelTracing.java. The verification logic for the resend_count attribute is flawed in both the gRPC and HTTP JSON test cases. I've provided suggestions to correct the test logic to ensure it properly validates the new feature.

@diegomarquezp diegomarquezp marked this pull request as ready for review March 19, 2026 02:15
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed for 'gapic-generator-java-root'

Failed conditions
60.7% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@sonarqubecloud
Copy link

Quality Gate Passed Quality Gate passed for 'java_showcase_integration_tests'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
82.1% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant