Creating multiple application names in background task

Hi team,

We have a python agent running web (wsgi) and non-web transactions (background tasks). The Web transactions are working well with multiple application names generated using server tags. The Non-web transactions are initiated as a background task however when attempting to apply multiple application names separated with a ‘;’ it comes out as a single application name.

Example Python Code:

from newrelic.api.background_task import background_task
application_names = "agg_app;sub_app" # double quote double name test
# application_names = 'agg_app;sub_app' # single quote double name test
# application_names = agg_app;sub_app # no quote double name test
# application_names = 'agg_app' # single quote single name test
# application_names = "agg_app" # double quote single name test
def function(self, data):

In the above example code the application_names with no quotes failed as expected. In all other cases (single/double quote and single/double name) a single application name was provided to APM. i.e. the ‘;’ failed to separate the application names and resulted in an application name of “agg_app;sub_app”.

What I want to happen is that the server would then provide its data in 2 APM applications agg_app and sub_app not a single one called “agg_app;sub_app”.

Naming the background task application in the config file is not an option because the config file application naming is used for the web applications and shared here with non-web applications.

Thanks in advance.

Answers to common questions:
App page:

python version is

Direct links to 3 example apps names:[end]=1499786695&tw[start]=1499700295[end]=1499786700&tw[start]=1499700300[end]=1499786757&tw[start]=1499700357

I have read through most (if not all) of the python agent documentation but feel free to link to something I may have missed.

Hi, @jared.frey: According to this document:

The application if specified can be either an application object or a string giving the name of the application. If a string is provided, it must be the exact application name and cannot be a list of application names.

1 Like

Hi Phil, thanks for responding so quickly. Can you link me to documentation or an example of how to create an application object so that I can have multiple application names for my background task?

Unfortunately I cannot. Hopefully someone else will chime in with a solution.