Open zhoufenqin opened 2 years ago
Thanks @zhoufenqin!
This might be a bug in that it should not assume the extension library is a GZIP archive, however I don't believe the extensions mechanism is intended to be able to override the New Relic Agent jar itself.
The docs describe this functionality as a way to provide support for additional features/libraries via supported modules - see https://docs.newrelic.com/docs/apm/agents/java-agent/instrumentation/extension-additional-instrumentation-modules/#install
I will label this as a bug to track the fix that is required to support extensions as .jar
files, since the above doc lists all supported modules as this type.
I don't believe the extensions mechanism is intended to be able to override the New Relic Agent jar itself.
100%
The docs describe this functionality as a way to provide support for additional features/libraries via supported modules - see https://docs.newrelic.com/docs/apm/agents/java-agent/instrumentation/extension-additional-instrumentation-modules/#install https://github.com/paketo-buildpacks/appdynamics also has this problem, have I misconfigured something, or is there a bug?
Sorry, this is not your fault, it is not documented so it's an issue on our end. This functionality is kind of similar to external Tomcat config. The buildpack expects a tar of the New Relic extensions (App Dynamics extensions work the same way). It extracts that out as a layer in the container, then it sets -Dnewrelic.config.extensions.dir
which allows the New Relic agent to find that extension. There is an expectation that the downloaded file is a tar file. What is extracted from the TAR File ends up in the layer and is essentially the root of -Dnewrelic.config.extensions.dir
.
I will say that this method of downloading a TAR, extracting, and installing is basically a carry-over from the older Cloud Foundry Java buildpack. I don't personally think this method of providing additional configuration fits well in the K8s world. It requires you bundle and host files on an HTTP server, those are then downloaded and installed at buildtime. It can work, but it's not particularly convenient on K8s. In K8s, it's easier and more flexible to use config maps or volume mounts to bring additional configuration and extensions into the container. That maps better into K8s primitives and it's also more flexible as you can do it at runtime, instead of build time. We don't have any specific plans but I hope we can transition away from using these extension TARs. For now, you are welcome to use them if it suits your purpose and we'll obviously provide adequate transition periods if we do end up making changes.
Having said all that, if you want to override from where the New Relic agent is installed please take a look at dependency mappings. A dependency mapping will allow you to override the location from which a dependency is installed.
@pivotal-david-osullivan Any progress in supporting .jar
extensions? I would like to employ it for pulling in https://github.com/newrelic/newrelic-java-kotlin-coroutines release artifacts.
When I didn't add
BP_NEW_RELIC_EXT_{xxx}
during the build, an app can be built successfully.The agent shown in container
But when I specify a new relic agent version, even if it is the same version as the buildpack.toml in new-relic buildpacks, the build will be failed, and the build logs show
https://github.com/paketo-buildpacks/appdynamics also has this problem, have I misconfigured something, or is there a bug?
Expected Behavior
The configured new-relic version can work
Current Behavior
The configured new-relic version can't work
Possible Solution
Steps to Reproduce
1.
Motivations