Step 1: Downloading the latest SDK jar:
First things first, let’s download the SDK jar for our 2.0.0 release. The SDK is currently on a public branch in our Git repository. We have upgraded all of our own Java plugins to utilize this new jar already, but we decided to only merge it into master after the community (i.e. you) has a chance to give their feedback.
Link to SDK repository:
Direct link to download latest SDK jar:
*** Step 2 - Writing the plugin ***
Quick summary of necessary changes from V1:
- Your jar file must be located in the root folder of your plugin and must be named ‘plugin.jar’
- All configuration files should be located in a directory named ‘config’ off the root of your plugin.
- Inside the ‘config’ directory, there should be a JSON file named ‘newrelic.json’
- Inside the ‘config’ directory, there should be a JSON file named ‘plugin.json’
- A new Logger class is provided in the SDK to give you more flexibility around logging in your plugin
*What is the ‘newrelic.json’ file? *
Going forward, all Platform plugins will contain a ‘newrelic.json’ file in their config directory. This file will contain configuration options that are standard across all plugins (e.g. license_key, log_level).
What is the ‘plugin.json’ file?
Previously every plugin developer could create their own configuration file name and format for gathering plugin-specific configuration options (e.g. hosts, ports, user/pass combos), the new ‘plugin.json’ file in the plugin’s config directory is meant to move all of these configurations into a well-defined location so consumers can easily locate it and get up and running faster.
What are the new logging changes?
Previously the logging situation was very limiting, you’d have to initialize a New Relic SDK object (Context) in order to utilize the logger. We’ve switched the logger to something much more standard, and hopefully more convenient for you:
// Import the logger class import com.newrelic.metrics.publish.util.Logger; ... // Create a class variable for the logger private static final Logger logger = Logger.getLogger(MyClass.class); ... // In a method you'd like to log logger.debug("Stuff that is helpful for a developer to debug."); logger.info("Useful information for the end user."); logger.warn("Something went wrong, but it might be okay."); logger.error("Something went wrong and it's probably not okay."); logger.fatal("Something went wrong and we are crashing hard."); ...
The best references for writing a new plugin or migrating an existing one is to reference our new SDK’s README documentation or checkout one of our published plugins, but please do not hesitate to reach out to us through the forums if you have any questions or concerns.
New SDK README information
New Relic Plugins for Reference
Step 3: Provide Feedback:
We are using the New Relic forums to gather feedback from you to make things as simple as possible. All you’ll need to do is create a post with your feedback under the “Platform SDK Beta” category. Anything you’d like us to know, we’d like to hear (e.g. the SDK is easy or hard to use, the experience is confusing, the new requirements are causing you friction) all of it will help us plan the next steps for this project!
Thank you for taking the time!
New Relic Platform Team