# Apm agent v 4.2.1 only collects metrics, not transations, for flask \> 1.x

**URL:** <https://discuss.elastic.co/t/apm-agent-v-4-2-1-only-collects-metrics-not-transations-for-flask-1-x/175636>\
**Category:** APM\
**Created:** [April 5, 2019, 4:49pm UTC](https://discuss.elastic.co/t/apm-agent-v-4-2-1-only-collects-metrics-not-transations-for-flask-1-x/175636 "2019-04-05T16:49:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![drinnird](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@drinnird](https://discuss.elastic.co/u/drinnird)\
**Post date:** [April 5, 2019, 4:49pm UTC](https://discuss.elastic.co/t/apm-agent-v-4-2-1-only-collects-metrics-not-transations-for-flask-1-x/175636/1 "2019-04-05T16:49:20Z")

</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** :  
6.5.3 with basic (not OSS)

**Elasticsearch version** :  
6.5.3

**APM Server version** :  
6.6.0

**APM Agent language and version** :  
python 4.2.1

**Browser version** :  
N/A

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**:  
python pip install

requirements.txt:  
Flask  
flask-cors  
nose  
-e git+https://github.com/vemba/m3u8.git@staging#egg=m3u8  
redis  
Flask-PyMongo  
boto3  
requests

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

**Is there anything special in your setup?** For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc.

We are using kubernetes to host the app:  
OS: mac osx Sierra / docker desktop with k8s v 1.13.0  
Python version: 3.7.2

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:

After installing python APM agent into app (running on k8s), only metrics, not transactions or spans or anythign else, are collected by agent

**Steps to reproduce** :

1. fresh install of the agent, follow these docs: [https://www.elastic.co/guide/en/apm/agent/python/3.x/configuration.html](https://www.elastic.co/guide/en/apm/agent/python/3.x/configuration.html)
2. Configuration in python app:  
app.config['ELASTIC\_APM'] = { 'SERVICE\_NAME' : os.getenv('ELASTIC\_APM\_SERVICE\_NAME'), 'SECRET\_TOKEN' : os.getenv('ELASTIC\_APM\_TOKEN'), 'SERVER\_URL' : os.getenv('ELASTIC\_APM\_SERVER\_URL'), 'CAPTURE\_BODY' : 'all', 'TRANSACTION\_SAMPLE\_RATE' : os.getenv('ELASTIC\_APM\_TRANSACTION\_SAMPLE\_RATE') }

apm = ElasticAPM(app)  
3. make a request to the app and look at the apm-\* index for new records

**Provide logs and/or server output (if relevant)**:  
Example document outputted:

{  
"\_index": "apm-6.6.0-2019.03.27",  
"\_type": "doc",  
"\_id": "Ohd-wGkB-IkqUmN3P-vj",  
"\_version": 1,  
"\_score": null,  
"\_source": {  
"@timestamp": "2019-03-27T18:51:26.790Z",  
"system": {  
"process": {  
"memory": {  
"rss": {  
"bytes": 41844736  
},  
"size": 52469760  
},  
"cpu": {  
"total": {  
"norm": {  
"pct": 0.004550227511375569  
}  
}  
}  
},  
"memory": {  
"actual": {  
"free": 395153408  
},  
"total": 2095869952  
},  
"cpu": {  
"total": {  
"norm": {  
"pct": 0.151907595379769  
}  
}  
}  
},  
"context": {  
"process": {  
"pid": 7,  
"argv": [  
"/usr/local/bin/flask",  
"run",  
"--host=0.0.0.0",  
"--port=443"  
],  
"ppid": 1  
},  
"system": {  
"hostname": "manifest-manifest-manager-6b4cd46f9b-gcflc",  
"ip": "10.1.1.22",  
"platform": "linux",  
"architecture": "x86\_64"  
},  
"service": {  
"agent": {  
"name": "python",  
"version": "4.2.1"  
},  
"framework": {  
"name": "flask",  
"version": "1.0.2"  
},  
"name": "manifest-manager-local",  
"runtime": {  
"name": "CPython",  
"version": "3.7.2"  
},  
"language": {  
"name": "python",  
"version": "3.7.2"  
}  
}  
},  
"beat": {  
"hostname": "apm-server-f7779dc8d-wr98r",  
"name": "apm-server-f7779dc8d-wr98r",  
"version": "6.6.0"  
},  
"host": {  
"name": "apm-server-f7779dc8d-wr98r"  
},  
"processor": {  
"name": "metric",  
"event": "metric"  
},  
"docker": {  
"container": {  
"id": "cab692093b85e94e728d3ae4967f5605e015bb0df08bb24821aee66cc4604346"  
}  
}  
},  
"fields": {  
"view errors": [  
"manifest-manager-local"  
],  
"error id icon": [  
null  
],  
"@timestamp": [  
"2019-03-27T18:51:26.790Z"  
]  
},  
"highlight": {  
"context.service.name": [  
"@kibana-highlighted-field@manifest-manager-local@/kibana-highlighted-field@"  
]  
},  
"sort": [  
1553712686790  
]  
}

---

<div class="post-metadata">

**Author:** ![drinnird](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@drinnird](https://discuss.elastic.co/u/drinnird)\
**Post date:** [April 8, 2019, 2:26pm UTC](https://discuss.elastic.co/t/apm-agent-v-4-2-1-only-collects-metrics-not-transations-for-flask-1-x/175636/2 "2019-04-08T14:26:29Z")

</div>

Hello! The solution turned out to be:  
turn off Flask debug mode.

Maybe update the docs to make that much more clear?

---

<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:** [April 29, 2019, 10:26am UTC](https://discuss.elastic.co/t/apm-agent-v-4-2-1-only-collects-metrics-not-transations-for-flask-1-x/175636/3 "2019-04-29T10:26:34Z")

</div>

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