From ec4885cb257de310536b7f09ac9eca0f6f5c5f8f Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Tue, 21 Jan 2025 08:11:48 -0600 Subject: [PATCH] common/perf-counters: replace 'assert' with 'ceph_assert' Mostly - as some tests depend on it. But generally - preferring to be able to detect the problems in production code. https://tracker.ceph.com/issues/69613 Signed-off-by: Ronen Friedman --- src/common/perf_counters_cache.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/perf_counters_cache.cc b/src/common/perf_counters_cache.cc index fb63b7acfed43..851160b783f76 100644 --- a/src/common/perf_counters_cache.cc +++ b/src/common/perf_counters_cache.cc @@ -6,15 +6,15 @@ namespace ceph::perf_counters { void PerfCountersCache::check_key(const std::string &key) { [[maybe_unused]] std::string_view key_name = ceph::perf_counters::key_name(key); // don't accept an empty key name - assert(key_name != ""); + ceph_assert(key_name != ""); // if there are no labels, key name is not valid auto key_labels = ceph::perf_counters::key_labels(key); - assert(key_labels.begin() != key_labels.end()); + ceph_assert(key_labels.begin() != key_labels.end()); // don't accept keys where any labels in the key have an empty key name for ([[maybe_unused]] auto key_label : key_labels) { - assert(key_label.first != ""); + ceph_assert(key_label.first != ""); } } @@ -24,7 +24,7 @@ std::shared_ptr PerfCountersCache::add(const std::string &key) { auto [ref, key_existed] = cache.get_or_create(key); if (!key_existed) { ref->counters = create_counters(key, cct); - assert(ref->counters); + ceph_assert(ref->counters); ref->cct = cct; } return ref->counters; -- 2.39.5