Blackfire Player natively integrates Blackfire profiler.
To use Blackfire Player with Blackfire profiler, add --blackfire-env
option to
your blackfire-player
command. You may use either the environment name or its UUID:
1
blackfire-player run scenario.bkf --blackfire-env="Environment name or UUID"
To use Blackfire Player together with Blackfire Profiler, you need to correctly setup your client credentials, which are available at https://blackfire.io/my/settings/credentials
The Blackfire Player documentation provides complete information on its configuration.
Or, using a fully configured alias:
The Blackfire Player creates a build to group all the scenarios. Each scenario contains profiles and assertion reports for requests made in each step of the executed scenario.
All requests are profiled by default. You can disable the profiler in a
step or in a complete scenario by setting blackfire false
.
1 2 3 4 5 6 7 8 9 10 11
scenario
name "Scenario with Blackfire"
# Use the environment name (or UUID) you're targeting or false to disable
blackfire true
# ...
scenario
name "Scenario without Blackfire"
# You can disable Blackfire support on the scenario, or only on some steps
blackfire false
# ...
All the assertions defined in .blackfire.yaml
are automatically run
alongside Blackfire Player expectations.
You also may add assertions within a step with assert
instruction:
1 2 3 4
scenario
visit url('/blog/')
name "Blog homepage"
assert main.peak_memory < 10M
Any assertion supported in .blackfire.yaml, based on built-in and/or custom metrics, can be added this way.
You can use assertions variables, defined in the Blackfire environment, like you would do within assertions defined in .blackfire.yaml file:
1 2 3 4 5 6
scenario
# no Twig template compilation in production
# not enforced in other environments
visit url('/blog/')
name "Blog homepage"
assert main.peak_memory < 10mb * var('memory_coeff')
To make some comparisons with a previous build, you can set the external_id
and
external_parent_id
settings of the build by passing
BLACKFIRE_EXTERNAL_ID
and BLACKFIRE_EXTERNAL_PARENT_ID
environment
variables:
1 2 3
BLACKFIRE_EXTERNAL_ID=current_build_reference \
BLACKFIRE_EXTERNAL_PARENT_ID=parent_build_reference \
blackfire-player run scenario.bkf --blackfire-env=ENV_NAME_OR_UUID
The warmup
instruction tells Blackfire Profiler whether to warmup the
requested URL first.
Its value can be:
1 2 3 4 5
scenario
visit url('/blog/')
name "Blog homepage"
assert main.peak_memory < 10M
warmup true