From d6525b698a56a7610ba5a4b9b8fdf36b2daa0e59 Mon Sep 17 00:00:00 2001 From: viniciusss Date: Tue, 11 Nov 2025 08:20:12 -0300 Subject: [PATCH] (improv): add possibilidade de ignorar exceptions no NR --- Dockerfile | 2 ++ bin/newrelic-setup | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/Dockerfile b/Dockerfile index b76e95c..0a66e12 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,8 @@ ENV \ NR_APP_NAME="" \ NR_LICENSE_KEY="" \ NR_VERSION="" \ + NR_IGNORE_DEFAULT_EXCEPTION=false \ + NR_IGNORED_EXECEPTIONS="" \ PHP_OPCACHE_ENABLED=false \ SESSION_HANDLER=false \ SESSION_HANDLER_NAME="" \ diff --git a/bin/newrelic-setup b/bin/newrelic-setup index 840c0b4..a32827b 100755 --- a/bin/newrelic-setup +++ b/bin/newrelic-setup @@ -13,6 +13,19 @@ if [[ ${NR_ENABLED} == true ]]; then echo "newrelic.application_logging.enabled = true" | tee -a /usr/local/etc/php/conf.d/newrelic.ini fi + if [[ ${NR_IGNORE_DEFAULT_EXCEPTION} == true ]]; then + NR_DEFAULT_IGNORED_EXCEPTIONS="Simonetti\Infra\Exceptions\IgnorableExceptionInterface" + if [[ "${NR_IGNORED_EXECEPTIONS}" != "" ]]; then + NR_IGNORED_EXCEPTIONS="${NR_DEFAULT_IGNORED_EXCEPTIONS},${NR_IGNORED_EXECEPTIONS}" + else + NR_IGNORED_EXCEPTIONS="${NR_DEFAULT_IGNORED_EXCEPTIONS}" + fi + fi + + if [[ "${NR_IGNORED_EXECEPTIONS}" != "" ]]; then + echo "newrelic.error_collector.ignore_exceptions = ${NR_IGNORED_EXECEPTIONS}" | tee -a /usr/local/etc/php/conf.d/newrelic.ini + fi + else echo "newrelic.enabled = false" | tee -a /usr/local/etc/php/conf.d/newrelic.ini fi