| 263 | } |
| 264 | |
| 265 | void OTLPMetricsWriter::AddBytesAndFlushIfNeeded(std::size_t newBytes) |
| 266 | { |
| 267 | auto existingBytes = m_RecordedBytes.fetch_add(newBytes, std::memory_order_relaxed); |
| 268 | if (auto bytes{existingBytes + newBytes}; bytes >= static_cast<uint64_t>(GetFlushThreshold())) { |
| 269 | Log(LogDebug, "OTLPMetricsWriter") |
| 270 | << "Flush threshold reached, flushing '" << bytes << "' bytes of OTel metrics."; |
| 271 | Flush(); |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | /** |
| 276 | * Record a data point for the specified OTel metric associated with the given configuration object. |