Browse Source

Populate bucket_traffic_received_bytes_total metric (#7249)

pull/7178/merge
Roman Shishkin 2 weeks ago
committed by GitHub
parent
commit
83c1bfbacd
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      weed/s3api/s3api_object_handlers_put.go
  2. 6
      weed/s3api/stats.go

2
weed/s3api/s3api_object_handlers_put.go

@ -362,7 +362,7 @@ func (s3a *S3ApiServer) putToFiler(r *http.Request, uploadUrl string, dataReader
return "", filerErrorToS3Error(ret.Error), ""
}
stats_collect.RecordBucketActiveTime(bucket)
BucketTrafficReceived(ret.Size, r)
// Return the SSE type determined by the unified handler
return etag, s3err.ErrNone, sseResult.SSEType

6
weed/s3api/stats.go

@ -37,6 +37,12 @@ func TimeToFirstByte(action string, start time.Time, r *http.Request) {
stats_collect.RecordBucketActiveTime(bucket)
}
func BucketTrafficReceived(bytesReceived int64, r *http.Request) {
bucket, _ := s3_constants.GetBucketAndObject(r)
stats_collect.RecordBucketActiveTime(bucket)
stats_collect.S3BucketTrafficReceivedBytesCounter.WithLabelValues(bucket).Add(float64(bytesReceived))
}
func BucketTrafficSent(bytesTransferred int64, r *http.Request) {
bucket, _ := s3_constants.GetBucketAndObject(r)
stats_collect.RecordBucketActiveTime(bucket)

Loading…
Cancel
Save