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.
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.
apm agent specification for span outcome (the agents sent span.outcome to APM server, but event.outcome is used when storing in Elasticsearch.
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.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.