pub struct GooseMetrics {
pub hash: u64,
pub history: Vec<TestPlanHistory>,
pub duration: usize,
pub maximum_users: usize,
pub total_users: usize,
pub requests: GooseRequestMetrics,
pub transactions: TransactionMetrics,
pub scenarios: ScenarioMetrics,
pub errors: GooseErrorMetrics,
pub hosts: HashSet<String>,
pub coordinated_omission_metrics: Option<CoordinatedOmissionMetrics>,
/* private fields */
}Expand description
All metrics optionally collected during a Goose load test.
By default, Goose collects metrics during a load test in a GooseMetrics object
that is returned by
GooseAttack::execute() when a load
test finishes.
§Example
use goose::prelude::*;
#[tokio::main]
async fn main() -> Result<(), GooseError> {
let goose_metrics: GooseMetrics = GooseAttack::initialize()?
.register_scenario(scenario!("ExampleUsers")
.register_transaction(transaction!(example_transaction))
)
// Set a default host so the load test will start.
.set_default(GooseDefault::Host, "http://localhost/")?
// Set a default run time so this test runs to completion.
.set_default(GooseDefault::RunTime, 1)?
.execute()
.await?;
// It is now possible to do something with the metrics collected by Goose.
// For now, we'll just pretty-print the entire object.
println!("{:#?}", goose_metrics);
/**
// For example:
$ cargo run -- -H http://example.com -u1 -t1
GooseMetrics {
hash: 0,
started: Some(
2021-06-15T09:32:49.888147+02:00,
),
duration: 1,
users: 1,
requests: {
"GET /": GooseRequestMetricAggregate {
path: "/",
method: Get,
response_times: {
3: 14,
4: 163,
5: 36,
6: 8,
},
min_response_time: 3,
max_response_time: 6,
total_response_time: 922,
response_time_counter: 221,
status_code_counts: {},
success_count: 0,
fail_count: 221,
load_test_hash: 0,
},
},
transactions: [
[
TransactionMetricAggregate {
scenario_index: 0,
scenario_name: "ExampleUsers",
transaction_index: 0,
transaction_name: "",
times: {
3: 14,
4: 161,
5: 38,
6: 8,
},
min_time: 3,
max_time: 6,
total_time: 924,
counter: 221,
success_count: 221,
fail_count: 0,
},
],
],
errors: {
"503 Service Unavailable: /.GET./": GooseErrorMetric {
method: Get,
name: "/",
error: "503 Service Unavailable: /",
occurrences: 221,
},
},
final_metrics: true,
display_status_codes: false,
display_metrics: true,
}
**/
Ok(())
}
async fn example_transaction(user: &mut GooseUser) -> TransactionResult {
let _goose = user.get("/").await?;
Ok(())
}Fields§
§hash: u64A hash of the load test, primarily used to validate all Workers in a Gaggle are running the same load test.
history: Vec<TestPlanHistory>A vector recording the history of each load test step.
duration: usizeTotal number of seconds the load test ran.
maximum_users: usizeMaximum number of users simulated during this load test.
This value may be smaller than what was configured at start time if the test didn’t run long enough for all configured users to start.
total_users: usizeTotal number of users simulated during this load test.
requests: GooseRequestMetricsTracks details about each request made during the load test.
Can be disabled with the --no-metrics run-time option, or with
GooseDefault::NoMetrics.
transactions: TransactionMetricsTransactions details about each transaction that is invoked during the load test.
Can be disabled with either the --no-transaction-metrics or --no-metrics run-time options,
or with either the
GooseDefault::NoTransactionMetrics or
GooseDefault::NoMetrics.
scenarios: ScenarioMetricsTransactions details about each scenario that is invoked during the load test.
Can be disabled with either the --no-scenario-metrics or --no-metrics run-time options,
or with either the
GooseDefault::NoTransactionMetrics or
GooseDefault::NoMetrics.
errors: GooseErrorMetricsTracks and counts each time an error is detected during the load test.
Can be disabled with either the --no-error-summary or --no-metrics run-time options,
or with either the
GooseDefault::NoErrorSummary or
GooseDefault::NoMetrics.
hosts: HashSet<String>Tracks all hosts that the load test is run against.
coordinated_omission_metrics: Option<CoordinatedOmissionMetrics>Enhanced Coordinated Omission metrics tracking.
Tracks CO events, synthetic vs actual requests, and provides detailed analysis of coordinated omission impact on the load test.
Trait Implementations§
Source§impl Clone for GooseMetrics
impl Clone for GooseMetrics
Source§fn clone(&self) -> GooseMetrics
fn clone(&self) -> GooseMetrics
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GooseMetrics
impl Debug for GooseMetrics
Source§impl Default for GooseMetrics
impl Default for GooseMetrics
Source§fn default() -> GooseMetrics
fn default() -> GooseMetrics
Source§impl Display for GooseMetrics
Implement format trait to allow displaying metrics.
impl Display for GooseMetrics
Implement format trait to allow displaying metrics.
Auto Trait Implementations§
impl Freeze for GooseMetrics
impl RefUnwindSafe for GooseMetrics
impl Send for GooseMetrics
impl Sync for GooseMetrics
impl Unpin for GooseMetrics
impl UnwindSafe for GooseMetrics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.