Update dependencies after protobuf update in hcsshim

Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
(cherry picked from commit d129b6f890bceb56b050bbb23ad330bb5699f78c)
Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
This commit is contained in:
Kirtana Ashok
2023-08-08 14:58:07 -07:00
parent e7e5619fed
commit a645ff2e68
7 changed files with 17 additions and 27 deletions

View File

@@ -303,13 +303,13 @@ func (c *criService) windowsContainerMetrics(
}
if wstats.Processor != nil {
cs.Cpu = &runtime.CpuUsage{
Timestamp: wstats.Timestamp.UnixNano(),
Timestamp: (protobuf.FromTimestamp(wstats.Timestamp)).UnixNano(),
UsageCoreNanoSeconds: &runtime.UInt64Value{Value: wstats.Processor.TotalRuntimeNS},
}
}
if wstats.Memory != nil {
cs.Memory = &runtime.MemoryUsage{
Timestamp: wstats.Timestamp.UnixNano(),
Timestamp: (protobuf.FromTimestamp(wstats.Timestamp)).UnixNano(),
WorkingSetBytes: &runtime.UInt64Value{
Value: wstats.Memory.MemoryUsagePrivateWorkingSetBytes,
},

View File

@@ -31,6 +31,7 @@ import (
containerstore "github.com/containerd/containerd/pkg/cri/store/container"
sandboxstore "github.com/containerd/containerd/pkg/cri/store/sandbox"
"github.com/containerd/containerd/pkg/cri/store/stats"
"github.com/containerd/containerd/protobuf"
"github.com/containerd/typeurl/v2"
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
)
@@ -282,14 +283,14 @@ func (c *criService) convertToCRIStats(stats *wstats.Statistics) (*runtime.Windo
}
if wstats.Processor != nil {
cs.Cpu = &runtime.WindowsCpuUsage{
Timestamp: wstats.Timestamp.UnixNano(),
Timestamp: (protobuf.FromTimestamp(wstats.Timestamp)).UnixNano(),
UsageCoreNanoSeconds: &runtime.UInt64Value{Value: wstats.Processor.TotalRuntimeNS},
}
}
if wstats.Memory != nil {
cs.Memory = &runtime.WindowsMemoryUsage{
Timestamp: wstats.Timestamp.UnixNano(),
Timestamp: (protobuf.FromTimestamp(wstats.Timestamp)).UnixNano(),
WorkingSetBytes: &runtime.UInt64Value{
Value: wstats.Memory.MemoryUsagePrivateWorkingSetBytes,
},

View File

@@ -24,6 +24,7 @@ import (
containerstore "github.com/containerd/containerd/pkg/cri/store/container"
sandboxstore "github.com/containerd/containerd/pkg/cri/store/sandbox"
"github.com/containerd/containerd/pkg/cri/store/stats"
"github.com/containerd/containerd/protobuf"
"github.com/stretchr/testify/assert"
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
)
@@ -384,7 +385,7 @@ func sandboxPod(id string, timestamp time.Time, cachedCPU uint64) sandboxstore.S
func windowsStat(timestamp time.Time, cpu uint64, memory uint64) *wstats.Statistics_Windows {
return &wstats.Statistics_Windows{
Windows: &wstats.WindowsContainerStatistics{
Timestamp: timestamp,
Timestamp: protobuf.ToTimestamp(timestamp),
Processor: &wstats.WindowsContainerProcessorStatistics{
TotalRuntimeNS: cpu,
},

View File

@@ -22,6 +22,7 @@ import (
wstats "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/stats"
"github.com/containerd/containerd/api/types"
"github.com/containerd/containerd/protobuf"
"github.com/containerd/typeurl/v2"
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
@@ -67,13 +68,13 @@ func (c *criService) containerMetrics(
}
if wstats.Processor != nil {
cs.Cpu = &runtime.CpuUsage{
Timestamp: wstats.Timestamp.UnixNano(),
Timestamp: (protobuf.FromTimestamp(wstats.Timestamp)).UnixNano(),
UsageCoreNanoSeconds: &runtime.UInt64Value{Value: wstats.Processor.TotalRuntimeNS},
}
}
if wstats.Memory != nil {
cs.Memory = &runtime.MemoryUsage{
Timestamp: wstats.Timestamp.UnixNano(),
Timestamp: (protobuf.FromTimestamp(wstats.Timestamp)).UnixNano(),
WorkingSetBytes: &runtime.UInt64Value{
Value: wstats.Memory.MemoryUsagePrivateWorkingSetBytes,
},

View File

@@ -31,6 +31,7 @@ import (
containerstore "github.com/containerd/containerd/pkg/cri/store/container"
sandboxstore "github.com/containerd/containerd/pkg/cri/store/sandbox"
"github.com/containerd/containerd/pkg/cri/store/stats"
"github.com/containerd/containerd/protobuf"
"github.com/containerd/typeurl/v2"
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
)
@@ -282,14 +283,14 @@ func (c *criService) convertToCRIStats(stats *wstats.Statistics) (*runtime.Windo
}
if wstats.Processor != nil {
cs.Cpu = &runtime.WindowsCpuUsage{
Timestamp: wstats.Timestamp.UnixNano(),
Timestamp: (protobuf.FromTimestamp(wstats.Timestamp)).UnixNano(),
UsageCoreNanoSeconds: &runtime.UInt64Value{Value: wstats.Processor.TotalRuntimeNS},
}
}
if wstats.Memory != nil {
cs.Memory = &runtime.WindowsMemoryUsage{
Timestamp: wstats.Timestamp.UnixNano(),
Timestamp: (protobuf.FromTimestamp(wstats.Timestamp)).UnixNano(),
WorkingSetBytes: &runtime.UInt64Value{
Value: wstats.Memory.MemoryUsagePrivateWorkingSetBytes,
},

View File

@@ -24,6 +24,7 @@ import (
containerstore "github.com/containerd/containerd/pkg/cri/store/container"
sandboxstore "github.com/containerd/containerd/pkg/cri/store/sandbox"
"github.com/containerd/containerd/pkg/cri/store/stats"
"github.com/containerd/containerd/protobuf"
"github.com/stretchr/testify/assert"
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
)
@@ -384,7 +385,7 @@ func sandboxPod(id string, timestamp time.Time, cachedCPU uint64) sandboxstore.S
func windowsStat(timestamp time.Time, cpu uint64, memory uint64) *wstats.Statistics_Windows {
return &wstats.Statistics_Windows{
Windows: &wstats.WindowsContainerStatistics{
Timestamp: timestamp,
Timestamp: protobuf.ToTimestamp(timestamp),
Processor: &wstats.WindowsContainerProcessorStatistics{
TotalRuntimeNS: cpu,
},