API Documentation

class charmbenchmark.Benchmark(benchmarks=None)

Helper class for the benchmark interface.

Parameters:actions (list) – Define the actions that are also benchmarks

Examples:

Notify the Benchmark GUI of the actions that are benchmark-enabled, usually run from benchmark-relation-[joined|changed]:

Benchmark(['memory', 'cpu', 'disk', 'smoke', 'custom'])

From within a benchmark-enabled action:

# Begins timing of a benchmark
Benchmark.start()

[... run benchmark and parse results ...]

Benchmark.set_data({'results.transactions.value': 1096})
Benchmark.set_data({'results.transactions.units': 'hits'})

# Store a meta key, available via ``juju action fetch`` but not shown
# in the Benchmark GUI
Benchmark.set_meta('myuuid', '1b231f32-16c3-11e5-ac89-14109fd63717')

# The higher the score, the better the benchmark
Benchmark.set_composite_score(16.70, 'hits/sec', 'desc')

# Finish the timing of a benchmark
Benchmark.finish()
static finish()
required_keys = ['hostname', 'port', 'graphite_port', 'graphite_endpoint', 'api_port']
static set_composite_score(value, units='', direction=None)

Set the composite score for a benchmark run. This is a single number representative of the benchmark results. This could be the most important metric, or an amalgamation of metric scores.

static set_data(value)

Set the key:value to be passed to action_set

Parameters:value (list) – A hash containing the key and value
static set_meta(key, value)
static start()

If the cabs-collector charm is installed, take a snapshot of the current profile data.