Safe Haskell | None |
---|---|
Language | Haskell2010 |
wrecker
is a library and executable for creating HTTP benchmarks. It is designed for
benchmarking a series of dependent requests.
wrecker
includes a wrapped version of the wreq
Session API,
mainly through Network.Wreq.Wrecker.
import Wrecker
to write clients and Wrecker
to run the
them with either defaultMain
or run
.
See https://github.com/lorenzo/wrecker#readme for more information.
- defaultMain :: [(String, Environment -> IO ())] -> IO ()
- run :: Options -> [(String, Environment -> IO ())] -> IO (HashMap String AllStats)
- runOne :: Options -> (Environment -> IO ()) -> IO AllStats
- data Environment = Environment {}
- data Recorder
- newtype LogicError = LogicError String
- record :: forall a. Recorder -> String -> IO a -> IO a
- data Options = Options {}
- data URLDisplay
- data RunType
- data DisplayMode
- defaultOptions :: Options
- data AllStats = AllStats {}
- data ResultStatistics = ResultStatistics {
- rs2xx :: !Statistics
- rs4xx :: !Statistics
- rs5xx :: !Statistics
- rsFailed :: !Statistics
- rsRollup :: !Statistics
- rsTotalTests :: !Int
- rsTestsFailed :: !Int
Entry Points
defaultMain :: [(String, Environment -> IO ())] -> IO () Source #
defaultMain
is typically the main entry point for wrecker
benchmarks.
defaultMain
will parse all command line arguments and then call run
with the correct Options
.
import Wrecker import Your.Performance.Scripts (landingPage, purchase) main :: IO () main = defaultMain [ ("loginReshare", loginReshare) , ("purchase" , purchase ) ]
To see the options defaultMain can parse call `--help`
$ wrecker-based-app --help wrecker - HTTP stress tester and benchmarker Usage: wreck [--concurrency ARG] [--bin-count ARG] ([--run-count ARG] | [--run-timed ARG]) [--timeout-time ARG] ([--non-interactive] | [--interactive]) [--log-level ARG] [--log-format ARG] [--match ARG] [--request-name-size ARG] [--output-path ARG] [--silent] ([--relative-url-display] | [--absolute-url-display]) [--record-query] [--list-test-groups] Welcome to wrecker Available options: -h,--help Show this help text --concurrency ARG Number of threads for concurrent requests --bin-count ARG Number of bins for latency histogram --run-count ARG number of times to repeat --run-timed ARG number of seconds to repeat --timeout-time ARG How long to wait for all requests to finish --log-level ARG Log to stderr events of criticality greater than the LOG_LEVEL --log-format ARG Log format to use --match ARG Only run tests that match the glob --request-name-size ARG Request name size for the terminal display --output-path ARG Save a JSON file of the the statistics to given path --silent Disable all output --record-query Take in consideration the query string for the report --list-test-groups Shows the list of tests to run and exit
Wrecker State
data Environment Source #
The Environment
holds state necessary to make and record HTTP calls.
Recorder
An opaque type for recording actions for profiling.
To obtain a Recorder
use either run
, defaultMain
, runOne
or
newStandaloneRecorder
.
record :: forall a. Recorder -> String -> IO a -> IO a Source #
record
is a low level function for collecting timing information.
Wrap each action of interest in a call to record.
record recorder $ threadDelay 1000000
record
measures the elapsed time of the call, and catches
HttpException
in the case of failure. This means failures
must be thrown if they are to be properly recorded.
Options
Options | |
|
data URLDisplay Source #
data DisplayMode Source #
DisplayMode
controls how results are displayed in the console. The
default is NonInterative
which returns the final results at the end of the
program. Interactive
will show partial results as the program updates.
defaultOptions :: Options Source #
defaultOptions
provides sensible default for the Options
types
AllStats has all of the ... stats. This type stores all of the information
wrecker
uses to display metrics to the user.
AllStats | |
|
data ResultStatistics Source #
This type includes statistics for all of the result values we can detect. This type is used by AllStats to compute per key (URL) statistics among other uses.
ResultStatistics | |
|