Request URL is not consistent with Transaction name?


#1

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?


(Benjamin Wohlwend @ APM) #2

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)?


#3

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

uwsgi.ini (unrelated code omitted):

[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):

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):

__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.