Comments (5)
It might be related to this random (or not) failing unit test?
from elastic-apm-laravel.
I would say there is a very good chance. I'm having a difficult time explaining the "random" part, but I think I understand the cause. I need a little time to confirm and put a change together, but should have something within a day.
from elastic-apm-laravel.
The randomness most probably can be explain by codeception settings, where we shuffle the test execution, to actually spot situations like that. I can imagine that depending on the order, the configuration is available or not.
Running the tests (2.x branch) with a failing seed makes them always fail:
vendor/bin/codecept run --seed 2103579227
from elastic-apm-laravel.
The specific bug we found does produce the same error, but I have not yet determine why the order of the tests causes this behavior to manifest. It is rooted in the ServiceProvider, and the one test which fails with this error is the one testing the ServiceProvider. There must be some connection, but the fix for the bug does not fix the tests when using a seed that previously failed. There are also failures regarding the Log
class, which makes no sense at all. I'll keep digging on that.
from elastic-apm-laravel.
I think I finally figured it out. Two things came together to create those random failures. First, we expanded the test suite to include the config
tests which have a side affect of setting environment variables during execution. Second, on the v2.x branch, I added a simple test to validate the Agent can be created with different methods to get the Monolog instance. That was the first use of orchestra/testbench to actually load the ServiceProvider and test it.
The issue appears to be the order of execution of the config tests and that use of _before
to clear the environment variables. Since the variables are cleared before a test, the any variables set in the final test to be run will remain set. When that final test was one which set some specific variable (and I have not bothered to track that down), the configuration was impacted when testbench bootstrapped the Laravel framework.
Since we have not added any ServiceProvider tests to other users of testbench to the v3.x line, we have not seen the problem there.
The solution is to use _after
in the config tests to clear the environment variables after each test is run, thereby leaving the environment in a clean state.
I'll include this in the current PRs for this bug, even though they are not directly related.
from elastic-apm-laravel.
Related Issues (20)
- Use of undefined constant LARAVEL_START - assumed 'LARAVEL_START' (this will throw an Error in a future version of PHP) HOT 3
- Did not collect data from Api routes HOT 1
- Return value of AG\ElasticApmLaravel\ServiceProvider::getAppConfig() must be of the type array, null returned HOT 4
- installation error HOT 2
- installation error HOT 7
- Logs for deprecated parameters
- Apm setup HOT 4
- Laravel 9? HOT 12
- Laravel Octane Support HOT 8
- Standard ELASTIC_APM_ENVIRONMENT value is not used correctly
- Build failing due to failure in the Command collector HOT 3
- Transaction not getting associated with Errors on Elastic Cloud APM HOT 1
- Send only Transactions associated with Exceptions to APM Server HOT 1
- Application ENV not picked up by agent HOT 1
- Need to include latest version of nipwaayoni/elastic-apm-php-agent HOT 2
- Jobs not tracked HOT 8
- AG\ElasticApmLaravel\Collectors\EventDataCollector::shouldIgnoreTransaction(): Argument #1 ($transaction_name) must be of type string, HOT 6
- Laravel Telescope Support HOT 1
- Is there a reason that this agent doesn't allow collecting stacktraces? HOT 2
- Problems with self-signed certificates HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elastic-apm-laravel.