elastic / apm-agent-php

Apache License 2.0
252 stars 69 forks source link

add ability to ignore some URLs #556

Closed brettmc closed 3 years ago

brettmc commented 3 years ago

Is your feature request related to a problem? Please describe. In a setup where we have health checks pinging our PHP services, I would like to not have all of those microtransactions instrumented by APM. In my case, it's a php-fpm check which hits pm.status_path = /status directly:

"REQUEST_URI=/status HTTP_HOST=${HOSTNAME} REQUEST_METHOD=GET SCRIPT_NAME=/status SCRIPT_FILENAME=/status /usr/bin/cgi-fcgi -bind -connect localhost:9000"

Describe the solution you'd like I'd like to see ELASTIC_APM_TRANSACTION_IGNORE_URLS implemented, along the lines of the nodejs implementation: https://www.elastic.co/guide/en/apm/agent/nodejs/current/configuration.html#transaction-ignore-urls I would then like to set ELASTIC_APM_TRANSACTION_IGNORE_URLS=/status,/ping etc, and have those URLs not instrumented automatically.

Describe alternatives you've considered If I could run some userland code, I'd $transaction->discard(), but an fpm status page only triggers built-in/pre-load code (bootstrap_php_part.php)

adamtester commented 3 years ago

This is actually already implemented, but not in a release yet, see: https://github.com/elastic/apm-agent-php/commit/dc89ad2e52381208b748db4199bb7213c1c44dd4

In the meantime you can use dev-master in composer

brettmc commented 3 years ago

Confirming that this is a duplicate of https://github.com/elastic/apm-agent-php/issues/82, and the implementation in master looks like what I need. Closing.