Conversation
Define StubSelectionParams and the no-op OperationContext::StubSelection when GOOGLE_CLOUD_CPP_BIGTABLE_WITH_OTEL_METRICS is not defined.
There was a problem hiding this comment.
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&) {} |
There was a problem hiding this comment.
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
Define StubSelectionParams and the no-op OperationContext::StubSelection when GOOGLE_CLOUD_CPP_BIGTABLE_WITH_OTEL_METRICS is not defined.