Skip to content

Commit f740d91

Browse files
committed
Clean up the extra assignments
Signed-off-by: Felix Yuan <[email protected]>
1 parent 67ab6f3 commit f740d91

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

collector/pg_stat_walreceiver.go

+8-16
Original file line numberDiff line numberDiff line change
@@ -205,55 +205,48 @@ func (c *PGStatWalReceiverCollector) Update(ctx context.Context, instance *insta
205205
level.Debug(c.log).Log("msg", "Skipping wal receiver stats because upstream_node is null")
206206
continue
207207
}
208-
receiveStartLsnMetric := float64(receiveStartLsn.Int64)
209208
ch <- prometheus.MustNewConstMetric(
210209
statWalReceiverReceiveStartLsn,
211210
prometheus.CounterValue,
212-
receiveStartLsnMetric,
211+
float64(receiveStartLsn.Int64),
213212
labels...)
214213

215-
receiveStartTliMetric := float64(receiveStartTli.Int64)
216214
ch <- prometheus.MustNewConstMetric(
217215
statWalReceiverReceiveStartTli,
218216
prometheus.GaugeValue,
219-
receiveStartTliMetric,
217+
float64(receiveStartTli.Int64),
220218
labels...)
221219

222220
if hasFlushedLSN {
223-
flushedLsnMetric := float64(flushedLsn.Int64)
224221
ch <- prometheus.MustNewConstMetric(
225222
statWalReceiverFlushedLSN,
226223
prometheus.CounterValue,
227-
flushedLsnMetric,
224+
float64(flushedLsn.Int64),
228225
labels...)
229226
}
230227

231-
receivedTliMetric := float64(receivedTli.Int64)
232228
ch <- prometheus.MustNewConstMetric(
233229
statWalReceiverReceivedTli,
234230
prometheus.GaugeValue,
235-
receivedTliMetric,
231+
float64(receivedTli.Int64),
236232
labels...)
237233

238-
lastMsgSendTimeMetric := float64(lastMsgSendTime.Float64)
239234
ch <- prometheus.MustNewConstMetric(
240235
statWalReceiverLastMsgSendTime,
241236
prometheus.CounterValue,
242-
lastMsgSendTimeMetric,
237+
float64(lastMsgSendTime.Float64),
243238
labels...)
244239

245-
lastMsgReceiptTimeMetric := float64(lastMsgReceiptTime.Float64)
246240
ch <- prometheus.MustNewConstMetric(
247241
statWalReceiverLastMsgReceiptTime,
248242
prometheus.CounterValue,
249-
lastMsgReceiptTimeMetric,
243+
float64(lastMsgReceiptTime.Float64),
250244
labels...)
251245

252-
latestEndLsnMetric := float64(latestEndLsn.Int64)
253246
ch <- prometheus.MustNewConstMetric(
254247
statWalReceiverLatestEndLsn,
255248
prometheus.CounterValue,
256-
latestEndLsnMetric,
249+
float64(latestEndLsn.Int64),
257250
labels...)
258251

259252
ch <- prometheus.MustNewConstMetric(
@@ -262,11 +255,10 @@ func (c *PGStatWalReceiverCollector) Update(ctx context.Context, instance *insta
262255
latestEndTime.Float64,
263256
labels...)
264257

265-
upstreamNodeMetric := float64(upstreamNode.Int64)
266258
ch <- prometheus.MustNewConstMetric(
267259
statWalReceiverUpstreamNode,
268260
prometheus.GaugeValue,
269-
upstreamNodeMetric,
261+
float64(upstreamNode.Int64),
270262
labels...)
271263
}
272264
if err := rows.Err(); err != nil {

0 commit comments

Comments
 (0)