diff options
| author | Roman Shishkin <spark@uwtech.org> | 2025-09-18 05:04:51 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-17 19:04:51 -0700 |
| commit | 83c1bfbacd5d1f89c10db58f436ae6a975208fa3 (patch) | |
| tree | 3878d84b5cd0f8e1db043451946afa7908becd4d | |
| parent | 2b1cfe3c3bc9939331c1736983942cc404db0667 (diff) | |
| download | seaweedfs-83c1bfbacd5d1f89c10db58f436ae6a975208fa3.tar.xz seaweedfs-83c1bfbacd5d1f89c10db58f436ae6a975208fa3.zip | |
Populate bucket_traffic_received_bytes_total metric (#7249)
| -rw-r--r-- | weed/s3api/s3api_object_handlers_put.go | 2 | ||||
| -rw-r--r-- | weed/s3api/stats.go | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/weed/s3api/s3api_object_handlers_put.go b/weed/s3api/s3api_object_handlers_put.go index 2ce91e07c..17fceb8d2 100644 --- a/weed/s3api/s3api_object_handlers_put.go +++ b/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 diff --git a/weed/s3api/stats.go b/weed/s3api/stats.go index 973871bde..14c0ad150 100644 --- a/weed/s3api/stats.go +++ b/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) |
