From 8c6be41434f9cf0784b77eb15105c6ad7132b5c5 Mon Sep 17 00:00:00 2001 From: Tanvi Jagtap <139093547+tanvi-jagtap@users.noreply.github.com> Date: Wed, 5 Jun 2024 19:25:04 -0700 Subject: [PATCH] [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging GPR_ASSERT (#36816) [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging GPR_ASSERT Replacing GPR_ASSERT with absl CHECK. These changes have been made using string replacement and regex. Will not be replacing all instances of CHECK with CHECK_EQ , CHECK_NE etc because there are too many callsites. Only ones which are doable using very simple regex with least chance of failure will be replaced. Given that we have 5000+ instances of GPR_ASSERT to edit, Doing it manually is too much work for both the author and reviewer. Closes #36816 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36816 from tanvi-jagtap:gpr_assert_removal 9db548beb079195134f7beebdd4b6d37d0254fe3 PiperOrigin-RevId: 640731171 --- src/cpp/ext/otel/otel_plugin.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/cpp/ext/otel/otel_plugin.cc b/src/cpp/ext/otel/otel_plugin.cc index c4bd812fd3c82..55116f5b94799 100644 --- a/src/cpp/ext/otel/otel_plugin.cc +++ b/src/cpp/ext/otel/otel_plugin.cc @@ -251,9 +251,8 @@ OpenTelemetryPlugin::CallbackMetricReporter::CallbackMetricReporter( for (const auto& handle : key->metrics()) { const auto& descriptor = grpc_core::GlobalInstrumentsRegistry::GetInstrumentDescriptor(handle); - GPR_ASSERT( - descriptor.instrument_type == - grpc_core::GlobalInstrumentsRegistry::InstrumentType::kCallbackGauge); + CHECK(descriptor.instrument_type == + grpc_core::GlobalInstrumentsRegistry::InstrumentType::kCallbackGauge); switch (descriptor.value_type) { case grpc_core::GlobalInstrumentsRegistry::ValueType::kInt64: { auto& callback_gauge_state = @@ -700,7 +699,7 @@ void OpenTelemetryPlugin::AddCallback( for (const auto& handle : callback->metrics()) { const auto& descriptor = grpc_core::GlobalInstrumentsRegistry::GetInstrumentDescriptor(handle); - GPR_ASSERT( + CHECK( descriptor.instrument_type == grpc_core::GlobalInstrumentsRegistry::InstrumentType::kCallbackGauge); switch (descriptor.value_type) { @@ -776,7 +775,7 @@ void OpenTelemetryPlugin::RemoveCallback( for (const auto& handle : callback->metrics()) { const auto& descriptor = grpc_core::GlobalInstrumentsRegistry::GetInstrumentDescriptor(handle); - GPR_ASSERT( + CHECK( descriptor.instrument_type == grpc_core::GlobalInstrumentsRegistry::InstrumentType::kCallbackGauge); switch (descriptor.value_type) {