Skip to content

fix(bigtable): fix build when OTel metrics disabled - #16519

Open
colinmoy wants to merge 1 commit into
googleapis:mainfrom
colinmoy:fix-bigtable-without-otel-metrics
Open

colinmoy wants to merge 1 commit into
googleapis:mainfrom
colinmoy:fix-bigtable-without-otel-metrics

Conversation

@colinmoy

@colinmoy colinmoy commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

Define StubSelectionParams and the no-op OperationContext::StubSelection when GOOGLE_CLOUD_CPP_BIGTABLE_WITH_OTEL_METRICS is not defined.

Define StubSelectionParams and the no-op OperationContext::StubSelection when GOOGLE_CLOUD_CPP_BIGTABLE_WITH_OTEL_METRICS is not defined.
@colinmoy
colinmoy requested a review from a team as a code owner October 1, 2026 06:25
@product-auto-label product-auto-label Bot added the api: bigtable Issues related to the Bigtable API. label Oct 1, 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 refactors the metrics header to expose StubSelectionParams unconditionally and adds a default no-op implementation of OperationContext::StubSelection. To prevent duplicate definition errors at link time when OpenTelemetry metrics are enabled, the no-op implementation of StubSelection should be wrapped in a conditional compilation block.

OperationContext::OperationContext(std::vector<std::shared_ptr<Metric>>,
std::shared_ptr<Clock>) {}

void OperationContext::StubSelection(StubSelectionParams const&) {}

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

The no-op definition of OperationContext::StubSelection should be wrapped in #ifndef GOOGLE_CLOUD_CPP_BIGTABLE_WITH_OTEL_METRICS. Otherwise, when OTel metrics are enabled, this will conflict with the active implementation of StubSelection, leading to a duplicate definition error at link time.

#ifndef GOOGLE_CLOUD_CPP_BIGTABLE_WITH_OTEL_METRICS
void OperationContext::StubSelection(StubSelectionParams const&)
#endif

@codecov

codecov Bot commented Oct 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.36%. Comparing base (fb87c70) to head (5a05dc1).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16519      +/-   ##
==========================================
- Coverage   92.38%   92.36%   -0.02%     
==========================================
  Files        2262     2262              
  Lines      217100   217100              
==========================================
- Hits       200557   200525      -32     
- Misses      16543    16575      +32     

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

This branch was successfully deployed

1 active deployment
false — 5a05dc14 Deployed Oct 1, 2026 by colinmoy via Save PR ref #12205
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