blackfireio / php-sdk

The Blackfire PHP SDK
https://blackfire.io
MIT License
150 stars 22 forks source link

Handmade profil triggered by the SDK are enlisted by default. #53

Open thomasdiluccio opened 3 years ago

thomasdiluccio commented 3 years ago

Profiles triggered by custom code are enlisted by default. They cannot be unlisted. Tested with the v1.23.0 and the v1.25.0.

$this->blackfireClient = new Client();
$this->config = new Configuration();

or

$this->blackfireClient = new Client();
$this->config = (new Configuration())
    ->setMetadata('skip_timeline', 'true')
;

both lead to enlisted results.

lolautruche commented 3 years ago

I am able to reproduce with the following script:

require __DIR__.'/vendor/autoload.php';

$blackfireClient = new \Blackfire\Client();
$config = new \Blackfire\Profile\Configuration();
$config->setTitle('Test SDK issue');
$probe = $blackfireClient->createProbe($config);

sleep(2);
echo "Hello world!";

echo $blackfireClient->endProbe($probe)->getUrl()."\n";

The profile is expected not to be listed by default, but it actually is.

lolautruche commented 3 years ago

However, when I add skip_timeline to true, the profile is first enlisted, but disappears a few seconds later (I am guessing that a consumer updates the profile afterwards):

<?php

require __DIR__.'/vendor/autoload.php';

$blackfireClient = new \Blackfire\Client();
$config = new \Blackfire\Profile\Configuration();
$config->setTitle('Test SDK issue');
$config->setMetadata('issue', 'https://github.com/blackfireio/php-sdk/issues/53');
$config->setMetadata('skip_timeline', 'true');
$probe = $blackfireClient->createProbe($config);

sleep(2);
echo "Hello world!\n";

echo $blackfireClient->endProbe($probe)->getUrl()."\n";