# Excluding trace methods

**URL:** <https://discuss.elastic.co/t/excluding-trace-methods/193806>\
**Category:** APM\
**Tags:** java\
**Created:** [August 5, 2019, 1:34pm UTC](https://discuss.elastic.co/t/excluding-trace-methods/193806 "2019-08-05T13:34:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ethranes](https://avatars.discourse-cdn.com/v4/letter/e/e56c9b/32.png) [@ethranes](https://discuss.elastic.co/u/ethranes)\
**Post date:** [August 5, 2019, 1:34pm UTC](https://discuss.elastic.co/t/excluding-trace-methods/193806/1 "2019-08-05T13:34:03Z")

</div>

Hi, I am using trace\_methods to instrument my code, I am wondering if there is a way to exclude certain classes from being instrumented via the properties file. i.e. I have the following;

`trace_methods=com.nat.*#*`

This would instrument all classes and methods in the com.nat package, however if there was a single class that I wanted to exclude is this an option?

The only other way around it that I could think of was that I would need to specify every class and method that I wanted specifically, which isn't really feasible.

Any help or advice is appreciated.

Thanks.

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [August 5, 2019, 1:46pm UTC](https://discuss.elastic.co/t/excluding-trace-methods/193806/2 "2019-08-05T13:46:18Z")

</div>

Currently there is not but I agree that this would be a nice addition. The syntax could be: `trace_methods=com.example.*, -com.example.foo.*`.

Would you volunteer for doing the PR?

---

<div class="post-metadata">

**Author:** ![ethranes](https://avatars.discourse-cdn.com/v4/letter/e/e56c9b/32.png) [@ethranes](https://discuss.elastic.co/u/ethranes)\
**Post date:** [August 5, 2019, 2:21pm UTC](https://discuss.elastic.co/t/excluding-trace-methods/193806/3 "2019-08-05T14:21:11Z")

</div>

Hi Felix, thanks for your suggestion. I've opened a new issue for this on github

> <https://github.com/elastic/apm-agent-java/issues/779>

---

<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:** [August 26, 2019, 10:21am UTC](https://discuss.elastic.co/t/excluding-trace-methods/193806/4 "2019-08-26T10:21:11Z")

</div>

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