Skip to content

Conversation

@diegomarquezp
Copy link
Contributor

@diegomarquezp diegomarquezp commented Jan 8, 2026

This PR introduces a basic implementation for tracing in GAX. This is a minimal no-op placeholder intended to establish the project's architecture before adding functional tracing logic.

Changes:

  • New Tracing Components:

    • new classes such as TracingRecorder mimic the structure of the metrics counterpart.
  • Feature Flag Implementation:

    • Added TracingUtils to manage the GOOGLE_CLOUD_ENABLE_TRACING feature flag. Tracing is disabled by default and can be enabled via an environment variable or system property.
    • Updated TracingTracerFactory to respect this flag, returning a no-op BaseApiTracer when tracing is disabled.

Note on Implementation:

The newTracer method in TracingTracerFactory and the tracing components themselves are currently implemented as placeholders. This PR focuses on establishing the basic structure and configuration mechanisms; actual tracing logic and attribute propagation will be implemented in subsequent phases.

How to enable tracing:

To enable the tracing infrastructure, set the following environment variable or system property to true:
GOOGLE_CLOUD_ENABLE_TRACING=true

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

Summary of Changes

Hello @diegomarquezp, 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 lays the groundwork for distributed tracing within the gax-java library by introducing a new, extensible tracing framework. It provides the core interfaces and classes necessary to record RPC lifecycle events, with an initial no-op implementation that leverages OpenTelemetry. The changes also include a feature flag to control tracing activation and a set of tests to ensure proper functionality, paving the way for more detailed observability of client-side operations.

Highlights

  • New Tracing Framework: Introduced a new tracing framework with a TracingRecorder interface, designed to be framework-agnostic for recording RPC lifecycle events.
  • OpenTelemetry Integration: Added an OpenTelemetryTracingRecorder class, providing an initial OpenTelemetry-specific implementation for the TracingRecorder interface.
  • Tracing Tracer and Factory: Implemented TracingTracer and TracingTracerFactory to integrate the new tracing capabilities into the existing ApiTracer system, allowing for the creation and management of trace spans.
  • Feature Flag for Tracing: Included TracingUtils to manage tracing enablement, allowing users to activate or deactivate tracing via the GOOGLE_CLOUD_ENABLE_TRACING system property or environment variable.
  • Comprehensive Testing: Added new unit tests for the tracing components and an integration test in ITOtelMetrics to validate the tracing feature flag's behavior.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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 a no-op implementation for tracing, which is a great first step towards full observability. The new classes and interfaces for tracing are well-structured. I've found a few areas for improvement, mainly concerning code correctness in a test setup, and some opportunities to improve encapsulation and prepare for the full implementation by aligning more closely with the existing metrics implementation. My comments provide specific suggestions for these points.

@BetaApi
@InternalApi
public class TracingTracerFactory implements ApiTracerFactory {
protected TracingRecorder tracingRecorder;
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The tracingRecorder field is protected and mutable. Since it's initialized in the constructor and not expected to be changed by subclasses, it should be private final to ensure immutability and proper encapsulation.

Suggested change
protected TracingRecorder tracingRecorder;
private final TracingRecorder tracingRecorder;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@blakeli0 https://github.com/googleapis/sdk-platform-java/pull/2403/files#diff-fdc1dfb7a2b23501ab66d8e37f0aedc5ca87489d845479734f583773bab0a51a shows that the metrics counterpart also has the recorder as protected. Do you know if we intend to have these classes extended at some point? I imagine a new metrics sdk may require a sub class.

@diegomarquezp diegomarquezp added do not merge Indicates a pull request not ready for merge, due to either quality or timing. draft Do Not Review labels Jan 8, 2026
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2026

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 8, 2026

Quality Gate Passed Quality Gate passed for 'java_showcase_integration_tests'

Issues
4 New issues
0 Accepted issues

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

See analysis details on SonarQube Cloud

@diegomarquezp
Copy link
Contributor Author

WIP as there are pending design decisions for the feature flag.

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

Labels

do not merge Indicates a pull request not ready for merge, due to either quality or timing. draft Do Not Review size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants