From 3385f849c0c0817b678ba8ebef27dc9c25d99a8b Mon Sep 17 00:00:00 2001 From: Andrenerd Date: Sat, 12 Jun 2021 04:50:02 +0200 Subject: [PATCH] fix allocated size --- code/go/0chain.net/blobbercore/stats/blobberstats.go | 10 +++++----- code/go/0chain.net/blobbercore/stats/handler.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/code/go/0chain.net/blobbercore/stats/blobberstats.go b/code/go/0chain.net/blobbercore/stats/blobberstats.go index 3369ef6ae..5d4f1c111 100644 --- a/code/go/0chain.net/blobbercore/stats/blobberstats.go +++ b/code/go/0chain.net/blobbercore/stats/blobberstats.go @@ -42,7 +42,7 @@ type WriteMarkersStat struct { } type Stats struct { - TotalSize int64 `json:"total_size"` // the total allocated size + AllocatedSize int64 `json:"allocated_size"` UsedSize int64 `json:"used_size"` FilesSize int64 `json:"files_size"` ThumbnailsSize int64 `json:"thumbnails_size"` @@ -145,7 +145,7 @@ func (bs *BlobberStats) loadDetailedStats(ctx context.Context) { } given[as.AllocationID] = struct{}{} - bs.TotalSize += as.TotalSize + bs.AllocatedSize += as.AllocatedSize as.ReadMarkers, err = loadAllocReadMarkersStat(ctx, as.AllocationID) if err != nil { @@ -252,7 +252,7 @@ func (bs *BlobberStats) loadAllocationStats(ctx context.Context) { SUM(file_stats.num_of_block_downloads) as num_of_reads, SUM(reference_objects.num_of_blocks) as num_of_block_writes, COUNT(*) as num_of_writes, - allocations.size AS total_size, + allocations.size AS allocated_size, allocations.expiration_date AS expiration_date`). Joins(`INNER JOIN file_stats ON reference_objects.id = file_stats.ref_id`). @@ -273,8 +273,8 @@ func (bs *BlobberStats) loadAllocationStats(ctx context.Context) { for rows.Next() { var as = &AllocationStats{} - err = rows.Scan(&as.AllocationID, &as.TotalSize, &as.FilesSize, &as.ThumbnailsSize, - &as.NumReads, &as.BlockWrites, &as.NumWrites, &as.Expiration) + err = rows.Scan(&as.AllocationID, &as.FilesSize, &as.ThumbnailsSize, + &as.NumReads, &as.BlockWrites, &as.NumWrites, &as.AllocatedSize, &as.Expiration) if err != nil { Logger.Error("Error in scanning record for blobber stats", zap.Error(err)) diff --git a/code/go/0chain.net/blobbercore/stats/handler.go b/code/go/0chain.net/blobbercore/stats/handler.go index aacd60049..faea3cdaa 100644 --- a/code/go/0chain.net/blobbercore/stats/handler.go +++ b/code/go/0chain.net/blobbercore/stats/handler.go @@ -65,7 +65,7 @@ const tpl = ` Allocated size (bytes) - {{ .TotalSize }} + {{ .AllocatedSize }} Used Size (bytes)