Skip to content
This repository has been archived by the owner on Jan 17, 2022. It is now read-only.

feat(blackfire): Add bridge for upscale/swoole-blackfire #221

Merged
merged 4 commits into from
May 23, 2020

Conversation

luca-nardelli
Copy link
Contributor

Hi again!

I noticed that I was unable to profile requests with blackfire (before swoole I was using the standard nginx + php-fpm setup), as blackfire curl only told me that the probe was not initialized. After a while I stumbled upon this library https://github.com/upscalesoftware/swoole-blackfire and I tried to connect it to this bundle.

I've managed to make it work (I had to add the WithProfiler configurator after WithRequestHandler otherwise the instrumentation call would fail), however I didn't write any tests at the moment so I'd say the PR cannot be merged yet. I'm opening this PR to discuss this feature (with the proposed implementation)

Question 1: Is this a relevant addition to the bundle?
Question 2: Could you tell me which test I should look at if I wanted to write one for this new feature?

Thanks!

@k911
Copy link
Owner

k911 commented May 21, 2020

This feature seems to be useful, so yeah feel free to contribute :)
Edit: A few lines of documentation how to use it could also be handy

composer.json Show resolved Hide resolved
@codecov
Copy link

codecov bot commented May 21, 2020

Codecov Report

Merging #221 into develop will increase coverage by 0.13%.
The diff coverage is 100.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop     #221      +/-   ##
=============================================
+ Coverage      87.09%   87.23%   +0.13%     
- Complexity       612      617       +5     
=============================================
  Files             84       85       +1     
  Lines           1883     1903      +20     
=============================================
+ Hits            1640     1660      +20     
  Misses           243      243              
Impacted Files Coverage Δ Complexity Δ
...mfony/Bundle/DependencyInjection/Configuration.php 97.90% <100.00%> (+0.03%) 7.00 <0.00> (ø)
...ony/Bundle/DependencyInjection/SwooleExtension.php 88.88% <100.00%> (+0.96%) 48.00 <0.00> (+3.00)
src/Bridge/Upscale/Blackfire/WithProfiler.php 100.00% <100.00%> (ø) 2.00 <2.00> (?)

@luca-nardelli
Copy link
Contributor Author

I've added the following:

  • A documentation entry in the docs folder
  • A Unit test with prophpecy that ensures instrument() is called
  • A Feature test that ensures that the WithProfiler configurator is added after WithRequestHandler in the container. To do that, I had to make two services public for testing purposes though.
  • An entry in the suggests section of composer.json

Let me know if something else should be changed!

@k911
Copy link
Owner

k911 commented May 22, 2020

@luca-nardelli Thanks, really good job! I've left some comments, we'll have to address them and I think that's it.

@luca-nardelli
Copy link
Contributor Author

Fixed the usage of the service container (thanks for that!) and removed the unused property!

@k911 k911 added status/wip Work in progress and removed status/waiting-for-contributor labels May 22, 2020
Co-authored-by: Konrad Obal <konradobal@gmail.com>
@luca-nardelli
Copy link
Contributor Author

Ok I should have applied all your suggestions

@codeclimate
Copy link

codeclimate bot commented May 23, 2020

Code Climate has analyzed commit c102382 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 87.2% (0.2% change).

View more on Code Climate.

@k911
Copy link
Owner

k911 commented May 23, 2020

@luca-nardelli Thanks again for your hard work, I'll leave this on develop branch for a bit, then release.

@k911 k911 merged commit 960ddb8 into k911:develop May 23, 2020
@k911 k911 removed the status/wip Work in progress label May 23, 2020
@luca-nardelli
Copy link
Contributor Author

luca-nardelli commented May 23, 2020 via email

k911 added a commit that referenced this pull request Jun 24, 2020
* build(deps-dev): bump doctrine/annotations from 1.10.2 to 1.10.3 (#223) ([94ef806](94ef806)), closes [#223](#223)
* build(deps-dev): bump phpstan/phpstan from 0.12.28 to 0.12.29 (#249) ([ebf9ce1](ebf9ce1)), closes [#249](#249)
* build(deps-dev): bump phpstan/phpstan-doctrine from 0.12.15 to 0.12.16 (#248) ([830a9ef](830a9ef)), closes [#248](#248)
* build(deps-dev): bump phpstan/phpstan-doctrine from 0.12.16 to 0.12.17 (#263) ([d796528](d796528)), closes [#263](#263)
* chore(composer): add suggestion to use pixelfederation/doctrine-resettable-em-bundle to be able to r ([496c5fe](496c5fe)), closes [#226](#226)
* chore(composer): upgrade deps (#246) ([7e44a89](7e44a89)), closes [#246](#246)
* chore(composer): upgrade deps (#262) ([c9b218a](c9b218a)), closes [#262](#262)
* chore(deps): upgrade composer dependencies (#222) ([37d2517](37d2517)), closes [#222](#222)
* fix(config): allow configuring worker and reactor counts using ENV variables (#244) ([d6b270a](d6b270a)), closes [#244](#244)
* fix(profiler): make log collection in symfony profiler to work (#242) ([50fdd6f](50fdd6f)), closes [#242](#242)
* refactor(error-handler): move to proper namespace (#251) ([4c1c3e9](4c1c3e9)), closes [#251](#251)
* feat(blackfire): Add bridge for upscale/swoole-blackfire (#221) ([960ddb8](960ddb8)), closes [#221](#221)
* feat(exception-handler): Add Symfony error/exception handler (#228) ([180d5e5](180d5e5)), closes [#228](#228)
* feat(http-server): configurable mime types for advanced static files server (#240) ([07896a4](07896a4)), closes [#240](#240)
* ci(circle): upgrade docker client image to v19.03.11 (#239) ([fe7b46c](fe7b46c)), closes [#239](#239)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants