Skip to content

Commit

Permalink
fix metrics compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
esigo committed Apr 14, 2022
1 parent 29d68f1 commit 127c2fe
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class AttributesProcessor
// @returns The processed attributes
virtual MetricAttributes process(
const opentelemetry::common::KeyValueIterable &attributes) const noexcept = 0;

virtual ~AttributesProcessor() = default;
};

/**
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/metrics/meter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ std::unique_ptr<WritableMetricStorage> Meter::RegisterMetricStorage(
"[Meter::RegisterMetricStorage] - Error during finding matching views."
<< "Some of the matching view configurations mayn't be used for metric collection");
}
return std::move(storages);
return storages;
}

/** collect metrics across all the meters **/
Expand Down
5 changes: 2 additions & 3 deletions sdk/test/metrics/attributes_hashmap_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@ void BM_AttributseHashMap(benchmark::State &state)

std::function<std::unique_ptr<Aggregation>()> create_default_aggregation =
[]() -> std::unique_ptr<Aggregation> {
auto agg = std::unique_ptr<Aggregation>(new DropAggregation);
return std::move(agg);
return std::unique_ptr<Aggregation>(new DropAggregation);
};

while (state.KeepRunning())
{
for (int i = 0; i < MAX_THREADS; i++)
for (size_t i = 0; i < MAX_THREADS; i++)
{
workers.push_back(std::thread([&]() {
hash_map.GetOrSetDefault(attributes[i % 2], create_default_aggregation)->Aggregate(1l);
Expand Down
3 changes: 1 addition & 2 deletions sdk/test/metrics/attributes_hashmap_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ TEST(AttributesHashMap, BasicTests)
// GetOrSetDefault
std::function<std::unique_ptr<Aggregation>()> create_default_aggregation =
[]() -> std::unique_ptr<Aggregation> {
auto agg = std::unique_ptr<Aggregation>(new DropAggregation);
return std::move(agg);
return std::unique_ptr<Aggregation>(new DropAggregation);
};
MetricAttributes m4 = {{"k1", "v1"}, {"k2", "v2"}, {"k3", "v3"}};
EXPECT_NO_THROW(hash_map.GetOrSetDefault(m4, create_default_aggregation)->Aggregate(1l));
Expand Down

0 comments on commit 127c2fe

Please sign in to comment.