How to ignore 404 error in dependencies?

Hi!

We are using elastic apm in a micro-service environment and we have some 404 response from internal APIs that are totally acceptable, like verifying if a resource exists, but those are reported as erros in the Dependency tab.

Is there a way, in code, to ignore specific 404 span errors from http dependencies?

Looking at the code from Github, the span is ending in postHook just after the curl execution and I don't see how one can intercept it.

Maybe something file addErrorFilter from nodejs apm: https://discuss.elastic.co/t/how-to-ignore-certain-errors-in-apm/305880

Regards,
Leandro

1 Like

Hi @leandro.silva , welcome to our forum !

For HTTP client calls, the APM agents consider a 4xx to be an error on the client side (but on the server side it's not), the attribute used to store this information is event.outcome.

In order to modify this, the simplest (and cross-platform) way would be to use an ingest pipeline that modifies the data before it is written into Elasticsearch.

In your case, it would be a matter of setting event.outcome = success for the spans that are created by our HTTP client instrumentation.

I realized just a few minutes too late that this strategy might not work here as the dependencies rely on metrics that are derived from the HTTP spans, so modifying the span data before it is written in ES does not help to keep those metrics consistent.

Sorry for the noise !

As a consequence, you might have to use an agent-specific way to do the same.
Which APM agent are you using here ? Not all of them provide such functionality, but from memory I think the node.js one does.

Thanks for the reply.

We are using PHP. On nodejs we can use the addErrorFilter, but this feature is not implemented on the PHP agente yet :frowning:

After checking the PHP agent team, there is already an issue filed for this: Support filters to discard/modify events · Issue #67 · elastic/apm-agent-php · GitHub make sure to subscribe to it to be notified when there are updates.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.