Skip to content

impl(bigtable): enable outstanding_rpcs metric and StubSelection event - #16362

Merged
scotthart merged 3 commits into
googleapis:mainfrom
scotthart:bigtable_client_schema_metrics_2
Aug 20, 2026
Merged

impl(bigtable): enable outstanding_rpcs metric and StubSelection event#16362
scotthart merged 3 commits into
googleapis:mainfrom
scotthart:bigtable_client_schema_metrics_2

Conversation

@scotthart

Copy link
Copy Markdown
Member

This PR wires the new outstanding_rpcs metric and associated StubSelection event into OperationContext, OperationContextFactory, the stub selection decorator, and DynamicChannelPool, enabling it to be collected and exported.

@scotthart
scotthart requested a review from a team as a code owner August 20, 2026 20:46
@product-auto-label product-auto-label Bot added the api: bigtable Issues related to the Bigtable API. label Aug 20, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

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 updates the Bigtable client to track and export client-side metrics, specifically propagating OperationContext through the BigtableRandomTwoLeastUsed decorator and updating DynamicChannelPool to expose its TransportType. It also enhances MetricsOperationContextFactory to populate ClientResourceLabels for client-schema metrics. A critical issue was identified in operation_context_factory.cc where the monitored resource type for client-side metrics is incorrectly set to "bigtable_table" instead of "bigtable_client", which would cause Google Cloud Monitoring to reject these metrics due to label mismatches.

Comment on lines 283 to 284
google::api::MonitoredResource resource;
resource.set_type(kResourceType);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

For client-side metrics (such as outstanding_rpcs), the monitored resource type in Google Cloud Monitoring should be "bigtable_client" rather than kResourceType (which is "bigtable_table"). Using kResourceType will cause the metrics to be rejected by the Monitoring service because the client-specific labels (like client_name, uuid, etc.) do not match the schema of the "bigtable_table" monitored resource.

        google::api::MonitoredResource resource;
        resource.set_type("bigtable_client");

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Line 249: auto constexpr kResourceType = "bigtable_client_raw";

If anything, these lines could be factored out to the enclosing scope.

@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.84953% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.25%. Comparing base (31a0d9f) to head (853510b).

Files with missing lines Patch % Lines
...oud/bigtable/internal/operation_context_factory.cc 86.88% 16 Missing ⚠️
...igtable/internal/operation_context_factory_test.cc 92.24% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16362      +/-   ##
==========================================
+ Coverage   92.23%   92.25%   +0.02%     
==========================================
  Files        2237     2237              
  Lines      210251   210434     +183     
==========================================
+ Hits       193928   194144     +216     
+ Misses      16323    16290      -33     

☔ View full report in Codecov by Harness.
📢 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.

@colinmoy colinmoy left a comment

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.

There appears to be missing test coverage in the dynamic_resource_fn block in operation_context_factory.cc

@scotthart
scotthart merged commit 03e43d3 into googleapis:main Aug 20, 2026
73 of 76 checks passed
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.

2 participants