Skip to content

Commit

Permalink
Fix small issues
Browse files Browse the repository at this point in the history
  • Loading branch information
godexsoft committed Dec 26, 2024
1 parent 04a6da8 commit ed29df5
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/migration/impl/MigrationManagerFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ namespace migration::impl {
std::expected<std::shared_ptr<MigrationManagerInterface>, std::string>
makeMigrationManager(util::config::ClioConfigDefinition const& config)
{
static util::Logger const kLOG{"Migration"};
LOG(kLOG.info()) << "Constructing MigrationManager";
static util::Logger const log{"Migration"}; // NOLINT(readability-identifier-naming)
LOG(log.info()) << "Constructing MigrationManager";

auto const type = config.get<std::string>("database.type");

if (not boost::iequals(type, "cassandra")) {
LOG(kLOG.error()) << "Unknown database type to migrate: " << type;
LOG(log.error()) << "Unknown database type to migrate: " << type;
return std::unexpected(std::string("Invalid database type"));
}

Expand Down
4 changes: 2 additions & 2 deletions src/rpc/Errors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ getWarningInfo(WarningCode code)
};

auto matchByCode = [code](auto const& info) { return info.code == code; };
if (auto it = std::ranges::find_if(kINFOS, matchByCode); it != end(kINFOS))
if (auto it = ranges::find_if(kINFOS, matchByCode); it != end(kINFOS))
return *it;

throw(out_of_range("Invalid WarningCode"));
Expand Down Expand Up @@ -110,7 +110,7 @@ getErrorInfo(ClioError code)
};

auto matchByCode = [code](auto const& info) { return info.code == code; };
if (auto it = ranges::find_if(begin(kINFOS), end(kINFOS), matchByCode); it != end(kINFOS))
if (auto it = ranges::find_if(kINFOS, matchByCode); it != end(kINFOS))
return *it;

throw(out_of_range("Invalid error code"));
Expand Down
2 changes: 1 addition & 1 deletion src/util/prometheus/MetricBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ toString(MetricType type)
[[fallthrough]];
case MetricType::HistogramDouble:
return "histogram";
case MetricType::SUMMARY:
case MetricType::Summary:

Check warning on line 58 in src/util/prometheus/MetricBase.cpp

View check run for this annotation

Codecov / codecov/patch

src/util/prometheus/MetricBase.cpp#L58

Added line #L58 was not covered by tests
return "summary";
default:
ASSERT(false, "Unknown metric {}.", static_cast<int>(type));
Expand Down
2 changes: 1 addition & 1 deletion src/util/prometheus/MetricBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class MetricBase {
std::string labelsString_;
};

enum class MetricType { CounterInt, CounterDouble, GaugeInt, GaugeDouble, HistogramInt, HistogramDouble, SUMMARY };
enum class MetricType { CounterInt, CounterDouble, GaugeInt, GaugeDouble, HistogramInt, HistogramDouble, Summary };

char const*
toString(MetricType type);
Expand Down
4 changes: 2 additions & 2 deletions src/util/prometheus/MetricBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ MetricBuilder::makeMetric(std::string name, std::string labelsString, MetricType
[[fallthrough]];
case MetricType::HistogramDouble:
[[fallthrough]];
case MetricType::SUMMARY:
case MetricType::Summary:
[[fallthrough]];
default:
ASSERT(false, "Unknown metric type: {}", static_cast<int>(type));
Expand Down Expand Up @@ -120,7 +120,7 @@ MetricBuilder::makeHistogram(
[[fallthrough]];
case MetricType::GaugeDouble:
[[fallthrough]];
case MetricType::SUMMARY:
case MetricType::Summary:
[[fallthrough]];
default:
ASSERT(false, "Unknown metric type: {}", static_cast<int>(type));
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/util/prometheus/MetricBuilderTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ TEST(MetricBuilderDeathTest, build)
EXPECT_EQ(metric->labelsString(), labelsString);
}
}
EXPECT_DEATH({ builder(name, labelsString, MetricType::SUMMARY, std::vector<std::int64_t>{}); }, "");
EXPECT_DEATH({ builder(name, labelsString, MetricType::Summary, std::vector<std::int64_t>{}); }, "");
}

0 comments on commit ed29df5

Please sign in to comment.