Skip to content

Commit

Permalink
Fix missing Prometheus label
Browse files Browse the repository at this point in the history
  • Loading branch information
haoming29 committed Feb 16, 2024
1 parent 0dc47d9 commit a377d10
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions metrics/xrootd_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ func HandlePacket(packet []byte) error {
"dn": "",
"role": "",
"org": "",
"proj": "",
}
var oldReadvSegs uint64 = 0
var oldReadOps uint32 = 0
Expand Down Expand Up @@ -683,6 +684,7 @@ func HandlePacket(packet []byte) error {
"dn": "",
"role": "",
"org": "",
"proj": "",
}

if item != nil {
Expand Down
14 changes: 7 additions & 7 deletions metrics/xrootd_metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a377d10

Please sign in to comment.