Skip to content

Commit 9e5d1aa

Browse files
committed
Preserve the misspelled metric name for backwards compatibility
1 parent 9ed00b2 commit 9e5d1aa

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

metrics/xrootd_metrics.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,13 +460,20 @@ var (
460460
Help: "The total number of monitoring UDP packets received",
461461
})
462462

463-
// TODO: Remove this metric (the line directly below)
464-
// The renamed metric was added in v7.16
463+
// TODO: Remove this metric when we can break backwards compatibility.
464+
// The renamed metric ("count" -> "toal") was added in v7.16.
465465
TransferReadvSegs = promauto.NewCounterVec(prometheus.CounterOpts{
466466
Name: "xrootd_transfer_readv_segments_count",
467467
Help: "Number of segments in readv operations",
468468
}, []string{"path", "ap", "dn", "role", "org", "proj", "network"})
469469

470+
// TODO: Remove this metric when we can break backwards compatibility.
471+
// The renamed metric ("toal" -> "total") was added in v7.25.
472+
TransferReadvSegsTotalDeprecated = promauto.NewCounterVec(prometheus.CounterOpts{
473+
Name: "xrootd_transfer_readv_segments_toal",
474+
Help: "Number of segments in readv operations",
475+
}, []string{"path", "ap", "dn", "role", "org", "proj", "network"})
476+
470477
TransferReadvSegsTotal = promauto.NewCounterVec(prometheus.CounterOpts{
471478
Name: "xrootd_transfer_readv_segments_total",
472479
Help: "Number of segments in readv operations",
@@ -1367,6 +1374,10 @@ func handlePacket(packet []byte) error {
13671374
// TODO: Remove this metric (the 2 lines directly below)
13681375
// The renamed metric was added in v7.16
13691376
counter := TransferReadvSegs.With(labels)
1377+
counter.Add(float64(int64(binary.BigEndian.Uint64(
1378+
packet[offset+opsOffset+16:offset+opsOffset+24]) -
1379+
oldReadvSegs)))
1380+
counter = TransferReadvSegsTotalDeprecated.With(labels)
13701381
counter.Add(float64(int64(binary.BigEndian.Uint64(
13711382
packet[offset+opsOffset+16:offset+opsOffset+24]) -
13721383
oldReadvSegs)))

0 commit comments

Comments
 (0)