# How to ignore 404 error in dependencies?

**URL:** <https://discuss.elastic.co/t/how-to-ignore-404-error-in-dependencies/325465>\
**Category:** APM\
**Tags:** php\
**Created:** [February 14, 2023, 11:49am UTC](https://discuss.elastic.co/t/how-to-ignore-404-error-in-dependencies/325465 "2023-02-14T11:49:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![leandro.silva](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandro.silva/32/117231_2.png) [@leandro.silva](https://discuss.elastic.co/u/leandro.silva)\
**Post date:** [February 14, 2023, 11:49am UTC](https://discuss.elastic.co/t/how-to-ignore-404-error-in-dependencies/325465/1 "2023-02-14T11:49:26Z")

</div>

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](https://discuss.elastic.co/t/how-to-ignore-certain-errors-in-apm/305880)

Regards,  
Leandro

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [February 27, 2023, 1:01pm UTC](https://discuss.elastic.co/t/how-to-ignore-404-error-in-dependencies/325465/2 "2023-02-27T13:01:39Z")

</div>

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.

- [apm agent specification](https://github.com/elastic/apm/blob/main/specs/agents/tracing-spans.md#span-outcome) for span outcome (the agents sent `span.outcome` to APM server, but `event.outcome` is used when storing in Elasticsearch.
- [APM server ingest pipeline](https://www.elastic.co/guide/en/apm/guide/current/ingest-pipelines.html) doc

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [February 27, 2023, 1:11pm UTC](https://discuss.elastic.co/t/how-to-ignore-404-error-in-dependencies/325465/3 "2023-02-27T13:11:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![leandro.silva](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandro.silva/32/117231_2.png) [@leandro.silva](https://discuss.elastic.co/u/leandro.silva)\
**Post date:** [February 27, 2023, 1:26pm UTC](https://discuss.elastic.co/t/how-to-ignore-404-error-in-dependencies/325465/4 "2023-02-27T13:26:13Z")

</div>

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 ☹

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [February 27, 2023, 3:57pm UTC](https://discuss.elastic.co/t/how-to-ignore-404-error-in-dependencies/325465/5 "2023-02-27T15:57:39Z")

</div>

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](https://github.com/elastic/apm-agent-php/issues/67) make sure to subscribe to it to be notified when there are updates.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 20, 2023, 11:57am UTC](https://discuss.elastic.co/t/how-to-ignore-404-error-in-dependencies/325465/6 "2023-03-20T11:57:48Z")

</div>

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