# Django Agent - Ignoring spans related to templates

**URL:** <https://discuss.elastic.co/t/django-agent-ignoring-spans-related-to-templates/198208>\
**Category:** APM\
**Tags:** python\
**Created:** [September 5, 2019, 9:29am UTC](https://discuss.elastic.co/t/django-agent-ignoring-spans-related-to-templates/198208 "2019-09-05T09:29:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sivasubramaniam\_Arun](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sivasubramaniam_arun/32/53611_2.png) [@Sivasubramaniam\_Arun](https://discuss.elastic.co/u/Sivasubramaniam_Arun)\
**Post date:** [September 5, 2019, 9:29am UTC](https://discuss.elastic.co/t/django-agent-ignoring-spans-related-to-templates/198208/1 "2019-09-05T09:29:06Z")

</div>

Is there any configuration to ignore specific span names? Our Django template has a big HTML table and each cell in the has the {% include xxx.htm %} and APM reports the metrics for each cell which is over 2000 entires.

Using the latest version(7.3.1) of ELK+APM in Elastic Cloud  
Django Version: 1.11.17  
Python Version: 3.7  
APM Agent version: 5.1.1

 ![ss](https://us1.discourse-cdn.com/elastic/original/3X/a/d/add44f9dcb824556d52b3b34d02914b861e65d32.png)

---

<div class="post-metadata">

**Author:** ![beniwohli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/beniwohli/32/21256_2.png) [@beniwohli](https://discuss.elastic.co/u/beniwohli)\
**Post date:** [September 5, 2019, 9:49am UTC](https://discuss.elastic.co/t/django-agent-ignoring-spans-related-to-templates/198208/2 "2019-09-05T09:49:20Z")

</div>

Hi @Sivasubramaniam_Arun!

That's an interesting use case! I'm afraid at the moment, your best option will be to completely disable instrumentation of Django templates. You can do this by setting the environment variable `SKIP_INSTRUMENT_DJANGO_TEMPLATE` to any value for your Django processes(es).

A bit more long term, I was considering extending our [processors](https://www.elastic.co/guide/en/apm/agent/python/master/sanitizing-data.html#sanitizing-data) to not just modify events, but be able to completely drop an event by returning `False`. If/Once that is implemented, a processor to drop these spans would look like this:

```
from elasticapm.conf.constants import SPAN
from elasticapm.processors import for_events

@for_events(SPAN)
def drop_table_includes(client, event):
    if event["name"] == "quarter_cell_tool_tip.htm":
        return False
    return event

```

I'll open an issue to propose this change with our processors.

---

<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:** [September 26, 2019, 5:49am UTC](https://discuss.elastic.co/t/django-agent-ignoring-spans-related-to-templates/198208/3 "2019-09-26T05:49:22Z")

</div>

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