Skip to content

Conversation

@cpriti-os
Copy link
Collaborator

go/gcs-track-client-features

@cpriti-os cpriti-os requested a review from animesh-g January 13, 2026 08:10
@gemini-code-assist
Copy link

Summary of Changes

Hello @cpriti-os, 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 implements a robust feature usage tracking system for the Google Cloud Storage Hadoop Connector. By introducing a new FeatureHeaderGenerator and TrackedFeatures enum, the connector can now send a custom HTTP header with GCS API requests. This header contains a Base64 encoded bitmask representing features enabled via configuration and those actively used during specific operations. This enhancement provides valuable telemetry for understanding feature adoption and optimizing future development, without impacting core functionality.

Highlights

  • Introduced Feature Usage Tracking: A new mechanism has been implemented to track the usage of various features within the GCS Hadoop Connector, providing valuable telemetry for understanding feature adoption.
  • New FeatureHeaderGenerator Class: A dedicated class FeatureHeaderGenerator was added to manage and encode feature usage into a custom HTTP header, X-Goog-Storage-Hadoop-Connector-Features.
  • New TrackedFeatures Enum: An enum TrackedFeatures was introduced to define and assign unique bit positions to each trackable feature, including Fadvise options, Hierarchical Namespace (HNS), Performance Cache, Cloud Logging, Direct Upload, and RENAME_API.
  • Integration into GCS Operations: The FeatureHeaderGenerator is now integrated into the core GCS client and file system implementations to automatically generate and attach the feature header to outgoing GCS API requests.
  • Runtime Feature Tracking: Specific operations, such as rename in GoogleHadoopFileSystem, now explicitly mark their usage via FeatureHeaderGenerator.track() to include runtime-specific feature flags in the header.
  • Cloud Logging Configuration: A new configuration option setCloudLoggingEnabled was added to GoogleCloudStorageFileSystemOptions, allowing users to enable and track Cloud Logging usage.
  • Comprehensive Testing: New unit tests were added for FeatureHeaderGenerator and TrackedFeatures, and existing tests were updated to ensure proper functionality and integration of the new tracking system.

🧠 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.

@cpriti-os
Copy link
Collaborator Author

/gcbrun

Copy link

@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 mechanism for tracking feature usage in the GCS connector by adding a custom X-Goog-Storage-Hadoop-Connector-Features header to requests. The implementation is well-structured, using a FeatureHeaderGenerator to build a bitmask of features from both static configuration and dynamic, per-request contexts. The use of InheritableThreadLocal is appropriate for tracking request-specific features. The changes are cleanly integrated into both the JSON and gRPC client implementations. The addition of comprehensive unit tests is also a great plus. I have one minor suggestion to simplify the encoding logic.

Comment on lines +163 to +165
if (highBits == 0L && lowBits == 0L) {
return null;
}

Choose a reason for hiding this comment

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

medium

This check for highBits == 0L && lowBits == 0L appears to be redundant. The features.isEmpty() check at the beginning of the method (line 149) already handles the case where the bitmask is empty. If features is not empty, at least one of highBits or lowBits will be non-zero. Removing this check would simplify the code.

@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

❌ Patch coverage is 88.39286% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.53%. Comparing base (cef3e4c) to head (80e62b5).

Files with missing lines Patch % Lines
...oud/hadoop/gcsio/GoogleCloudStorageClientImpl.java 53.84% 3 Missing and 3 partials ⚠️
...gle/cloud/hadoop/gcsio/FeatureHeaderGenerator.java 91.66% 1 Missing and 4 partials ⚠️
...hadoop/gcsio/GoogleCloudStorageFileSystemImpl.java 66.66% 1 Missing ⚠️
...gle/cloud/hadoop/gcsio/GoogleCloudStorageImpl.java 88.88% 0 Missing and 1 partial ⚠️

❗ There is a different number of reports uploaded between BASE (cef3e4c) and HEAD (80e62b5). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (cef3e4c) HEAD (80e62b5)
integrationtest 1 0
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1619      +/-   ##
============================================
- Coverage     81.88%   72.53%   -9.36%     
+ Complexity     2424     2187     -237     
============================================
  Files           128      130       +2     
  Lines         10819    10922     +103     
  Branches       1302     1319      +17     
============================================
- Hits           8859     7922     -937     
- Misses         1417     2392     +975     
- Partials        543      608      +65     
Flag Coverage Δ
integrationtest ?
unittest 72.53% <88.39%> (+0.18%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant