Skip to content

Commit

Permalink
Sandbox: Add SandboxMetrics rpc
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
dcantah committed Jun 12, 2023
1 parent dd5e9f6 commit d56722e
Show file tree
Hide file tree
Showing 7 changed files with 440 additions and 192 deletions.
99 changes: 63 additions & 36 deletions api/next.pb.txt
Original file line number Diff line number Diff line change
Expand Up @@ -884,13 +884,50 @@ file {
}
syntax: "proto3"
}
file {
name: "github.com/containerd/containerd/api/types/metrics.proto"
package: "containerd.types"
dependency: "google/protobuf/any.proto"
dependency: "google/protobuf/timestamp.proto"
message_type {
name: "Metric"
field {
name: "timestamp"
number: 1
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".google.protobuf.Timestamp"
json_name: "timestamp"
}
field {
name: "id"
number: 2
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "id"
}
field {
name: "data"
number: 3
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".google.protobuf.Any"
json_name: "data"
}
}
options {
go_package: "github.com/containerd/containerd/api/types;types"
}
syntax: "proto3"
}
file {
name: "github.com/containerd/containerd/api/runtime/sandbox/v1/sandbox.proto"
package: "containerd.runtime.sandbox.v1"
dependency: "google/protobuf/any.proto"
dependency: "google/protobuf/timestamp.proto"
dependency: "github.com/containerd/containerd/api/types/mount.proto"
dependency: "github.com/containerd/containerd/api/types/platform.proto"
dependency: "github.com/containerd/containerd/api/types/metrics.proto"
message_type {
name: "CreateSandboxRequest"
field {
Expand Down Expand Up @@ -1199,6 +1236,27 @@ file {
message_type {
name: "ShutdownSandboxResponse"
}
message_type {
name: "SandboxMetricsRequest"
field {
name: "sandbox_id"
number: 1
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "sandboxId"
}
}
message_type {
name: "SandboxMetricsResponse"
field {
name: "metrics"
number: 1
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".containerd.types.Metric"
json_name: "metrics"
}
}
service {
name: "Sandbox"
method {
Expand Down Expand Up @@ -1241,6 +1299,11 @@ file {
input_type: ".containerd.runtime.sandbox.v1.ShutdownSandboxRequest"
output_type: ".containerd.runtime.sandbox.v1.ShutdownSandboxResponse"
}
method {
name: "SandboxMetrics"
input_type: ".containerd.runtime.sandbox.v1.SandboxMetricsRequest"
output_type: ".containerd.runtime.sandbox.v1.SandboxMetricsResponse"
}
}
options {
go_package: "github.com/containerd/containerd/api/runtime/sandbox/v1;sandbox"
Expand Down Expand Up @@ -5944,42 +6007,6 @@ file {
}
syntax: "proto3"
}
file {
name: "github.com/containerd/containerd/api/types/metrics.proto"
package: "containerd.types"
dependency: "google/protobuf/any.proto"
dependency: "google/protobuf/timestamp.proto"
message_type {
name: "Metric"
field {
name: "timestamp"
number: 1
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".google.protobuf.Timestamp"
json_name: "timestamp"
}
field {
name: "id"
number: 2
label: LABEL_OPTIONAL
type: TYPE_STRING
json_name: "id"
}
field {
name: "data"
number: 3
label: LABEL_OPTIONAL
type: TYPE_MESSAGE
type_name: ".google.protobuf.Any"
json_name: "data"
}
}
options {
go_package: "github.com/containerd/containerd/api/types;types"
}
syntax: "proto3"
}
file {
name: "github.com/containerd/containerd/api/services/tasks/v1/tasks.proto"
package: "containerd.services.tasks.v1"
Expand Down
Loading

0 comments on commit d56722e

Please sign in to comment.