Observability without dependencies: OTel/Prometheus adapters, tracing, histograms #7
Unanswered
cognis-digital
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
safequeue is deliberately standard-library only — no third-party dependencies. Observability is exposed through a tiny
metrics.Recorderinterface (Inc/Set/Observe) with aNopdefault and anexpvaradapter that publishes under/debug/vars. The queue emitsenqueued,dequeued,acked,nacked,dead_letter,throttled,rejected,depth,high_water, plus enqueue latency.The open question is how far to go on observability without compromising the zero-dependency promise.
1. OpenTelemetry.
Anyone can implement
Recorderagainst an OTel meter today, so the queue itself needs no OTel dependency. Options for making it turnkey:.../safequeue/otelwith its owngo.mod) so the core stays dependency-free and only users who import the adapter pull OTel in. This seems like the cleanest way to have both. Thoughts?2. Tracing / context propagation.
Observegives latency but no spans. ShouldEnqueue/Dequeueaccept acontext.Contextso callers can propagate trace context (message enqueued in span A, processed in span B)? This is a small API addition but touches the hot path.3. Prometheus.
expvaris stdlib but not Prometheus-native. Would a stdlib-only/metricstext-exposition-format handler (hand-rolled, no client_golang dependency) be valuable, or do people prefer to bridge expvar → Prometheus with an existing exporter?4. Histogram fidelity.
The
expvaradapter reducesObserveto count+sum (average latency only). Is p50/p95/p99 needed at the core, or is that a job for the OTel/Prometheus adapter where real histograms live?Where's the line for you — is the
Recorderinterface + expvar enough, and OTel/Prometheus strictly opt-in adapters, or do you want first-class support in-tree?All reactions