Skip to content

Ability to provide New Relic agent configuration via the User Provided Service payload #173

@davidehringer

Description

@davidehringer

The current implementation of the New Relic framework, which only allows for license key to be configured, doesn’t provide enough out of the box configurability for many deployments without forking the buildpack.

Scenarios

There are two categories of configurations that we would like to apply:

Application or Organization/Space Specific

There are various parameters we may need to apply for specific app or groups of apps (via org or space boundaries). A common example of this is applying "labels" to categorize applications. (I believe this example is similar to the tier name configuration recently added to the AppDynamics framework).

Site-wide

The standard example of this is the requirement to configure a proxy server. This could be configured in resources/new_relic_agent/newrelic.yml via a buildpack fork. But we are trying to avoid forking the buildpack for very simple configurations like this because maintaining a fork can represent maintenance burden we would like to avoid.

Proposed Implementation

While there are very common examples of configuration parameters, providing a defined set of configurable parameters runs the risk of endlessly adding special support for specific parameters. We should be able to provide a general configuration mechanism that allows for configuring any value in the newrelic.yml. In the Java buildpack, the NewRelicAgent currently leverages the system property override mechanism to configure the New Relic agent.

You can override any setting in the newrelic.yml file by setting a system property. The system property corresponding to a given setting in the config file is setting name prefixed bynewrelic.config. For example, system property for the log_level setting is newrelic.config.log_level.
For settings nested in stanzas, prepend the stanza name to the setting name. For example, the system property for the enabled setting in the transaction_tracer stanza is newrelic.config.transaction_tracer.enabled.

Leveraging this feature and by adding support for additional credentials payload values could provide a generic way to support configurability. The algorithm could be the following. For any value found in the credentials payload, add a system property for that entry. For example, the credentials payload of

"credentials": {
  “license_key": “xxxxx”,
  “proxy_host": “my-proxy.com",
  “proxy_port": “80",
  “labels": “Data Center: Primary, Environment: Performance, Business Unit: My BU"
}

the following system properties would be added:

-Dnewrelic.config.license_key=“xxxxx”
-Dnewrelic.config.proxy_host=“my-proxy.com”
-Dnewrelic.config.proxy_port=“80”
-Dnewrelic.config.labels=“Data Center: Primary, Environment: Performance, Business Unit: My BU”

It appears as though this could be added to the NewRelicAgent.release method in a fairly straightforward manner.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions