Sandbox: Add Metrics rpc for controller
As a follow up change to adding a SandboxMetrics rpc to the core sandbox service, the controller needed a corresponding rpc for CRI and others to eventually implement. This leaves the CRI (non-shim mode) controller unimplemented just to have a change with the API addition to start. Signed-off-by: Danny Canter <danny@dcantah.dev>
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
||||
"context"
|
||||
|
||||
api "github.com/containerd/containerd/api/services/sandbox/v1"
|
||||
"github.com/containerd/containerd/api/types"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/platforms"
|
||||
"github.com/containerd/containerd/sandbox"
|
||||
@@ -140,3 +141,11 @@ func (s *remoteSandboxController) Status(ctx context.Context, sandboxID string,
|
||||
Extra: resp.GetExtra(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *remoteSandboxController) Metrics(ctx context.Context, sandboxID string) (*types.Metric, error) {
|
||||
resp, err := s.client.Metrics(ctx, &api.ControllerMetricsRequest{SandboxID: sandboxID})
|
||||
if err != nil {
|
||||
return nil, errdefs.FromGRPC(err)
|
||||
}
|
||||
return resp.Metrics, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user