Documentation
¶
Overview ¶
Package metrics defines the Recorder interface that connectors.Service uses to emit telemetry. The default implementation (SimpleRecorder) uses only stdlib — no external dependency. Projects that want Prometheus can implement Recorder against client_golang and wire it in via connectors.Service.SetMetrics before the server starts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Noop ¶
type Noop struct{}
Noop silently discards all metrics. Used as the zero value when no backend is wired so connector service code stays unconditional.
type Recorder ¶
type Recorder interface {
// RecordRun records one completed connector run.
RecordRun(connectorKey, operationKey, status string, latencyMs int)
// IncActive increments the in-flight run gauge.
IncActive()
// DecActive decrements the in-flight run gauge.
DecActive()
}
Recorder captures connector execution telemetry.
type SimpleRecorder ¶
type SimpleRecorder struct {
// contains filtered or unexported fields
}
SimpleRecorder is a zero-dependency Recorder backed by atomic counters. It exposes a Prometheus-compatible text scrape endpoint via Handler(). Wire it in at boot:
rec := metrics.NewSimpleRecorder()
connectorsSvc.SetMetrics(rec)
mux.Handle("GET /metrics", rec.Handler())
func NewSimpleRecorder ¶
func NewSimpleRecorder() *SimpleRecorder
NewSimpleRecorder returns a ready-to-use SimpleRecorder.
func (*SimpleRecorder) DecActive ¶
func (r *SimpleRecorder) DecActive()
func (*SimpleRecorder) Handler ¶
func (r *SimpleRecorder) Handler() http.Handler
Handler returns an HTTP handler that serves a Prometheus-compatible text exposition of the collected metrics.
func (*SimpleRecorder) IncActive ¶
func (r *SimpleRecorder) IncActive()
func (*SimpleRecorder) RecordRun ¶
func (r *SimpleRecorder) RecordRun(connectorKey, operationKey, status string, latencyMs int)