Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix metrics compiler warnings #1328

Merged
merged 1 commit into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
ThomsonTan marked this conversation as resolved.
Show resolved Hide resolved
}

/** 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