# How to ignore certain spans

**URL:** <https://discuss.elastic.co/t/how-to-ignore-certain-spans/232625>\
**Category:** APM\
**Tags:** java\
**Created:** [May 14, 2020, 11:17am UTC](https://discuss.elastic.co/t/how-to-ignore-certain-spans/232625 "2020-05-14T11:17:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![stexxen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stexxen/32/68327_2.png) [@stexxen](https://discuss.elastic.co/u/stexxen)\
**Post date:** [May 14, 2020, 11:17am UTC](https://discuss.elastic.co/t/how-to-ignore-certain-spans/232625/1 "2020-05-14T11:17:10Z")

</div>

Hello,  
I'm using Elastic Cloud and very pleased with it so far. However I've come with a requirement that I can't seem to find a solution for. Is someone able to point in the right direction?

The application uses Mysql and H2, and all queries are being logged, however I don't want the H2 queries logged within a transaction, is it possible to permentently ignore certain types of spans somehow? Either in the Kibana view, or not sending them in the first place? `disable_instrumentations` allows me to disable jdbc, but I only want to disable a specific DB type.

Thanks,  
Steven.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [May 14, 2020, 2:20pm UTC](https://discuss.elastic.co/t/how-to-ignore-certain-spans/232625/2 "2020-05-14T14:20:35Z")

</div>

Hey and welcome to the forum!

One option to deal with this is through ingestion - check out the [ingest node pipelines](https://www.elastic.co/guide/en/apm/server/7.7/configuring-ingest-node.html). The [drop processor](https://www.elastic.co/guide/en/elasticsearch/reference/7.7/drop-processor.html) should fulfil your needs.

Another option is to exclude the H2 driver classes from instrumentation at the agent itself - try to set `classes_excluded_from_instrumentation` with the H2 driver base package (if you use as System property, the property name would be `elastic.apm.classes_excluded_from_instrumentation`). For example - `classes_excluded_from_instrumentation=org.h2.*`

I hope this helps.

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [May 14, 2020, 2:50pm UTC](https://discuss.elastic.co/t/how-to-ignore-certain-spans/232625/3 "2020-05-14T14:50:29Z")

</div>

I corrected the example above, as the`classes_excluded_from_instrumentation` config needs to be set with wildcards in order to exclude packages.

---

<div class="post-metadata">

**Author:** ![stexxen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stexxen/32/68327_2.png) [@stexxen](https://discuss.elastic.co/u/stexxen)\
**Post date:** [May 14, 2020, 3:12pm UTC](https://discuss.elastic.co/t/how-to-ignore-certain-spans/232625/4 "2020-05-14T15:12:14Z")

</div>

Brilliant. That sorts it 👌  
`classes_excluded_from_instrumentation` is a most useful addition.

However, I can't find any mention of it in the docs? Is it something you don't normally want people to use?

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [May 14, 2020, 3:17pm UTC](https://discuss.elastic.co/t/how-to-ignore-certain-spans/232625/5 "2020-05-14T15:17:45Z")

</div>

Currently it's a hidden config, and by setting it you actually overrode the defaults, but if you don't get anything instrumented that you don't want - this is not a problem.  
We intend to expose it soon, it just requires a small change so it wouldn't override the defaults. Once we do that, it will be documented as well.  
Thanks for the feedback!

---

<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:** [June 4, 2020, 11:17am UTC](https://discuss.elastic.co/t/how-to-ignore-certain-spans/232625/6 "2020-06-04T11:17:49Z")

</div>

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