Skip to content

Commit

Permalink
Fix decompression latency reporting metric (#137)
Browse files Browse the repository at this point in the history
It should be millis instead of seconds.
  • Loading branch information
jademcosta committed Jun 15, 2024
1 parent 277c4e8 commit b531c45
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions pkg/adapters/http_in/ingest_routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@ func decompress(data []byte, algorithm string, pathForMetrics string, bufferSize
return nil, fmt.Errorf("error closing decompressor data: %w", err)
}

elapsedTime := time.Since(timeStart).Seconds()
observeDecompressionTime(pathForMetrics, elapsedTime)
observeDecompressionTime(pathForMetrics, time.Since(timeStart))

return decompressedData, nil
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/adapters/http_in/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package http_in

import (
"sync"
"time"

"github.com/prometheus/client_golang/prometheus"
)
Expand Down Expand Up @@ -72,8 +73,8 @@ func observeSize(path string, size float64) {
sizeHist.WithLabelValues(path).Observe(size)
}

func observeDecompressionTime(path string, elapsedTime float64) {
decompressionLatencyHist.WithLabelValues(path).Observe(elapsedTime)
func observeDecompressionTime(path string, elapsedTime time.Duration) {
decompressionLatencyHist.WithLabelValues(path).Observe(float64(elapsedTime.Milliseconds()))
}

func increaseDecompressionCount(algorithm string) {
Expand Down

0 comments on commit b531c45

Please sign in to comment.