Giter Site home page Giter Site logo

Comments (8)

dstepe avatar dstepe commented on July 20, 2024 2

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.

arkaitzgarro avatar arkaitzgarro commented on July 20, 2024 1

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.

arkaitzgarro avatar arkaitzgarro commented on July 20, 2024

@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.

dstepe avatar dstepe commented on July 20, 2024

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.

alignwebs avatar alignwebs commented on July 20, 2024

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.

image

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.

image

What do you think @arkaitzgarro ?

from elastic-apm-laravel.

fmiqbal avatar fmiqbal commented on July 20, 2024

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

image
image

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

image

Laravel 9.42.2
php:8.1-cli-alpine
Octane using roadrunner

from elastic-apm-laravel.

fmiqbal avatar fmiqbal commented on July 20, 2024

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.

image

image

But, there seem to be some caveat,

  1. 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 notably url key that affect the view in Kibana in url section

image

image

  1. 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.

image

from elastic-apm-laravel.

Lorrhanl avatar Lorrhanl commented on July 20, 2024

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?

image

image

image

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.