forked from iopsystems/rpc-perf
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
output: move output structures to a crate
rpc-perf periodically takes a snapshot of its observed performance metrics and outputs them into JSON. Move the structures comprising this JSON into the rpcperf-dataspec crate so that external consumers can parse rpc-perf's output by importing the crate from lib/dataspec.
- Loading branch information
Showing
6 changed files
with
224 additions
and
83 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[package] | ||
name = "rpcperf-dataspec" | ||
version = "0.1.0" | ||
authors = { workspace = true } | ||
edition = { workspace = true } | ||
homepage = { workspace = true } | ||
repository = { workspace = true } | ||
license = { workspace = true } | ||
|
||
[dependencies] | ||
histogram = { workspace = true } | ||
serde = { workspace = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
//! Format of JSON output from rpc-perf. These structures can be used | ||
//! by any consumer of the produced data to parse the files. | ||
|
||
use serde::{Deserialize, Serialize}; | ||
|
||
use histogram::CompactHistogram; | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct Connections { | ||
/// number of current connections (gauge) | ||
pub current: i64, | ||
/// number of total connect attempts | ||
pub total: u64, | ||
/// number of connections established | ||
pub opened: u64, | ||
/// number of connect attempts that failed | ||
pub error: u64, | ||
/// number of connect attempts that hit timeout | ||
pub timeout: u64, | ||
} | ||
|
||
#[derive(Copy, Clone, Serialize, Deserialize)] | ||
pub struct Requests { | ||
pub total: u64, | ||
pub ok: u64, | ||
pub reconnect: u64, | ||
pub unsupported: u64, | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct Responses { | ||
/// total number of responses | ||
pub total: u64, | ||
/// number of responses that were successful | ||
pub ok: u64, | ||
/// number of responses that were unsuccessful | ||
pub error: u64, | ||
/// number of responses that were missed due to timeout | ||
pub timeout: u64, | ||
/// number of read requests with a hit response | ||
pub hit: u64, | ||
/// number of read requests with a miss response | ||
pub miss: u64, | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct ClientStats { | ||
pub connections: Connections, | ||
pub requests: Requests, | ||
pub responses: Responses, | ||
pub request_latency: CompactHistogram, | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct PubsubStats { | ||
pub publishers: Publishers, | ||
pub subscribers: Subscribers, | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct Publishers { | ||
// current number of publishers | ||
pub current: i64, | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct Subscribers { | ||
// current number of subscribers | ||
pub current: i64, | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct JsonSnapshot { | ||
pub window: u64, | ||
pub elapsed: f64, | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub target_qps: Option<f64>, | ||
pub client: ClientStats, | ||
pub pubsub: PubsubStats, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters