Skip to content

Commit

Permalink
feat(pool_iostat): adding protobuf for pool
Browse files Browse the repository at this point in the history
Signed-off-by: Abhilash Shetty <[email protected]>
  • Loading branch information
abhilashshetty04 committed Dec 8, 2023
1 parent 2c0e0c1 commit 5459937
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
1 change: 1 addition & 0 deletions apis/io-engine/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ fn main() {
"protobuf/v1/nexus.proto",
"protobuf/v1/registration.proto",
"protobuf/v1/snapshot.proto",
"protobuf/v1/stats.proto",
"protobuf/v1/test.proto",
],
&["protobuf/v1"],
Expand Down
16 changes: 16 additions & 0 deletions apis/io-engine/protobuf/v1/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,19 @@ enum ShareProtocol {
NVMF = 1; // NVMe over Fabrics (TCP)
ISCSI = 2; // iSCSI
}

// Common IO stats struct for all resource types.
message IoStats {
string name = 1; // Name of the device/resource.
uint64 num_read_ops = 2; // Number of read operations on the device.
uint64 bytes_read = 3; // Total bytes read on the device.
uint64 num_write_ops = 4; // Number of write operations on the device.
uint64 bytes_written = 5; // Total bytes written on the device.
uint64 read_latency_ticks = 6; // Total read latency on the device in ticks.
uint64 write_latency_ticks = 7; // Total write latency on the device in ticks.
uint64 max_read_latency_ticks = 9; // Max read latency in ticks occurred over num_read_ops.
uint64 min_read_latency_ticks = 10; // Min read latency in ticks occurred over num_read_ops.
uint64 max_write_latency_ticks = 11; // Max write latency in ticks occurred over num_write_ops.
uint64 min_write_latency_ticks = 12; // Min write latency in ticks occurred over num_write_ops.
uint64 ticks_rate = 13; // Tick rate specific to node hosting the device.
}
22 changes: 22 additions & 0 deletions apis/io-engine/protobuf/v1/stats.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// gRPC protobuf for IOStats
syntax = "proto3";
import "common.proto";
import "google/protobuf/empty.proto";

package mayastor.v1;

// Interface for IO stats APIs.
service StatsRpc {
// RPC to get Pool IO stats.
rpc GetPoolIoStats (ListStatsOption) returns (PoolIoStatsResponse);
// RPC to reset Io Stats for all Pool, Replica and Nexus hosted on the node.
rpc ResetIoStats (google.protobuf.Empty) returns (google.protobuf.Empty);
}

message ListStatsOption {
optional string name = 1; // If specified, Returns IO stats of only specified resource.
}

message PoolIoStatsResponse {
repeated IoStats stats = 1;
}
10 changes: 9 additions & 1 deletion apis/io-engine/src/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mod pb {
}

pub mod common {
pub use super::pb::ShareProtocol;
pub use super::pb::{IoStats, ShareProtocol};
}

/// v1 version of bdev grpc API
Expand Down Expand Up @@ -105,6 +105,14 @@ pub mod nexus {
};
}

pub mod stats {
pub use super::pb::{
stats_rpc_client::StatsRpcClient,
stats_rpc_server::{StatsRpc, StatsRpcServer},
ListStatsOption, PoolIoStatsResponse,
};
}

pub mod test {
pub use super::pb::{
test_rpc_client::TestRpcClient,
Expand Down

0 comments on commit 5459937

Please sign in to comment.