SIGN IN SIGN UP

telemetry/doca: share one timestamp per export batch (NIX-1625) (#1952)

## What?
The DOCA telemetry exporter now stamps every sample in one drain with a
single
timestamp, instead of reading the DOCA clock 2–3× per event.

## Why?
Each append helper read the clock independently, so one flush produced
~2N–3N
slightly-different timestamps for samples that belong to the same
instant. One
read per drain is cheaper and semantically consistent. (NIX-1625)

## How?
`nixlTelemetryExporter::withBatch()` wraps the drain via a private RAII
guard and
no-op `onBatchBegin`/`onBatchEnd` hooks; the DOCA exporter caches one
timestamp
per batch. No metric names, labels, or buffer-format changes — scrape
output is
unchanged.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added batch-scoped telemetry exporting via `withBatch`, including
begin/end lifecycle hooks for exporters (no-op by default).
* **Bug Fixes**
* Ensured telemetry metrics written during a single batch export share
one consistent timestamp.
* Ensured events exported outside a batch receive fresh, per-event
timestamps.
* Exported queued events and dropped-event metrics within the same batch
context.
  * Documented that batch scopes are not intended to be nested.
* **Tests**
* Added end-to-end tests for shared timestamps within a batch and
distinct timestamps for unbatched exports.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Efraim Eygin <eeygin@nvidia.com>
E
e-eygin committed
eeb94978a47d6658174a67cba74d0a635b3aba67
Parent: 61a743f
Committed by GitHub <noreply@github.com> on 7/27/2026, 2:00:37 PM