Browse Source

Add new Allocation fields to opencost_codecs so that they are correctly
marshalled/unmarshalled to/from bytes.

Signed-off-by: thomasvn <thomasnguyen96@gmail.com>

thomasvn 2 năm trước cách đây
mục cha
commit
975a26f3cc
1 tập tin đã thay đổi với 8 bổ sung0 xóa
  1. 8 0
      core/pkg/opencost/opencost_codecs.go

+ 8 - 0
core/pkg/opencost/opencost_codecs.go

@@ -352,6 +352,8 @@ func (target *Allocation) MarshalBinaryWithContext(ctx *EncodingContext) (err er
 	buff.WriteFloat64(target.CPUCost)                    // write float64
 	buff.WriteFloat64(target.CPUCostAdjustment)          // write float64
 	buff.WriteFloat64(target.GPUHours)                   // write float64
+	buff.WriteFloat64(target.GPURequestAverage)          // write float64
+	buff.WriteFloat64(target.GPUUsageAverage)            // write float64
 	buff.WriteFloat64(target.GPUCost)                    // write float64
 	buff.WriteFloat64(target.GPUCostAdjustment)          // write float64
 	buff.WriteFloat64(target.NetworkTransferBytes)       // write float64
@@ -588,6 +590,12 @@ func (target *Allocation) UnmarshalBinaryWithContext(ctx *DecodingContext) (err
 	s := buff.ReadFloat64() // read float64
 	target.GPUHours = s
 
+	s1 := buff.ReadFloat64() // read float64
+	target.GPURequestAverage = s1
+
+	s2 := buff.ReadFloat64() // read float64
+	target.GPUUsageAverage = s2
+
 	t := buff.ReadFloat64() // read float64
 	target.GPUCost = t