# Request URL is not consistent with Transaction name?

**URL:** <https://discuss.elastic.co/t/request-url-is-not-consistent-with-transaction-name/171631>\
**Category:** APM\
**Created:** [March 10, 2019, 3:35pm UTC](https://discuss.elastic.co/t/request-url-is-not-consistent-with-transaction-name/171631 "2019-03-10T15:35:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fr0der1c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fr0der1c/32/34125_2.png) [@fr0der1c](https://discuss.elastic.co/u/fr0der1c)\
**Post date:** [March 10, 2019, 3:35pm UTC](https://discuss.elastic.co/t/request-url-is-not-consistent-with-transaction-name/171631/1 "2019-03-10T15:35:54Z")

</div>

**Kibana version** : 6.6.0

**Elasticsearch version** :6.6.0

**APM Server version** :6.6.0

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

My application is a Flask web application. When I'm discovering data in Kibana, I found some documents where the `context.request.url.full` seems inconsistent with the `transaction.name`. Is this normal?

 ![WX20190310-233013%402x](https://us1.discourse-cdn.com/elastic/original/3X/b/a/ba1bf9ac73c700a913e8a0ac76a711902cbf5501.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:** [March 15, 2019, 2:14pm UTC](https://discuss.elastic.co/t/request-url-is-not-consistent-with-transaction-name/171631/2 "2019-03-15T14:14:02Z")

</div>

Hi @fr0der1c

this definitely doesn't look normal, and I don't really have an idea what could cause this. But it does look like there might be some issues with context tracking. Do you per chance use threaded workers (e.g. gunicorn with `--threads N`)?

---

<div class="post-metadata">

**Author:** ![fr0der1c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fr0der1c/32/34125_2.png) [@fr0der1c](https://discuss.elastic.co/u/fr0der1c)\
**Post date:** [March 16, 2019, 6:39am UTC](https://discuss.elastic.co/t/request-url-is-not-consistent-with-transaction-name/171631/3 "2019-03-16T06:39:45Z")

</div>

I use uWSGI with gevent (preforking+async), here is my configuration:

`uwsgi.ini` (unrelated code omitted):

```auto
[uwsgi]
# launcher
wsgi-file = server.py
callable = app

# workers
master = true
processes = 4
gevent = 100
thunder-lock = true

lazy-apps = false

```

`server.py` (unrelated code omitted):

```python
from gevent import monkey
monkey.patch_all()

import gc
from my_application import create_app

app = create_app()

```

`my_application/ __init__.py` (unrelated code omitted):

```python
__app = None

try:
    import uwsgidecorators

    @uwsgidecorators.postfork
    def init_log_handlers():
        from elasticapm.contrib.flask import ElasticAPM
        global __app

        # Elastic APM
        if __app.config['CONFIG_NAME'] in__app.config['APM_AVAILABLE_IN']:
            ElasticAPM(__app)
            logger.info('APM is inited because you are in {} mode.'.format(__app.config['CONFIG_NAME']))
except:
    pass

def create_app() -> Flask:
    app = Flask( __name__ )

    from my_application.config import get_config
    _config = get_config()
    app.config.from_object(_config)

    global __app
    __app = app

    return app

```

It might be a thread-local-related issue, but I didn't run into another similar issue except for this one.

---

<div class="post-metadata">

**Author:** ![fr0der1c](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fr0der1c/32/34125_2.png) [@fr0der1c](https://discuss.elastic.co/u/fr0der1c)\
**Post date:** [March 24, 2019, 5:03am UTC](https://discuss.elastic.co/t/request-url-is-not-consistent-with-transaction-name/171631/4 "2019-03-24T05:03:18Z")

</div>

Hi @beniwohli ,  
I can confirm this is a gevent-related issue. After removing gevent monkey-patch and removing `gevent = 100` in `uwsgi.ini`, this weird situation disappeared and spans are available again (my APM didn't have any spans since some time and I was not aware that this is related to applying gevent monkey-patch).  
I'll read the python APM agent source code and try to find the root cause. It would be nice if you can give me some hints related to the issue. Is there any other known compatibility issues in the past between APM agent and gevent?

---

<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:** [March 25, 2019, 9:04am UTC](https://discuss.elastic.co/t/request-url-is-not-consistent-with-transaction-name/171631/5 "2019-03-25T09:04:24Z")

</div>

Hey @fr0der1c

to be honest, we don't have a huge amount of experience with the agent under gevent/eventlet/etc. While we have some feedback from users that are generally happy with it, we don't officially support it yet and don't have proper test coverage for it.

One issue that I saw creeping up a couple of times was when gevent monkeypatching happened after initialization of the agent. In that case, we get an un-monkeypatched version of the threading module, which can lead to confusing results.

---

<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 15, 2019, 5:04am UTC](https://discuss.elastic.co/t/request-url-is-not-consistent-with-transaction-name/171631/6 "2019-04-15T05:04:24Z")

</div>

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