apm-agent-nodejs icon indicating copy to clipboard operation
apm-agent-nodejs copied to clipboard

filter exceptions configuration

Open kurigashvili-godaddy opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe. filter exceptions configuration like in the Ruby agent: https://www.elastic.co/guide/en/apm/agent/ruby/master/configuration.html#config-filter-exception-types

Describe the solution you'd like Add the feature to the node agent

Describe alternatives you've considered Debugged apm node agent and did not find any alternatives. Some routing errors in express are still send to the APM even we have express middleware to catch it. For example:

URIError: Failed to decode param '//..%c0%af../..%c0%af../..%c0%af../..%c0%af../..%c0%af../..%c0%af../etc/shadow.jsp'

Additional context Add any other context or screenshots about the feature request here.

kurigashvili-godaddy avatar Dec 09 '21 19:12 kurigashvili-godaddy

The Python agent has this too, FWIW: https://www.elastic.co/guide/en/apm/agent/python/current/configuration.html#config-filter-exception-types

@kurigashvili-godaddy I wonder if in Ruby-land there is a much stronger practice of having a separate Error subclass for different types of errors. In Node-land, at least in my experience, many libs just use the base Error class without subclassing. I suspect the utility would be somewhat less in Node-land. However, it would be straightforward to implement comparing err.name to a configured array of names to filter out. (Getting into checking err.message against patterns would be slower.)

Would having:

var apm = require('elastic-apm-node').start({
    // ...
    filterExceptionTypes: ['URIError']
})

satisfy your use case?

trentm avatar Jan 17 '22 22:01 trentm

The Python agent has this too, FWIW: https://www.elastic.co/guide/en/apm/agent/python/current/configuration.html#config-filter-exception-types

@kurigashvili-godaddy I wonder if in Ruby-land there is a much stronger practice of having a separate Error subclass for different types of errors. In Node-land, at least in my experience, many libs just use the base Error class without subclassing. I suspect the utility would be somewhat less in Node-land. However, it would be straightforward to implement comparing err.name to a configured array of names to filter out. (Getting into checking err.message against patterns would be slower.)

Would having:

var apm = require('elastic-apm-node').start({
    // ...
    filterExceptionTypes: ['URIError']
})

satisfy your use case?

@trentm yes. it would satisfy our use case. thank you.

kurigashvili-godaddy avatar Jan 18 '22 17:01 kurigashvili-godaddy