Code Monkey home page Code Monkey logo

Comments (6)

science695 avatar science695 commented on July 29, 2024

@tsantos84 Are you trying to work on something similar to this? https://packagist.org/packages/goksagun/elastic-apm-bundle

When I was trying to set it up, I found it a bit inflexible for my needs, but it could be useful for you.

from elastic-apm-php-agent.

tsantos84 avatar tsantos84 commented on July 29, 2024

Yes, it's a bit inflexible and I decided to write a new bundle for my company purposes (fit php versions, new spans and etc). After this experience, I'm planning to write a public bundle or contribute with goksagun/elastic-apm-bundle.

Anyway, the question here is about flushing the agent automatically. I think it'd be an optional process given the problems I've mentioned on the initial thread.

from elastic-apm-php-agent.

science695 avatar science695 commented on July 29, 2024

Perhaps what you need is something where if it is running in the symfony console, set the active config to false? That could be done in your symfony config, and not require a change in the agent code.

from elastic-apm-php-agent.

tsantos84 avatar tsantos84 commented on July 29, 2024

I've thought about this approach, but didn't saw an easy way to do that. And thinking better, unit testing could cause the same side effect depending how they were written. In a bundle, it's better to let it flush the events instead of on __destruct. There is another side effect on it. If some error happens (e.g request failure), we can't see the error on __destruct.

from elastic-apm-php-agent.

science695 avatar science695 commented on July 29, 2024

You may be able to do it through native php functions, so if you had a php config file, it could override the active config for the agent on runtime.

https://electrictoolbox.com/determine-php-run-via-http-or-cli/
https://www.php.net/manual/en/function.php-sapi-name.php

I will say, there is a lot of power in using php configuration files, but they are only documented in some circumstances.

from elastic-apm-php-agent.

phoenixgao avatar phoenixgao commented on July 29, 2024

If the apm server is not running or there is some network issue, then destruct function would throw an uncaught exception, would it be better to add a try catch here?

from elastic-apm-php-agent.

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.