# APM self instrumentation

**URL:** <https://discuss.elastic.co/t/apm-self-instrumentation/201179>\
**Category:** APM\
**Tags:** server\
**Created:** [September 26, 2019, 8:11am UTC](https://discuss.elastic.co/t/apm-self-instrumentation/201179 "2019-09-26T08:11:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![willem](https://avatars.discourse-cdn.com/v4/letter/w/898d66/32.png) [@willem](https://discuss.elastic.co/u/willem)\
**Post date:** [September 26, 2019, 8:11am UTC](https://discuss.elastic.co/t/apm-self-instrumentation/201179/1 "2019-09-26T08:11:05Z")

</div>

If you are asking about a problem you are experiencing, please use the following template, as it will help us help you. If you have a different problem, please delete all of this text 🙂

**Kibana version** : 7.2

**Elasticsearch version** : 7.2

**APM Server version** : 7.2

**APM Agent language and version** : N/A

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**: Kubernetes - official docker images

**Fresh install or upgraded from other version?** Fresh

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:  
I've tried to enable the self instrumentation of APM Server, due to a bottleneck I'm experiencing when ingesting at a high rate.  
I've set

```auto
instrumentation:
      enabled: true

```

in the config, but it doesn't seem to be taking effect, as per logs:

```auto
2019-09-25T11:21:16.678Z INFO [beater] beater/beater.go:253 self instrumentation is disabled

```

Is there any additional configuration necessary?  
I've tried setting things like:

```auto
    instrumentation:
      enabled: true
      environment: "pre-prod"
      hosts:
        - "elastic-apm-elasticsearch:9200"

```

but still no success

---

<div class="post-metadata">

**Author:** ![jalvz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jalvz/32/45613_2.png) [@jalvz](https://discuss.elastic.co/u/jalvz)\
**Post date:** [September 26, 2019, 10:42am UTC](https://discuss.elastic.co/t/apm-self-instrumentation/201179/2 "2019-09-26T10:42:01Z")

</div>

Hi, I can't see anything wrong with it. Can you share the whole config?

Otherwise, you maybe can try executing apm-server like `apm-server -e -E apm-server.instrumentation.enabled=true`

Can you give some details about the bottleneck you are experiencing?

---

<div class="post-metadata">

**Author:** ![willem](https://avatars.discourse-cdn.com/v4/letter/w/898d66/32.png) [@willem](https://discuss.elastic.co/u/willem)\
**Post date:** [September 26, 2019, 11:03am UTC](https://discuss.elastic.co/t/apm-self-instrumentation/201179/3 "2019-09-26T11:03:02Z")

</div>

Hi,

Full config:

```auto
  apm-server.yml: |
    apm-server.host: 0.0.0.0:8200
    output.elasticsearch:
      hosts: "elastic-apm-elasticsearch:9200"
    setup.template.settings:
      index.number_of_shards: 1
      index.number_of_replicas: 2
    instrumentation:
      enabled: true
      environment: "pre-prod"
      hosts:
        - "elastic-apm-elasticsearch:9200"
    monitoring.enabled: true
    monitoring.elasticsearch:
    logging.level: "warning"

```

If i manually specify the command as you asked, it seems to work.

I'm not too sure about the bottleneck, and thus the need for self instrumentation. When we reach around 10,000 requests a minute to apm server, we start seeing errors/timeouts from agents. Scaling out additional apm server instances doesn't help. The elastic search stack doesn't seem to be under too much pressure. Just feeling around in the dark at the moment

---

<div class="post-metadata">

**Author:** ![jalvz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jalvz/32/45613_2.png) [@jalvz](https://discuss.elastic.co/u/jalvz)\
**Post date:** [September 26, 2019, 12:18pm UTC](https://discuss.elastic.co/t/apm-self-instrumentation/201179/4 "2019-09-26T12:18:36Z")

</div>

I see: `instrumentation` should be nested inside apm-server, so `apm-server.instrumentation:`...

---

<div class="post-metadata">

**Author:** ![willem](https://avatars.discourse-cdn.com/v4/letter/w/898d66/32.png) [@willem](https://discuss.elastic.co/u/willem)\
**Post date:** [September 26, 2019, 12:38pm UTC](https://discuss.elastic.co/t/apm-self-instrumentation/201179/5 "2019-09-26T12:38:30Z")

</div>

That did the trick ... thanks. I feel pretty stupid now.

---

<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:** [October 17, 2019, 8:38am UTC](https://discuss.elastic.co/t/apm-self-instrumentation/201179/6 "2019-10-17T08:38:30Z")

</div>

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