Skip to content

Commit

Permalink
fix metrics compiler warnings (#1328)
Browse files Browse the repository at this point in the history
  • Loading branch information
esigo authored Apr 15, 2022
1 parent 29d68f1 commit e3304d7
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

1 comment on commit e3304d7

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp sdk Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: e3304d7 Previous: 29d68f1 Ratio
BM_BaselineBuffer/1 14763492.584228516 ns/iter 673226.1180877686 ns/iter 21.93
BM_LockFreeBuffer/1 3759178.1616210938 ns/iter 317285.5528106293 ns/iter 11.85

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.