DataDog / dd-trace-php

Datadog PHP Clients
https://docs.datadoghq.com/tracing/setup/php
Other
501 stars 155 forks source link

fix: Prevent Laravel Queue hooks from stacking up #2899

Closed PROFeNoM closed 1 month ago

PROFeNoM commented 1 month ago

Description

A customer reported hitting the hook limit from laravel.queue.action hook installs.

While their issue disappears when removing these three lines (CallQueueHandler::call being called before the job handler), this is by no means a fix. For legacy, doing method_exists on the hooked $class::$method was returning true for them, and we have had confirmation that this method was indeed being called; yet, the hook wasn't invoked.

This PR acts as a mitigation by preventing hooks from stacking up by removing them during the post-hook of the surrounding fire operation. It doesn't fix the issue.

Reviewer checklist

codecov-commenter commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 80.91%. Comparing base (3f3547d) to head (73c12ff). Report is 1 commits behind head on master.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2899/graphs/tree.svg?width=650&height=150&src=pr&token=eXio8H7vwF&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog)](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2899?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) ```diff @@ Coverage Diff @@ ## master #2899 +/- ## ============================================ + Coverage 78.21% 80.91% +2.70% Complexity 2526 2526 ============================================ Files 173 146 -27 Lines 18749 14713 -4036 Branches 988 0 -988 ============================================ - Hits 14664 11905 -2759 + Misses 3544 2808 -736 + Partials 541 0 -541 ``` | [Flag](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2899/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | Coverage Δ | | |---|---|---| | [appsec-extension](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2899/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | `?` | | | [tracer-extension](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2899/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | `78.10% <ø> (ø)` | | | [tracer-php](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2899/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | `82.09% <100.00%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files with missing lines](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2899?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | Coverage Δ | | |---|---|---| | [...egrations/LaravelQueue/LaravelQueueIntegration.php](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2899?src=pr&el=tree&filepath=src%2FDDTrace%2FIntegrations%2FLaravelQueue%2FLaravelQueueIntegration.php&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-c3JjL0REVHJhY2UvSW50ZWdyYXRpb25zL0xhcmF2ZWxRdWV1ZS9MYXJhdmVsUXVldWVJbnRlZ3JhdGlvbi5waHA=) | `96.00% <100.00%> (+0.02%)` | :arrow_up: | ... and [27 files with indirect coverage changes](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2899/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2899?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2899?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog). Last update [3f3547d...73c12ff](https://app.codecov.io/gh/DataDog/dd-trace-php/pull/2899?dropdown=coverage&src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog).
pr-commenter[bot] commented 1 month ago

Benchmarks [ tracer ]

Benchmark execution time: 2024-10-17 09:11:58

Comparing candidate commit 73c12ffb2b7b51158c3f61bd172a4e84415d7a73 in PR branch alex/AIDM-358_laravel-queue-mitigation with baseline commit 3f3547dc7d60b86a6f7dcccc46f5173b6edc8cd7 in branch master.

Found 0 performance improvements and 2 performance regressions! Performance is the same for 176 metrics, 0 unstable metrics.

scenario:PDOBench/benchPDOBaseline-opcache

scenario:TraceFlushBench/benchFlushTrace