Skip to content

Commit

Permalink
Add Windows statistics protobuf pacakge
Browse files Browse the repository at this point in the history
Signed-off-by: James Sturtevant <[email protected]>
  • Loading branch information
jsturtevant committed Aug 21, 2023
1 parent a80d2df commit 8fde77f
Show file tree
Hide file tree
Showing 6 changed files with 259 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/shim-protos/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ fn main() {
false,
);

genmodule(
"stats",
&["vendor/microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/stats/stats.proto"],
false,
);

genmodule(
"events",
&[
Expand Down
1 change: 1 addition & 0 deletions crates/shim-protos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ pub mod events;
mod sandbox;
pub mod shim;
pub mod types;
pub mod windows;

/// Includes event names shims can publish to containerd.
pub mod topics;
Expand Down
23 changes: 23 additions & 0 deletions crates/shim-protos/src/windows.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

pub mod stats {
include!(concat!(env!("OUT_DIR"), "/stats/stats.rs"));
}

pub mod metrics {
pub use crate::cgroups::metrics::{file_descriptor, Metrics};
}
2 changes: 2 additions & 0 deletions crates/shim-protos/vendor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ Proto files are copy-pasted directly from upstream repos:
+ https://github.com/containerd/containerd
+ https://github.com/protocolbuffers/protobuf
+ https://github.com/gogo/protobuf
+ https://github.com/containerd/cgroups
+ https://github.com/microsoft/hcsshim

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
syntax = "proto3";

package containerd.runhcs.stats.v1;

import "google/protobuf/timestamp.proto";
import "github.com/containerd/cgroups/v3/cgroup1/stats/metrics.proto";

option go_package = "github.com/Microsoft/hcsshim/cmd/containerd-shim-runhcs-v1/stats;stats";

message Statistics {
oneof container {
WindowsContainerStatistics windows = 1;
io.containerd.cgroups.v1.Metrics linux = 2;
}
VirtualMachineStatistics vm = 3;
}

message WindowsContainerStatistics {
google.protobuf.Timestamp timestamp = 1;
google.protobuf.Timestamp container_start_time = 2;
uint64 uptime_ns = 3;
WindowsContainerProcessorStatistics processor = 4;
WindowsContainerMemoryStatistics memory = 5;
WindowsContainerStorageStatistics storage = 6;
}

message WindowsContainerProcessorStatistics {
uint64 total_runtime_ns = 1;
uint64 runtime_user_ns = 2;
uint64 runtime_kernel_ns = 3;
}

message WindowsContainerMemoryStatistics {
uint64 memory_usage_commit_bytes = 1;
uint64 memory_usage_commit_peak_bytes = 2;
uint64 memory_usage_private_working_set_bytes = 3;
}

message WindowsContainerStorageStatistics {
uint64 read_count_normalized = 1;
uint64 read_size_bytes = 2;
uint64 write_count_normalized = 3;
uint64 write_size_bytes = 4;
}

message VirtualMachineStatistics {
VirtualMachineProcessorStatistics processor = 1;
VirtualMachineMemoryStatistics memory = 2;
}

message VirtualMachineProcessorStatistics {
uint64 total_runtime_ns = 1;
}

message VirtualMachineMemoryStatistics {
uint64 working_set_bytes = 1;
uint32 virtual_node_count = 2;
VirtualMachineMemory vm_memory = 3;
}

message VirtualMachineMemory {
int32 available_memory = 1;
int32 available_memory_buffer = 2;
uint64 reserved_memory = 3;
uint64 assigned_memory = 4;
bool slp_active = 5;
bool balancing_enabled = 6;
bool dm_operation_in_progress = 7;
}

0 comments on commit 8fde77f

Please sign in to comment.