Struct goose::metrics::GooseMetrics [−][src]
pub struct GooseMetrics { pub hash: u64, pub started: Option<DateTime<Local>>, pub duration: usize, pub users: usize, pub requests: GooseRequestMetrics, pub tasks: GooseTaskMetrics, pub errors: BTreeMap<String, GooseErrorMetric>, pub final_metrics: bool, pub display_status_codes: bool, pub display_metrics: bool, }
Expand description
Metrics collected during a Goose load test.
Example
use goose::prelude::*; fn main() -> Result<(), GooseError> { let goose_metrics: GooseMetrics = GooseAttack::initialize()? .register_taskset(taskset!("ExampleUsers") .register_task(task!(example_task)) ) // 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()?; // 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); Ok(()) } async fn example_task(user: &GooseUser) -> GooseTaskResult { let _goose = user.get("/").await?; Ok(()) }
Fields
hash: u64
Expand description
A hash of the load test, useful to verify if different metrics are from the same load test.
started: Option<DateTime<Local>>
Expand description
The system timestamp of when the load test started.
duration: usize
Expand description
Total number of seconds the load test ran.
users: usize
Expand description
Total number of users simulated during this load test.
requests: GooseRequestMetrics
Expand description
Goose request metrics.
tasks: GooseTaskMetrics
Expand description
Goose task metrics.
errors: BTreeMap<String, GooseErrorMetric>
Expand description
Error-related metrics.
final_metrics: bool
Expand description
Flag indicating whether or not these are the final metrics. Because we’re deriving Default, this defaults to false.
display_status_codes: bool
Expand description
Flag indicating whether or not to display status_codes. Because we’re deriving Default, this defaults to false.
display_metrics: bool
Expand description
Flag indicating whether or not to display metrics, set to false on Workers. This defaults to false because we’re deriving Default.
Implementations
impl GooseMetrics
[src]
impl GooseMetrics
[src]pub fn initialize_task_metrics(
&mut self,
task_sets: &[GooseTaskSet],
config: &GooseConfiguration
)
[src]
pub fn initialize_task_metrics(
&mut self,
task_sets: &[GooseTaskSet],
config: &GooseConfiguration
)
[src]Initialize the task_metrics vector.
pub fn print(&self)
[src]
pub fn print(&self)
[src]Consumes and display all metrics from a completed load test.
Example
use goose::prelude::*; fn main() -> Result<(), GooseError> { GooseAttack::initialize()? .register_taskset(taskset!("ExampleUsers") .register_task(task!(example_task)) ) // 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()? .print(); Ok(()) } async fn example_task(user: &GooseUser) -> GooseTaskResult { let _goose = user.get("/").await?; Ok(()) }
pub fn print_running(&self)
[src]
pub fn print_running(&self)
[src]Consumes and displays metrics from a running load test.
pub fn fmt_requests(&self, fmt: &mut Formatter<'_>) -> Result
[src]
pub fn fmt_requests(&self, fmt: &mut Formatter<'_>) -> Result
[src]Optionally prepares a table of requests and fails.
pub fn fmt_tasks(&self, fmt: &mut Formatter<'_>) -> Result
[src]
pub fn fmt_tasks(&self, fmt: &mut Formatter<'_>) -> Result
[src]Optionally prepares a table of tasks.
pub fn fmt_task_times(&self, fmt: &mut Formatter<'_>) -> Result
[src]
pub fn fmt_task_times(&self, fmt: &mut Formatter<'_>) -> Result
[src]Optionally prepares a table of task times.
pub fn fmt_response_times(&self, fmt: &mut Formatter<'_>) -> Result
[src]
pub fn fmt_response_times(&self, fmt: &mut Formatter<'_>) -> Result
[src]Optionally prepares a table of response times.
pub fn fmt_percentiles(&self, fmt: &mut Formatter<'_>) -> Result
[src]
pub fn fmt_percentiles(&self, fmt: &mut Formatter<'_>) -> Result
[src]Optionally prepares a table of slowest response times within several percentiles.
pub fn fmt_status_codes(&self, fmt: &mut Formatter<'_>) -> Result
[src]
pub fn fmt_status_codes(&self, fmt: &mut Formatter<'_>) -> Result
[src]Optionally prepares a table of response status codes.
pub fn fmt_errors(&self, fmt: &mut Formatter<'_>) -> Result
[src]
pub fn fmt_errors(&self, fmt: &mut Formatter<'_>) -> Result
[src]Optionally prepares a table of errors.
Trait Implementations
impl Clone for GooseMetrics
[src]
impl Clone for GooseMetrics
[src]fn clone(&self) -> GooseMetrics
[src]
fn clone(&self) -> GooseMetrics
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for GooseMetrics
[src]
impl Debug for GooseMetrics
[src]impl Default for GooseMetrics
[src]
impl Default for GooseMetrics
[src]fn default() -> GooseMetrics
[src]
fn default() -> GooseMetrics
[src]Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for GooseMetrics
impl Send for GooseMetrics
impl Sync for GooseMetrics
impl Unpin for GooseMetrics
impl UnwindSafe for GooseMetrics
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,