Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Name of the app in .net core config

dotnetcore

#1

We have an docker image that will be deployed to both non prod and prod. and we wanted to have different names for each environment. How can i achieve this in .Net core (tried adding config value in appsettting.nonprod.json “NewRelic.AppName”: “Test” which did not work) @ebeach


#2

You can name your .NET apps using the newrelic.config or the NEW_RELIC_APP_NAME environment variable before running your application.

Because this is a docker image, I’d recommend making the change in your dockerfile so that different environments build images with different appnames. You can find an example dockerfile using the environment variable to set the name here:

https://docs.newrelic.com/docs/agents/net-agent/installation/install-net-core-agent-docker#example-linux-dockerfile

Note that this environment variable needs to be set and picked up by your application at runtime.


#3

Thanks for the reply.

We dont have different images for different environments, we build the image once and use it in multiple environments. How do i approach to have different names per environment in that scenario ? @beastman


#4

You can set environment variables like the NEW_RELIC_APP_NAME at runtime with Docker using the -e flag:

docker run -e "NEW_RELIC_APP_NAME=someappnamehere"