Skip to content

Commit

Permalink
[BUILD] Fix compiling problems for gcc 4.8 (open-telemetry#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 <[email protected]>
  • 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

0 comments on commit 63683c1

Please sign in to comment.