Skip to content

Not tracking on NewRelic #600

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
brayann opened this issue Jul 8, 2017 · 11 comments
Closed

Not tracking on NewRelic #600

brayann opened this issue Jul 8, 2017 · 11 comments

Comments

@brayann
Copy link

brayann commented Jul 8, 2017

Summary of problem or feature request

I'm not really sure if this is something regarding your library (I'm sorry if it isn't), but for some reason NewRelic doesn't consider requests made to the elastic search as an External Service or just as a DB.
It does recognize for example our Redis instance as a DB, which is external (Elasticache), and also other external services that we call using either curl or guzzle.
I searched for it on the issues and didn't find anything related, it might be a dumb question but I'm really not sure how to do it. I'm considering using Newrelic's functions on my PHP code to try to track it down manually.

System details

  • Operating System: Ubuntu
  • PHP Version: 7.0.1
  • ES-PHP client version: 5.1.3
  • Elasticsearch version: 5.1.2 (we use http://elastic.co)
@polyfractal
Copy link
Contributor

Hey, sorry for the delay (was out of town and then got sick).

To be honest, I really have no idea. I'll do some reading to see if there is something that the client needs to do to show up as to NewRelic. It may be something that they do internally, like watching curl requests and classifying them based on protocol/content/etc.

Not sure, sorry :/ I'll let you know if I discover anything

@brayann
Copy link
Author

brayann commented Jul 19, 2017

No worries, thanks for looking into it.

@fedeisas
Copy link

I've been digging into this. Guzzle wraps curl connections and it's been a know issue with Newrelic for a long time. But now, the New Relic team added a guzzle feature on their agent, which I think tracks requests from objects extending from the GuzzleHttp\Client. Instead of using the Guzzle client, this library calls the handlers directly:

if (extension_loaded('curl')) {
    $config = array_merge([ 'mh' => curl_multi_init() ], $multiParams);
    if (function_exists('curl_reset')) {
        $default = new CurlHandler($singleParams);
        $future = new CurlMultiHandler($config);
    } else {
        $default = new CurlMultiHandler($config);
    }
} else {
    throw new \RuntimeException('Elasticsearch-PHP requires cURL, or a custom HTTP handler.');
}

I guess the fix is to use plain Guzzle.

@fedeisas
Copy link

Found this to be relevant: https://lukewaite.ca/posts/2017/07/15/php-newrelic-instrumentation-elasticseach.html

@brayann
Copy link
Author

brayann commented Feb 27, 2018

Oh that's awesome thanks @fedeisas I'll dig into it. One question though, where do you use/put the code you pasted on your first comment?

@fedeisas
Copy link

@brayann that code is actually from this package's source code. But if you go to the link I posted on the previous message, you'll find a library and the snippet to use Guzzle with a RingPHP wrapper.

@ezimuel
Copy link
Contributor

ezimuel commented Jul 12, 2019

Solved here. I'm refactoring elasticsearch-php for version 8 to use PSR-7 and PSR-18 standards. That means, this issue will not be relevant anymore.

@ezimuel ezimuel closed this as completed Jul 12, 2019
@fedeisas
Copy link

fedeisas commented Apr 23, 2020

@ezimuel could this release be. related to this issue? I can no longer use the lukewaite/ringphp-guzzle-handler because it requires guzzlehttp/ringphp 😢

I removed lukewaite/ringphp-guzzle-handler from my code and NewRelic is no longer seeing this as an external service call.

@ezimuel
Copy link
Contributor

ezimuel commented Apr 23, 2020

@fedeisas unfortunately guzzlehttp/ringphp is an abandoned project. I fork it into ezimuel/ringphp and from elasticsearch-php 7.5 we are using it as replacement.

@fedeisas
Copy link

Are you still moving away from RingPHP on the next version? I’ll be glad to contribute.

@ezimuel
Copy link
Contributor

ezimuel commented Apr 23, 2020

@fedeisas yes, I'm moving away from RingPHP. I' would like to support PSR standards, see #990 for comments and feedback. If you want to contribute you are more than welcome. I'll start working on it soon, on the master branch that is for the next major version Elasticsearch 8. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants