Branch data Line data Source code
1 : : #include <hpactor/tracing/memory_exporter.hpp>
2 : :
3 : : namespace hpactor::tracing {
4 : :
5 : : result<void>
6 : 2 : MemoryExporter::export_batch(std::span<const SpanRecord> batch) noexcept {
7 : 2 : std::lock_guard<std::mutex> lock(mutex_);
8 : 2 : spans_.insert(spans_.end(), batch.begin(), batch.end());
9 : 2 : return result<void>::make();
10 : 2 : }
11 : :
12 : 1 : std::vector<SpanRecord> MemoryExporter::snapshot() const {
13 : 1 : std::lock_guard<std::mutex> lock(mutex_);
14 : 1 : return spans_;
15 : 1 : }
16 : :
17 : 0 : void MemoryExporter::clear() {
18 : 0 : std::lock_guard<std::mutex> lock(mutex_);
19 : 0 : spans_.clear();
20 : 0 : }
21 : :
22 : : } // namespace hpactor::tracing
|