fix(telemetry): address code review issues in OTelCollector

- Fix use-after-free: extract gauge callback to static function and call
  RemoveCallback in ~OTelGaugeImpl() before unregistering from collector
- Use memory_order_acq_rel on callHooks() debounce CAS for proper
  happens-before relationship between hook invocations
- Add explicit 2s timeout to ForceFlush() in destructor to prevent
  blocking indefinitely when OTLP endpoint is unreachable at shutdown
- Add OTLP receiver to metrics pipeline so native OTel metrics from
  xrpld are actually received by the collector
- Remove stale health check port from docker-compose (extension was
  removed from collector config)
- Clarify fallback docs: StatsD path requires re-enabling receiver/port
- Fix comments: Counter uses uint64_t not int64_t, gauge clamps to
  [0, INT64_MAX] not [0, UINT64_MAX]

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Pratik Mankawde
2026-05-06 14:24:52 +01:00
parent ed31bab500
commit 761688383d
5 changed files with 28 additions and 28 deletions

View File

@@ -49,7 +49,7 @@ namespace insight {
* Replaces StatsD-based metric collection with native OTel Metrics SDK
* instruments. Each beast::insight instrument maps to an OTel equivalent:
*
* - Counter -> OTel Counter<int64_t>
* - Counter -> OTel Counter<uint64_t>
* - Gauge -> OTel ObservableGauge<int64_t> (async callback)
* - Event -> OTel Histogram<double> (duration in milliseconds)
* - Meter -> OTel Counter<uint64_t> (monotonic, unsigned)