Giter Site home page Giter Site logo

Comments (3)

dstepe avatar dstepe commented on July 4, 2024

Enabling the HTTP client configuration would need to start in underlying agent rather than this package. I'm not exactly sure how support client auto-discovery while enabling client configuration (which may vary by client). The 'bring your own client" approach is the compromise. If you want to open an issue we can further explore options.

For this package, we've used a slightly different approach to configure the client. In the standard AppServiceProvider::register() method, you can bind a configured AgentBuilder and provide only the http client:

        $this->app->bind(AgentBuilder::class, function () {
            $builder = new AgentBuilder();

            $builder->withHttpClient(new \Http\Adapter\Guzzle7\Client(new Client(['verify' => false])));

            return $builder;
        });

Do you want to give that a try and see if it works for you? If so, we can suggest this be added to the documentation of this project.

from elastic-apm-laravel.

arkaitzgarro avatar arkaitzgarro commented on July 4, 2024

Hi @ElvisIsKing666,

As mentioned by @dstepe, this is the way to go. We actually use this approach to reduce the timeout when connecting to Elastic:

$this->app->bind(AgentBuilder::class, function (): AgentBuilder {
    $builder = new AgentBuilder();
    $builder
        ->withHttpClient(new GuzzleClient([
            'timeout' => 1.0,
        ]));

    return $builder;
});

from elastic-apm-laravel.

ElvisIsKing666 avatar ElvisIsKing666 commented on July 4, 2024

Ah, right, I see now that the original service provider is calling app()->make() to get the AgentBuilder. So all I need to do is just bind a new one with the client configured the way I need it. Thanks for pointing that out.

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.