Hi there! 
We're using this decorator to record background job (using RQ) performance.
# jobs.py
ELASTIC_APM = {
'INCLUDE_PATH': ['health'],
'SERVICE_NAME': 'health-{}'.format(ENVIRONMENT),
'SERVER_URL': os.environ['APM_HOST'],
}
def apm_decorator(*apm_args):
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
client = elasticapm.Client(settings.ELASTIC_APM)
client.begin_transaction(*apm_args)
context = {
'args': args,
'kwargs': kwargs,
}
elasticapm.set_custom_context(context)
result = func(*args, **kwargs)
full_name = '{}.{}'.format(func.__module__, func.__name__)
client.end_transaction(full_name, 'SUCCESS')
return result
return wrapper
return decorator
@apm_decorator('jobs')
def real_function():
pass
@job('queue')
@apm_decorator('jobs')
def background_task():
real_function()
# other stuff
# views.py
def view(request):
background_task.delay()
(The 'jobs' arg passed to the apm_decorator puts these transactions into the "jobs" tab in APM.)
real_function is reported but nothing about background_task appears in APM so anything before or after real_function is not reported. (HTTP requests from Django are reported normally, so our APM server seems ok.)
Python 3.6.4 (also occurred in python 2.7.X), APM Agent version 3.0.0
Thanks for your help!