MCPcopy Index your code
hub / github.com/coder/coder / newMetrics

Function newMetrics

agent/boundarylogproxy/metrics.go:40–77  ·  view source on GitHub ↗
(registerer prometheus.Registerer)

Source from the content-addressed store, hash-verified

38}
39
40func newMetrics(registerer prometheus.Registerer) *Metrics {
41 batchesDropped := prometheus.NewCounterVec(prometheus.CounterOpts{
42 Namespace: "agent",
43 Subsystem: "boundary_log_proxy",
44 Name: "batches_dropped_total",
45 Help: "Total number of boundary log batches dropped before reaching coderd. " +
46 "Reason: buffer_full = the agent's internal buffer is full, meaning boundary is producing logs faster than the agent can forward them to coderd; " +
47 "forward_failed = the agent failed to send the batch to coderd, potentially because coderd is unreachable or the connection was interrupted.",
48 }, []string{"reason"})
49 registerer.MustRegister(batchesDropped)
50
51 logsDropped := prometheus.NewCounterVec(prometheus.CounterOpts{
52 Namespace: "agent",
53 Subsystem: "boundary_log_proxy",
54 Name: "logs_dropped_total",
55 Help: "Total number of individual boundary log entries dropped before reaching coderd. " +
56 "Reason: buffer_full = the agent's internal buffer is full; " +
57 "forward_failed = the agent failed to send the batch to coderd; " +
58 "boundary_channel_full = boundary's internal send channel overflowed, meaning boundary is generating logs faster than it can batch and send them; " +
59 "boundary_batch_full = boundary's outgoing batch buffer overflowed after a failed flush, meaning boundary could not write to the agent's socket.",
60 }, []string{"reason"})
61 registerer.MustRegister(logsDropped)
62
63 batchesForwarded := prometheus.NewCounter(prometheus.CounterOpts{
64 Namespace: "agent",
65 Subsystem: "boundary_log_proxy",
66 Name: "batches_forwarded_total",
67 Help: "Total number of boundary log batches successfully forwarded to coderd. " +
68 "Compare with batches_dropped_total to compute a drop rate.",
69 })
70 registerer.MustRegister(batchesForwarded)
71
72 return &Metrics{
73 batchesDropped: batchesDropped,
74 logsDropped: logsDropped,
75 batchesForwarded: batchesForwarded,
76 }
77}

Callers 1

NewServerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected