[][src]Struct goose::metrics::GooseMetrics

pub struct GooseMetrics {
    pub hash: u64,
    pub duration: usize,
    pub users: usize,
    pub requests: GooseRequestMetrics,
    pub tasks: GooseTaskMetrics,
    pub display_percentile: bool,
    pub display_status_codes: bool,
    pub display_metrics: bool,
}

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))
        )
        .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

A hash of the load test, useful to verify if different metrics are from the same load test.

duration: usize

How many seconds the load test ran.

users: usize

Total number of users simulated during this load test.

requests: GooseRequestMetrics

Goose request metrics.

tasks: GooseTaskMetrics

Goose task metrics.

display_percentile: bool

Flag indicating whether or not to display percentile. Because we're deriving Default, this defaults to false.

display_status_codes: bool

Flag indicating whether or not to display status_codes. Because we're deriving Default, this defaults to false.

display_metrics: bool

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]

pub fn initialize_task_metrics(
    &mut self,
    task_sets: &[GooseTaskSet],
    config: &GooseConfiguration
)
[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))
        )
        .execute()?
        .print();

    Ok(())
}

async fn example_task(user: &GooseUser) -> GooseTaskResult {
    let _goose = user.get("/").await?;

    Ok(())
}

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]

Optionally prepares a table of requests and fails.

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_response_times(&self, fmt: &mut Formatter<'_>) -> Result[src]

pub fn fmt_percentiles(&self, fmt: &mut Formatter<'_>) -> Result[src]

pub fn fmt_status_codes(&self, fmt: &mut Formatter<'_>) -> Result[src]

Trait Implementations

impl Clone for GooseMetrics[src]

impl Debug for GooseMetrics[src]

impl Default for GooseMetrics[src]

impl Display for GooseMetrics[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,