|
89 | 89 | `
|
90 | 90 | )
|
91 | 91 |
|
92 |
| -func gaugeInt32(ch chan<- prometheus.Metric, desc *prometheus.Desc, m sql.NullInt32) { |
93 |
| - mM := 0.0 |
94 |
| - if m.Valid { |
95 |
| - mM = float64(m.Int32) |
96 |
| - } |
97 |
| - ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, mM) |
98 |
| -} |
99 |
| - |
100 | 92 | // Update implements Collector
|
101 | 93 | // It is called by the Prometheus registry when collecting metrics.
|
102 | 94 | func (c BuffercacheSummaryCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error {
|
@@ -133,10 +125,10 @@ func (c BuffercacheSummaryCollector) Update(ctx context.Context, instance *insta
|
133 | 125 | usageCountAvgDesc,
|
134 | 126 | prometheus.GaugeValue,
|
135 | 127 | usagecountAvgMetric)
|
136 |
| - gaugeInt32(used, buffersUsedDesc, ch) |
137 |
| - gaugeInt32(unused, buffersUnusedDesc, ch) |
138 |
| - gaugeInt32(dirty, buffersDirtyDesc, ch) |
139 |
| - gaugeInt32(pinned, buffersPinnedDesc, ch) |
| 128 | + ch <- prometheus.MustNewConstMetric(buffersUsedDesc, prometheus.GaugeValue, Int32(used)) |
| 129 | + ch <- prometheus.MustNewConstMetric(buffersUnusedDesc, prometheus.GaugeValue, Int32(unused)) |
| 130 | + ch <- prometheus.MustNewConstMetric(buffersDirtyDesc, prometheus.GaugeValue, Int32(dirty)) |
| 131 | + ch <- prometheus.MustNewConstMetric(buffersPinnedDesc, prometheus.GaugeValue, Int32(pinned)) |
140 | 132 | }
|
141 | 133 |
|
142 | 134 | return rows.Err()
|
|
0 commit comments