You can also write scenarios manually via PHPunit for libraries or CLI commands and automatically benefit from the builds and notification channels of your continuous integration platform. Note that createRequest() received a Configuration tied to the scenario. You can write your HTTP scenarios by using the following integrations: Blackfire Player The PHP SDK Goutte Guzzle. Distributed Profiling allows you to trigger sub-profiles automatically, without having to trigger profiles. Integrating Blackfire with Symfony HttpClient lets you profile programmatically your websites, HTTP APIs, or web services. Installing the Agent Enabling the PHP Probe ¶ To be able to use Blackfire, add the probe to your Docker PHP image. apt-get install blackfire-agent blackfire-php -y. Symfony HttpClient is a PHP HTTP client that sends HTTP requests and integrates well with web services. docker: - image: circleci/php:7.3-node steps: - checkout - blackfire-agent/setup. Install the blackfire-agent package and install the PHP Probe. Sets the client ID and client Token used to authenticate with Blackfire. You can use the following environment variables: BLACKFIRECLIENTID / BLACKFIRECLIENTTOKEN. It allows you to change the configuration without modifying your code. Use Goutte\Client as GoutteClient use Blackfire\Client as BlackfireClient $client = new GoutteClient () $blackfire = new BlackfireClient () // create a build $build = $blackfire -> startBuild ( 'Symfony Prod', array ( 'title' => 'Build from Goutte' )) // create a scenario $scenario = $blackfire -> startScenario ( $build, array ( 'title' => 'My first scenario' )) // create a configuration $config = new \Blackfire\Profile\Configuration () $config -> setScenario ( $scenario ) // set the Profile and Job name $config -> setTitle ( 'Blog Home' ) // make a profiled request $profileRequest = $blackfire -> createRequest ( $config ) $client -> setHeader ( 'X-Blackfire-Query', $profileRequest -> getToken ()) $crawler = $client -> request ( 'GET', '' ) // get the profile for the request $profile = $blackfire -> getProfile ( $profileRequest -> getUuid ()) // click on a link, generate another profile in the build $link = $crawler -> selectLink ( 'Security Advisories' ) -> link () $config -> setTitle ( 'Security Advisories' ) $client -> setHeader ( 'X-Blackfire-Query', $blackfire -> createRequest ( $config ) -> getToken ()) $crawler = $client -> click ( $link ) // end the scenario and fetch the report // the scenario contains two profiles $report = $blackfire -> closeScenario ( $scenario ) // end the build $blackfire -> closeBuild ( $build ) Old question but just in case someone ends up here just has I did today. This orb installs and configures Blackfire agent and CLI tool. It’s preferable that you configure the PHP probe using environment variables.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |