Skip to content

Support the frankenphp SAPI#2602

Merged
bwoebi merged 4 commits intomasterfrom
bob/frankenphp
Mar 29, 2024
Merged

Support the frankenphp SAPI#2602
bwoebi merged 4 commits intomasterfrom
bob/frankenphp

Conversation

@bwoebi
Copy link
Copy Markdown
Collaborator

@bwoebi bwoebi commented Mar 28, 2024

Description

Builds the frankenphp SAPI in docker and creates a span for requests received on the handler.

The created span is pretty lightweight, because frankenphp (unlike roadrunner or Swoole) properly populates the superglobals, so we can rely on the internal default handling.

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

@bwoebi bwoebi requested a review from a team as a code owner March 28, 2024 17:57
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 28, 2024

Codecov Report

❌ Patch coverage is 25.53191% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.31%. Comparing base (7b4a640) to head (4aac38f).
⚠️ Report is 987 commits behind head on master.

Files with missing lines Patch % Lines
.../Integrations/Frankenphp/FrankenphpIntegration.php 0.00% 32 Missing ⚠️
ext/ddtrace.c 66.66% 2 Missing ⚠️
ext/serializer.c 83.33% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (25.53%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2602      +/-   ##
============================================
- Coverage     75.45%   75.31%   -0.14%     
- Complexity     2590     2594       +4     
============================================
  Files           242      243       +1     
  Lines         27180    27167      -13     
  Branches        976      976              
============================================
- Hits          20508    20462      -46     
- Misses         6152     6185      +33     
  Partials        520      520              
Flag Coverage Δ
appsec-extension 69.13% <ø> (ø)
tracer-extension 78.57% <80.00%> (-0.09%) ⬇️
tracer-php 73.70% <0.00%> (-0.23%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
ext/ddtrace.h 62.50% <ø> (ø)
ext/ddtrace_arginfo.h 100.00% <ø> (ø)
ext/integrations/integrations.c 97.88% <100.00%> (-0.02%) ⬇️
ext/serializer.c 80.17% <83.33%> (-0.03%) ⬇️
ext/ddtrace.c 73.08% <66.66%> (-0.05%) ⬇️
.../Integrations/Frankenphp/FrankenphpIntegration.php 0.00% <0.00%> (ø)

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7b4a640...4aac38f. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Mar 28, 2024

Benchmarks

Benchmark execution time: 2024-03-29 15:07:08

Comparing candidate commit 4aac38f in PR branch bob/frankenphp with baseline commit 7b4a640 in branch master.

Found 5 performance improvements and 8 performance regressions! Performance is the same for 168 metrics, 1 unstable metrics.

scenario:BM_TeaSapiSpindown

  • 🟥 execution_time [+10.471µs; +25.300µs] or [+2.028%; +4.900%]

scenario:ComposerTelemetryBench/benchTelemetryParsing-opcache

  • 🟥 execution_time [+1.336µs; +4.864µs] or [+2.365%; +8.609%]

scenario:MessagePackSerializationBench/benchMessagePackSerialization

  • 🟩 execution_time [-5.525µs; -3.855µs] or [-3.637%; -2.537%]

scenario:PDOBench/benchPDOBaseline-opcache

  • 🟥 execution_time [+7.961µs; +14.626µs] or [+4.576%; +8.408%]

scenario:PDOBench/benchPDOOverhead-opcache

  • 🟥 execution_time [+7.498µs; +14.890µs] or [+2.692%; +5.346%]

scenario:PDOBench/benchPDOOverheadWithDBM-opcache

  • 🟥 execution_time [+10.717µs; +19.374µs] or [+3.528%; +6.377%]
  • 🟥 mem_peak [+114.974KB; +114.977KB] or [+5.099%; +5.099%]

scenario:SamplingRuleMatchingBench/benchRegexMatching1

  • 🟥 execution_time [+136.584ns; +695.216ns] or [+2.221%; +11.305%]

scenario:SamplingRuleMatchingBench/benchRegexMatching3

  • 🟥 execution_time [+130.692ns; +674.908ns] or [+2.146%; +11.081%]

scenario:SymfonyBench/benchSymfonyBaseline

  • 🟩 execution_time [-329.867µs; -251.593µs] or [-5.530%; -4.218%]

scenario:SymfonyBench/benchSymfonyBaseline-opcache

  • 🟩 execution_time [-471.620µs; -366.820µs] or [-7.658%; -5.956%]

scenario:SymfonyBench/benchSymfonyOverhead

  • 🟩 execution_time [-739.634µs; -681.486µs] or [-9.478%; -8.732%]

scenario:SymfonyBench/benchSymfonyOverhead-opcache

  • 🟩 execution_time [-911.059µs; -763.241µs] or [-11.342%; -9.502%]

Signed-off-by: Bob Weinand <[email protected]>
Comment thread src/Integrations/Integrations/Frankenphp/FrankenphpIntegration.php Outdated
Comment on lines +55 to +57
}, function (HookData $hook) {
\DDTrace\remove_hook($hook->data);
});
Copy link
Copy Markdown
Contributor

@PROFeNoM PROFeNoM Mar 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering out loud

I understand that we want the hook on the callback to be set only once, the frankenphp_handle_request being called on each iteration of the main loop.

However, I ponder whether it is better to:

  • Install and remove the hook on the callback after the request is dispatched, hence having this overhead for basically all requests (although this happens outside a request)
    • This is what's currently done

OR

  • Don't remove the callback hook; instead, only install it if it isn't already set. I guess we could check this through a WeakMap on the Closure. This way, I think we could also use hook_function on frankenphp_handle_request and not remove the hook, which I believe to be less performance-hungry...

However, it is also possible that this change would be so negligible that it isn't meaningful...

Have you considered this way?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it. I don't think it makes a big difference, but anyway, why not :-)


consume_distributed_tracing_headers(null);
}, function (HookData $hook) {
var_dump($hook->span());
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes.

Copy link
Copy Markdown
Contributor

@PROFeNoM PROFeNoM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's ship it! ⛵

@bwoebi bwoebi merged commit dc920e6 into master Mar 29, 2024
@bwoebi bwoebi deleted the bob/frankenphp branch March 29, 2024 15:49
@github-actions github-actions Bot added this to the 0.99.0 milestone Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants