Comments (8)
The use of Octane could be inferred by looking for the presence of it's configuration (I've never tried that in Laravel, so that's really more a theory). We could flip the behavior and add auto-detection of Octane with the option to disable auto-detection if needed. That auto-detection method could be extended as other use cases arise.
from elastic-apm-laravel.
I would prefer if this is transparent and it is handled by the package, and not expect from developers to understand that Octane only boots the application once, and specific configuration is needed to make this package work. But I don't see an obvious way to do it.
from elastic-apm-laravel.
@alignwebs I don't have experience with Octane, but we faced a similar problem with workers/jobs, that we handle checking if the application is running in the console via $this->app->runningInConsole()
.
Do you know if there's a similar helper in Octane that can tell us if the package/application is running via a worker, so we can set the start time on every request?
from elastic-apm-laravel.
I also have not used Octane. Nothing in the docs jumped out as an appropriate indicator to use. It looks like inference from the config or something would be needed. I was thinking a new config in this package would be better, that way the user could explicitly indicate they want "per request start time" or something.
from elastic-apm-laravel.
Do you know if there's a similar helper in Octane that can tell us if the package/application is running via a worker, so we can set the start time on every request?
When I tried to Log the time value inside the RequestStartTime
class, it was giving new values on each request! So technically the class was working fine but I don't know even if it's getting terminated at any point or not.
Octane has a way to attach Listeners to Octane Events in config/octane.php
. I feel this way we need to make some manual adjustments to make it work.
What do you think @arkaitzgarro ?
from elastic-apm-laravel.
Stumbled upon this, tried to flush the RequestTime for each request, at least it give me the real latency, although there's Closure span that I dunno where it comes. Also I got warning for route_matching
The sleep/google/facebook duration span is correct but the position is wrong. I also tried to add all the collector to flush, but still the same
Laravel 9.42.2
php:8.1-cli-alpine
Octane using roadrunner
from elastic-apm-laravel.
Update
So I somewhat get it working in testing environment, turns its only the problem of "terminating" hook from this package, because originally "terminating" event is broadcasted in every request, in octane, it doesn't. But, octane do have "RequestTerminated" event which is equivalent of the normal terminating event, so I just hook the send command to that, it works. Also I don't actually need to flush the RequestStartTime.
But, there seem to be some caveat,
- there are some
$_SERVER
that doesn't available in roadrunner, here's the json comparison of the data sent to apm, it's the cookies and more notablyurl
key that affect the view in Kibana in url section
- I found this anomaly from excessive refresh, and I found it twice on 10 transaction, I probably need more investigation on why this is happen, probably because the multiple worker scenario on octane.
from elastic-apm-laravel.
I'm trying to add this package to my app Laravel + Octane + Swoole, but the time is so long and the trace didn't show.
@fmiqbal I tried to add function into the array requestTerminated but don't work for me :/. How did you resolve this? I need to add something in another place? Could you help me?
Update
I added \AG\ElasticApmLaravel\Collectors\RequestStartTime::class into the key flush and the request time it's ok.
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
- 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.