elastic / apm-agent-php

Apache License 2.0
252 stars 69 forks source link

elastic_apm.error_level Configuration #1066

Open GuiEloiSantos opened 12 months ago

GuiEloiSantos commented 12 months ago

Is your feature request related to a problem? Please describe. I propose adding an additional layer of customization to Elastic APM's error-capturing behavior, specific to the PHP agent. Currently, the agent relies on PHP's native error_reporting setting to determine what constitutes an error. While this is functional, it doesn't provide the granularity that may be required in some use-cases.

Documentation Reference:

Elastic APM PHP Agent Configuration PHP error_reporting Function

The existing setup tightly couples APM's error recognition with PHP's error settings. This leaves no room for differentiating between errors that are critical for APM monitoring and errors that, while perhaps noteworthy, are not critical from an APM perspective.

Describe the solution you'd like

Introduce a new configuration option, say, elastic_apm.error_level, that allows users to specify the types of errors that should be captured by APM, independent of PHP's error_reporting setting.

For example, setting elastic_apm.error_level to a particular verbosity level would cause the APM agent to ignore errors below that level, irrespective of what is set in PHP's error_reporting.