Sandbox: Add SandboxMetrics rpc

To gather metrics/stats about a specific sandbox instance, it'd be nice to
have a dedicated rpc for this. Due to the same "what kind of stats are going
to be returned" dilemma exists for sandboxes as well, I've re-used the metrics
type we have as the data field is just an `any`, leaving the metrics returned
entirely up to the shim author. For CRI usecases this will just be cgroup and
windows stats as that's all that's supported right now.

Signed-off-by: Danny Canter <danny@dcantah.dev>
This commit is contained in:
Danny Canter
2023-06-12 03:30:48 -07:00
parent dd5e9f6538
commit d56722ef2a
7 changed files with 440 additions and 192 deletions

View File

@@ -91,6 +91,7 @@ func (p *pauseService) StopSandbox(ctx context.Context, req *api.StopSandboxRequ
}
func (p *pauseService) WaitSandbox(ctx context.Context, req *api.WaitSandboxRequest) (*api.WaitSandboxResponse, error) {
log.G(ctx).Debugf("wait sandbox request: %+v", req)
return &api.WaitSandboxResponse{
ExitStatus: 0,
}, nil
@@ -105,6 +106,12 @@ func (p *pauseService) PingSandbox(ctx context.Context, req *api.PingRequest) (*
return &api.PingResponse{}, nil
}
func (p *pauseService) ShutdownSandbox(ctx context.Context, request *api.ShutdownSandboxRequest) (*api.ShutdownSandboxResponse, error) {
func (p *pauseService) ShutdownSandbox(ctx context.Context, req *api.ShutdownSandboxRequest) (*api.ShutdownSandboxResponse, error) {
log.G(ctx).Debugf("shutdown sandbox request: %+v", req)
return &api.ShutdownSandboxResponse{}, nil
}
func (p *pauseService) SandboxMetrics(ctx context.Context, req *api.SandboxMetricsRequest) (*api.SandboxMetricsResponse, error) {
log.G(ctx).Debugf("sandbox metrics request: %+v", req)
return &api.SandboxMetricsResponse{}, nil
}