Skip to content

feat(bigtable): Add support for adding tags to an Instance in InstanceConfig#16014

Open
dohun-dev wants to merge 2 commits intogoogleapis:mainfrom
dohun-dev:tags
Open

feat(bigtable): Add support for adding tags to an Instance in InstanceConfig#16014
dohun-dev wants to merge 2 commits intogoogleapis:mainfrom
dohun-dev:tags

Conversation

@dohun-dev
Copy link

No description provided.

@dohun-dev dohun-dev requested a review from a team as a code owner March 2, 2026 12:59
@product-auto-label product-auto-label bot added the api: bigtable Issues related to the Bigtable API. label Mar 2, 2026
@gemini-code-assist
Copy link

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 InstanceConfig class by providing new methods to associate tags with Bigtable instances. This functionality allows for better organization and management of instances through metadata, ensuring that instances can be properly categorized and identified using key-value pairs.

Highlights

  • New Tagging Functionality: Introduced insert_tag and emplace_tag methods to the InstanceConfig class, allowing users to add key-value tags to a Bigtable Instance.
  • Test Coverage: Added a new unit test, SetTags, to instance_config_test.cc to verify the correct behavior of the new tagging methods.
Changelog
  • google/cloud/bigtable/instance_config.h
    • Added insert_tag method to add a tag with a constant string reference key and value.
    • Added emplace_tag method to add a tag with a constant string reference key and a moved string value.
  • google/cloud/bigtable/instance_config_test.cc
    • Added SetTags test case to validate the functionality of adding tags to an InstanceConfig.
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

@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 adds support for setting tags on an InstanceConfig, which is a useful feature. The implementation is straightforward, adding insert_tag and emplace_tag methods that are consistent with the existing insert_label and emplace_label methods. The new functionality is also well-tested. I have one suggestion to improve the efficiency of emplace_tag by adding an overload for rvalue keys.

Comment on lines +75 to +78
InstanceConfig& emplace_tag(std::string const& key, std::string value) {
(*proto_.mutable_instance()->mutable_tags())[key] = std::move(value);
return *this;
}

Choose a reason for hiding this comment

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

medium

To optimize for cases where the key is an rvalue (e.g., a temporary from a string literal), consider adding an overload for emplace_tag that accepts an rvalue reference for the key. This allows moving the key into the map instead of copying it, improving efficiency.

A similar improvement could be made to emplace_label in a follow-up change for consistency.

  InstanceConfig& emplace_tag(std::string const& key, std::string value) {
    (*proto_.mutable_instance()->mutable_tags())[key] = std::move(value);
    return *this;
  }

  InstanceConfig& emplace_tag(std::string&& key, std::string value) {
    (*proto_.mutable_instance()->mutable_tags())[std::move(key)] =
        std::move(value);
    return *this;
  }

Copy link
Author

Choose a reason for hiding this comment

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

Done

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

Labels

api: bigtable Issues related to the Bigtable API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant