/
pgStatReplicationSlots_gen.go
107 lines (91 loc) · 4.13 KB
/
pgStatReplicationSlots_gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*generated by binding gen*/
package models
import (
"github.com/prometheus/client_golang/prometheus"
)
type PgStatReplicationSlotsSlice []PgStatReplicationSlots
func (r PgStatReplicationSlotsSlice) ToMetrics(namespace string, subsystem string, ch chan<- prometheus.Metric, labelsKV ...string) error {
for _, row := range []PgStatReplicationSlots(r) {
if err := row.ToMetrics(namespace, subsystem, ch, labelsKV...); err != nil {
return err
}
}
return nil
}
func (r *PgStatReplicationSlots) ToMetrics(namespace string, subsystem string, ch chan<- prometheus.Metric, labelsKV ...string) error {
labels := newLabels(labelsKV...)
// labels
labels["slot_name"] = r.SlotName
// optional labels
// metrics
// spill_txns (CounterValue)
spillTxns := float64(r.SpillTxns)
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, `spill_txns`), `Number of transactions spilled to disk once the memory used by logical decoding to decode changes from WAL has exceeded logical_decoding_work_mem`, nil, labels,
), prometheus.CounterValue, spillTxns,
)
// spill_count (CounterValue)
spillCount := float64(r.SpillCount)
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, `spill_count`), `Number of times transactions were spilled to disk while decoding changes from WAL for this slot`, nil, labels,
), prometheus.CounterValue, spillCount,
)
// spill_bytes (CounterValue)
spillBytes := float64(r.SpillBytes)
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, `spill_bytes`), `Amount of decoded transaction data spilled to disk while performing decoding of changes from WAL for this slot`, nil, labels,
), prometheus.CounterValue, spillBytes,
)
// stream_txns (CounterValue)
streamTxns := float64(r.StreamTxns)
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, `stream_txns`), `Number of in-progress transactions streamed to the decoding output plugin after the memory used by logical decoding to decode changes from WAL for this slot has exceeded logical_decoding_work_mem`, nil, labels,
), prometheus.CounterValue, streamTxns,
)
// stream_count (CounterValue)
streamCount := float64(r.StreamCount)
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, `stream_count`), `Number of times in-progress transactions were streamed to the decoding output plugin while decoding changes from WAL for this slot`, nil, labels,
), prometheus.CounterValue, streamCount,
)
// stream_bytes (CounterValue)
streamBytes := float64(r.StreamBytes)
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, `stream_bytes`), `Amount of transaction data decoded for streaming in-progress transactions to the decoding output plugin while decoding changes from WAL for this slot`, nil, labels,
), prometheus.CounterValue, streamBytes,
)
// total_txns (CounterValue)
totalTxns := float64(r.TotalTxns)
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, `total_txns`), `Number of decoded transactions sent to the decoding output plugin for this slot`, nil, labels,
), prometheus.CounterValue, totalTxns,
)
// total_bytes (CounterValue)
totalBytes := float64(r.TotalBytes)
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, `total_bytes`), `Amount of transaction data decoded for sending transactions to the decoding output plugin while decoding changes from WAL for this slot`, nil, labels,
), prometheus.CounterValue, totalBytes,
)
// stats_reset (CounterValue)
var statsReset float64
if r.StatsReset.IsZero() {
statsReset = float64(0)
} else {
statsReset = float64(r.StatsReset.Unix())
}
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, `stats_reset`), `Time at which these statistics were last reset`, nil, labels,
), prometheus.CounterValue, statsReset,
)
// optional metrics
return nil
}