From 5a05dc14b88b7ff081b6123bc7d09b16c7855974 Mon Sep 17 00:00:00 2001 From: Colin Moy Date: Wed, 30 Sep 2026 22:59:04 +0000 Subject: [PATCH] fix(bigtable): fix build when OTel metrics disabled Define StubSelectionParams and the no-op OperationContext::StubSelection when GOOGLE_CLOUD_CPP_BIGTABLE_WITH_OTEL_METRICS is not defined. --- google/cloud/bigtable/internal/metrics.h | 29 +++++++++++++------ .../bigtable/internal/operation_context.cc | 2 ++ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/google/cloud/bigtable/internal/metrics.h b/google/cloud/bigtable/internal/metrics.h index d3e1db9764949..0d783ca1a14f1 100644 --- a/google/cloud/bigtable/internal/metrics.h +++ b/google/cloud/bigtable/internal/metrics.h @@ -15,18 +15,9 @@ #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INTERNAL_METRICS_H #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INTERNAL_METRICS_H -#ifdef GOOGLE_CLOUD_CPP_BIGTABLE_WITH_OTEL_METRICS - #include "google/cloud/bigtable/internal/operation_context.h" #include "google/cloud/bigtable/version.h" -#include "google/cloud/status.h" -#include -#include -#include #include -#include -#include -#include namespace google { namespace cloud { @@ -55,6 +46,26 @@ struct StubSelectionParams { RpcType streaming; }; +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace bigtable_internal +} // namespace cloud +} // namespace google + +#ifdef GOOGLE_CLOUD_CPP_BIGTABLE_WITH_OTEL_METRICS + +#include "google/cloud/status.h" +#include +#include +#include +#include +#include +#include + +namespace google { +namespace cloud { +namespace bigtable_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + struct PreCallParams { OperationContext::Clock::time_point attempt_start; bool first_attempt; diff --git a/google/cloud/bigtable/internal/operation_context.cc b/google/cloud/bigtable/internal/operation_context.cc index ed63b1aa98712..549d179b44b40 100644 --- a/google/cloud/bigtable/internal/operation_context.cc +++ b/google/cloud/bigtable/internal/operation_context.cc @@ -112,6 +112,8 @@ void OperationContext::ElementDelivery(grpc::ClientContext const&) { OperationContext::OperationContext(std::vector>, std::shared_ptr) {} +void OperationContext::StubSelection(StubSelectionParams const&) {} + void OperationContext::PreCall(grpc::ClientContext& client_context) { for (auto const& [key, value] : cookies_) { client_context.AddMetadata(key, value);