Skip to content

Commit

Permalink
[BUILD] Fix compiling problems for gcc 4.8 (#3100)
Browse files Browse the repository at this point in the history
* Fix compiling problems for gcc 4.8

* Apply suggestions from code review

---------

Co-authored-by: Marc Alff <marc.alff@free.fr>
  • Loading branch information
owent and marcalff authored Oct 17, 2024
1 parent 70ed9bc commit 63683c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions exporters/memory/src/in_memory_metric_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ void SimpleAggregateInMemoryMetricData::Add(std::unique_ptr<ResourceMetrics> res
const auto &metric = m.instrument_descriptor.name_;
for (const auto &pda : m.point_data_attr_)
{
data_[{scope, metric}].insert({pda.attributes, pda.point_data});
// NOTE: Explicit type conversion added for C++11 (gcc 4.8)
data_[std::tuple<std::string, std::string>{scope, metric}].insert(
{pda.attributes, pda.point_data});
}
}
}
Expand All @@ -41,7 +43,8 @@ const SimpleAggregateInMemoryMetricData::AttributeToPoint &SimpleAggregateInMemo
const std::string &scope,
const std::string &metric)
{
return data_[{scope, metric}];
// NOTE: Explicit type conversion added for C++11 (gcc 4.8)
return data_[std::tuple<std::string, std::string>{scope, metric}];
}

void SimpleAggregateInMemoryMetricData::Clear()
Expand Down
3 changes: 2 additions & 1 deletion exporters/memory/src/in_memory_metric_exporter_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ class InMemoryMetricExporter final : public sdk::metrics::PushMetricExporter
std::unique_ptr<PushMetricExporter> InMemoryMetricExporterFactory::Create(
const std::shared_ptr<InMemoryMetricData> &data)
{
return Create(data, [](auto) { return AggregationTemporality::kCumulative; });
return Create(data,
[](sdk::metrics::InstrumentType) { return AggregationTemporality::kCumulative; });
}

std::unique_ptr<PushMetricExporter> InMemoryMetricExporterFactory::Create(
Expand Down

2 comments on commit 63683c1

@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 api Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 63683c1 Previous: 70ed9bc Ratio
BM_SpinLockThrashing/1/process_time/real_time 3.1052589416503906 ms/iter 0.14485636025743412 ms/iter 21.44
BM_ProcYieldSpinLockThrashing/4/process_time/real_time 3.1148893077199054 ms/iter 1.4384677729655786 ms/iter 2.17
BM_NaiveSpinLockThrashing/1/process_time/real_time 0.4219774836480755 ms/iter 0.1243734359741211 ms/iter 3.39
BM_NaiveSpinLockThrashing/2/process_time/real_time 1.0431408882141113 ms/iter 0.2972066658249229 ms/iter 3.51

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

@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: 63683c1 Previous: 70ed9bc Ratio
BM_LockFreeBuffer/1 5948133.46862793 ns/iter 2242071.1517333984 ns/iter 2.65
BM_LockFreeBuffer/2 5451579.0939331055 ns/iter 2650798.614858237 ns/iter 2.06

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

Please sign in to comment.