fix(laravel): use KIND_SERVER for Artisan Kernel::handle span#667
Open
zigzagdev wants to merge 1 commit into
Open
fix(laravel): use KIND_SERVER for Artisan Kernel::handle span#667zigzagdev wants to merge 1 commit into
KIND_SERVER for Artisan Kernel::handle span#667zigzagdev wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #667 +/- ##
=========================================
Coverage 80.09% 80.09%
Complexity 1597 1597
=========================================
Files 118 118
Lines 6179 6179
=========================================
Hits 4949 4949
Misses 1230 1230 Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Description
Illuminate\Contracts\Console\Kernel::handle()is instrumented withSpanKind::KIND_PRODUCER, which is meant for fire-and-forget messages sent to a queue and does not describe a synchronous Artisan CLI invocation.SpanKind::KIND_SERVER, matching the role this span plays as the entry point of the Artisan process — the same treatment already given toHooks/Illuminate/Contracts/Http/Kernel.php'shandle()span for HTTP requests.Why no test was added
The existing test suite cannot cover this bug in principle:
Kernel::instrument()only registershookHandle()whenshouldTraceCli()returnstrueshouldTraceCli()evaluates tofalseduring PHPUnit runs because PHPUnit itself runs under the CLI SAPI (PHP_SAPI === 'cli') andOTEL_PHP_TRACE_CLI_ENABLEDdefaults tofalse.So,
Kernel::hookHandle()is never registered during test execution, making it impossible to assert on the SpanKind from within the test suite.