'How to use different environment names in New Relic configuration

New Relic configuration lists four environment names, ("development", "test", "staging", "production"). New relic also provides examples for app_name (app name with environment in parenthesis).

Can these environment names be changed, and what is needed to rename to different environment names in New Relic configuration?

We use different names for our environments, ("dev", "qa", "stage", "prod"). We use environment variables (twelve-factor) to configure the system, so the plan is to set NEW_RELIC_ENVIRONMENT="qa" (et al).

[newrelic:development]
app_name = app-development
monitor_mode = false

[newrelic:test]
app_name = app-test
monitor_mode = false

[newrelic:staging]
app_name = app-staging
high_security = true
monitor_mode = true

[newrelic:production]
app_name = app-production
high_security = true
monitor_mode = true

Do we need to do anything other than rename these environment names?

[newrelic:dev]
app_name = app-dev
monitor_mode = false

[newrelic:qa]
app_name = app-qa
monitor_mode = false

[newrelic:stage]
app_name = app-stage
high_security = true
monitor_mode = true

[newrelic:prod]
app_name = app-prod
high_security = true
monitor_mode = true

Also, what is the app_name used for?



Solution 1:[1]

Those names are only examples. You can change the names of the environments as you wish.

But you do need to tell the agent which environment it should use. How to do this depends on the agent. The instructions should be in the default configuration file.

Looks like you are using the Python agent. At the end of the file you'll find the snippet:

# The application environments. These are specific settings which
# override the common environment settings. The settings related to a
# specific environment will be used when the environment argument to the
# newrelic.agent.initialize() function has been defined to be either
# "development", "test", "staging" or "production".

So besides changing the config file, you'll have to pass the environment ("dev", "qa", "stage", "prod") to the newrelic.agent.initialize() function.

app_name is the name that will show on NR's UI. You can have multiple servers with the same app name and you'll be able to see them aggregated or separately.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1