Skip to content

Commit e3304d7

Browse files
authored
fix metrics compiler warnings (open-telemetry#1328)
1 parent 29d68f1 commit e3304d7

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

sdk/include/opentelemetry/sdk/metrics/view/attributes_processor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class AttributesProcessor
2323
// @returns The processed attributes
2424
virtual MetricAttributes process(
2525
const opentelemetry::common::KeyValueIterable &attributes) const noexcept = 0;
26+
27+
virtual ~AttributesProcessor() = default;
2628
};
2729

2830
/**

sdk/src/metrics/meter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ std::unique_ptr<WritableMetricStorage> Meter::RegisterMetricStorage(
206206
"[Meter::RegisterMetricStorage] - Error during finding matching views."
207207
<< "Some of the matching view configurations mayn't be used for metric collection");
208208
}
209-
return std::move(storages);
209+
return storages;
210210
}
211211

212212
/** collect metrics across all the meters **/

sdk/test/metrics/attributes_hashmap_benchmark.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@ void BM_AttributseHashMap(benchmark::State &state)
2727

2828
std::function<std::unique_ptr<Aggregation>()> create_default_aggregation =
2929
[]() -> std::unique_ptr<Aggregation> {
30-
auto agg = std::unique_ptr<Aggregation>(new DropAggregation);
31-
return std::move(agg);
30+
return std::unique_ptr<Aggregation>(new DropAggregation);
3231
};
3332

3433
while (state.KeepRunning())
3534
{
36-
for (int i = 0; i < MAX_THREADS; i++)
35+
for (size_t i = 0; i < MAX_THREADS; i++)
3736
{
3837
workers.push_back(std::thread([&]() {
3938
hash_map.GetOrSetDefault(attributes[i % 2], create_default_aggregation)->Aggregate(1l);

sdk/test/metrics/attributes_hashmap_test.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ TEST(AttributesHashMap, BasicTests)
4949
// GetOrSetDefault
5050
std::function<std::unique_ptr<Aggregation>()> create_default_aggregation =
5151
[]() -> std::unique_ptr<Aggregation> {
52-
auto agg = std::unique_ptr<Aggregation>(new DropAggregation);
53-
return std::move(agg);
52+
return std::unique_ptr<Aggregation>(new DropAggregation);
5453
};
5554
MetricAttributes m4 = {{"k1", "v1"}, {"k2", "v2"}, {"k3", "v3"}};
5655
EXPECT_NO_THROW(hash_map.GetOrSetDefault(m4, create_default_aggregation)->Aggregate(1l));

0 commit comments

Comments
 (0)