contrib

module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: Apache-2.0

README

tickbatch/contrib

Optional integration adapters for tickbatch. This is a separate Go module so that pulling in Prometheus (or any future adapter dependency) never breaches the core library's zero-dependency guarantee. The core tickbatch module remains stdlib-only; only code that imports contrib takes on these dependencies.

All adapters are pull-based: they sample Batcher.Stats() (a handful of atomic loads) at scrape/read time and never touch the Push hot path.

Packages

  • tickbatchprom - a prometheus.Collector that exports tickbatch counters and gauges. Register tickbatchprom.NewCollector("myapp", b.Stats) with your registry.
  • tickbatchexpvar - publishes the same snapshot as JSON through the standard library expvar package (no third-party dependency). Call tickbatchexpvar.Publish("tickbatch", b.Stats).

OpenTelemetry Collector terminology mapping

There is no OTel dependency here; instead, this table documents how to map tickbatch counters onto the OTel Collector's otelcol_* self-observability vocabulary when you forward these metrics into an OTel pipeline:

tickbatch Stats field OTel Collector analogue Notes
Dropped refused / dropped (queue full) DropNewest: incoming item rejected.
Evicted dropped (overflow) DropOldest: oldest queued item discarded.
Truncated dropped (bad item) Marshal returned an invalid size; item discarded.
FlushErrors send failures Failed or timed-out sink flushes.
FlushedBatches sent (batches) Batches accepted by the sink.
FlushedItems sent (spans/points) Items accepted by the sink.
QueueDepth queue size Best-effort gauge; leading saturation indicator.
QueueCap queue capacity Ring capacity.

Queue-side data loss (items that never reached the sink) is Dropped + Evicted + Truncated. This does not include flush-side loss: a failed or timed-out Sink.Flush abandons an entire already-serialized batch without touching those counters - that loss is signaled by FlushErrors (and the undelivered bytes are absent from BytesFlushed). A rising FlushErrors while LastFlushAt is stale is the primary signal of a partitioned downstream sink.

Directories

Path Synopsis
Package tickbatchexpvar publishes a tickbatch.Batcher's operational counters through the standard library expvar package.
Package tickbatchexpvar publishes a tickbatch.Batcher's operational counters through the standard library expvar package.
Package tickbatchprom bridges a tickbatch.Batcher's operational counters to Prometheus via a pull-based prometheus.Collector.
Package tickbatchprom bridges a tickbatch.Batcher's operational counters to Prometheus via a pull-based prometheus.Collector.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL