Reputation: 11
I've currently got a New Relic service bound to a Java app running under Liberty in Bluemix.
We are using a blue green deployment method to minimize down time when pushing a new version and as a consequence of this, the app name has a version suffix.
The app with version is being reported in New Relic. When we push a new version, New Relic picks this up as a different instance ie:
This breaks up the reporting timeline. If something is deployed in the morning, I cannot compare the data from the day before with today's set.
What I would like to do is override the app name in New Relic so that it just reports "App" with no version number. This should give me a continuous timeline for the app to view. (Ideally, then I would have a script issue a deployment notice to New Relic so that it can indicate this with a label.)
New relic is added and bound using CF like so:
cf cups newrelic -p '{"licenseKey":"xxxxx"}'
There does not seem to be a way to set any other parameter besides the license key.
Upvotes: 0
Views: 420
Reputation: 11
Set the NEW_RELIC_APP_NAME environment variable. You can do this on the command line using cf set-env APP_NAME ENV_VAR_NAME ENV_VAR_VALUE where ENV_VAR_NAME is NEW_RELIC_APP_NAME. This environment variable has the highest precedence which overrides the default New Relic app_name.
Upvotes: 1
Reputation: 441
Looking the the Liberty buildpack source, I see the application name gets appended to the server startup arguments as system properties.
@java_opts << "-Dnewrelic.config.app_name=#{vcap_app_name}"
One thing you could possibly try is pushing a liberty server with the same system property and see if yours would take precedence [I don't know of any way for you to insure yours would have that precedence]. From my review of the source, it does not appear there is any built-in buildpack mechanism to override the application name passed to the new relic agent. This seems like a good enhancement to add to the build pack.
Another possibility to consider. As part of the blue/green deploy, why not always deploy to the same app name (e.g. myapp) and then do an app rename at blue/green deploy time. For example:
cf rename myApp myApp_old_v2
cf push myApp ... //pushing v3
In that type of scheme, the application would always report to new relic as myApp
Upvotes: 3