From a377d10c1d800935f516980ea599551ee56dac1c Mon Sep 17 00:00:00 2001 From: Haoming Meng Date: Fri, 16 Feb 2024 14:51:26 +0000 Subject: [PATCH] Fix missing Prometheus label --- metrics/xrootd_metrics.go | 2 ++ metrics/xrootd_metrics_test.go | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/metrics/xrootd_metrics.go b/metrics/xrootd_metrics.go index 360b09939..d4ac76136 100644 --- a/metrics/xrootd_metrics.go +++ b/metrics/xrootd_metrics.go @@ -580,6 +580,7 @@ func HandlePacket(packet []byte) error { "dn": "", "role": "", "org": "", + "proj": "", } var oldReadvSegs uint64 = 0 var oldReadOps uint32 = 0 @@ -683,6 +684,7 @@ func HandlePacket(packet []byte) error { "dn": "", "role": "", "org": "", + "proj": "", } if item != nil { diff --git a/metrics/xrootd_metrics_test.go b/metrics/xrootd_metrics_test.go index 772d6f9ab..35e5df8dc 100644 --- a/metrics/xrootd_metrics_test.go +++ b/metrics/xrootd_metrics_test.go @@ -582,23 +582,23 @@ func TestHandlePacket(t *testing.T) { expectedTransferReadvSegs := ` # HELP xrootd_transfer_readv_segments_count Number of segments in readv operations # TYPE xrootd_transfer_readv_segments_count counter - xrootd_transfer_readv_segments_count{ap="",dn="",org="",path="/",role=""} 1000 + xrootd_transfer_readv_segments_count{ap="",dn="",org="",path="/",proj="",role=""} 1000 ` expectedTransferOps := ` # HELP xrootd_transfer_operations_count Number of transfer operations performed # TYPE xrootd_transfer_operations_count counter - xrootd_transfer_operations_count{ap="",dn="",org="",path="/",role="",type="read"} 120 - xrootd_transfer_operations_count{ap="",dn="",org="",path="/",role="",type="readv"} 10 - xrootd_transfer_operations_count{ap="",dn="",org="",path="/",role="",type="write"} 30 + xrootd_transfer_operations_count{ap="",dn="",org="",path="/",proj="",role="",type="read"} 120 + xrootd_transfer_operations_count{ap="",dn="",org="",path="/",proj="",role="",type="readv"} 10 + xrootd_transfer_operations_count{ap="",dn="",org="",path="/",proj="",role="",type="write"} 30 ` expectedTransferBytes := ` # HELP xrootd_transfer_bytes Bytes of transfers # TYPE xrootd_transfer_bytes counter - xrootd_transfer_bytes{ap="",dn="",org="",path="/",role="",type="read"} 10000 - xrootd_transfer_bytes{ap="",dn="",org="",path="/",role="",type="readv"} 20000 - xrootd_transfer_bytes{ap="",dn="",org="",path="/",role="",type="write"} 120 + xrootd_transfer_bytes{ap="",dn="",org="",path="/",proj="",role="",type="read"} 10000 + xrootd_transfer_bytes{ap="",dn="",org="",path="/",proj="",role="",type="readv"} 20000 + xrootd_transfer_bytes{ap="",dn="",org="",path="/",proj="",role="",type="write"} 120 ` expectedTransferReadvSegsReader := strings.NewReader(expectedTransferReadvSegs)