Use typealias for containerd metrics
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
437123646a
commit
c8c7c54a6e
@ -19,8 +19,8 @@ limitations under the License.
|
|||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/containerd/cgroups"
|
|
||||||
"github.com/containerd/containerd/api/types"
|
"github.com/containerd/containerd/api/types"
|
||||||
|
v1 "github.com/containerd/containerd/metrics/types/v1"
|
||||||
"github.com/containerd/typeurl"
|
"github.com/containerd/typeurl"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
|
runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
|
||||||
@ -61,7 +61,7 @@ func (c *criService) containerMetrics(
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "failed to extract container metrics")
|
return nil, errors.Wrap(err, "failed to extract container metrics")
|
||||||
}
|
}
|
||||||
metrics := s.(*cgroups.Metrics)
|
metrics := s.(*v1.Metrics)
|
||||||
if metrics.CPU != nil && metrics.CPU.Usage != nil {
|
if metrics.CPU != nil && metrics.CPU.Usage != nil {
|
||||||
cs.Cpu = &runtime.CpuUsage{
|
cs.Cpu = &runtime.CpuUsage{
|
||||||
Timestamp: stats.Timestamp.UnixNano(),
|
Timestamp: stats.Timestamp.UnixNano(),
|
||||||
@ -84,7 +84,7 @@ func (c *criService) containerMetrics(
|
|||||||
// getWorkingSet calculates workingset memory from cgroup memory stats.
|
// getWorkingSet calculates workingset memory from cgroup memory stats.
|
||||||
// The caller should make sure memory is not nil.
|
// The caller should make sure memory is not nil.
|
||||||
// workingset = usage - total_inactive_file
|
// workingset = usage - total_inactive_file
|
||||||
func getWorkingSet(memory *cgroups.MemoryStat) uint64 {
|
func getWorkingSet(memory *v1.MemoryStat) uint64 {
|
||||||
if memory.Usage == nil {
|
if memory.Usage == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
13
vendor/github.com/containerd/cgroups/go.mod
generated
vendored
13
vendor/github.com/containerd/cgroups/go.mod
generated
vendored
@ -1,13 +0,0 @@
|
|||||||
module github.com/containerd/cgroups
|
|
||||||
|
|
||||||
go 1.12
|
|
||||||
|
|
||||||
require (
|
|
||||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e
|
|
||||||
github.com/docker/go-units v0.4.0
|
|
||||||
github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e
|
|
||||||
github.com/gogo/protobuf v1.2.1
|
|
||||||
github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700
|
|
||||||
github.com/pkg/errors v0.8.1
|
|
||||||
golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f
|
|
||||||
)
|
|
Loading…
Reference in New Issue
Block a user