SaaS developer plugins

You can quickly develop plugins using the SDKs for New Relic Plugins. However, the Plugin API is a better choice in other situations. For example, you may need to:

  • Use a programming language not supported by the SDKs for New Relic Plugins.
  • Write plugins to in-house standards or as part of a larger running application.
  • Report metrics for a large number of individual accounts.

The Plugin API can be used by plugin developers to POST metrics for multiple components (instances) directly to the New Relic collectors using JSON. Each POST typically is consumed by the collector in under 3ms, so this is a very fast way to send large amounts of metric data.

New Relic licenses

In order to provide your customers with New Relic metrics via your plugin, you must have access to the New Relic license key for each individual account. You can capture this information when provisioning new customers via the New Relic Partner API, or you can provide a mechanism whereby customers can share their existing New Relic license key with you.

Metric reporting

Once you have access to the New Relic license key, your plugin can use the API for New Relic Plugins to POST metrics for multiple components (instances) using JSON. You should POST metrics for each of your accounts to New Relic no more frequently than every 60 seconds and no less than every 300 seconds.

Multiple components (instances) can include multiple metrics within a single POST, corresponding to a particular New Relic account. You can provide metrics for your SaaS users that cover many database components, web server components, cache components, message queue components, etc.

Example: Multiple accounts

Here is an example of the steps to follow in order to report metrics to New Relic Plugins for a given collection of accounts:

# Ruby language example

# Define the Plugin API endpoint URL
url = URI.parse("")

# Assuming the Account model has a scope that provides all accounts
# having a New Relic license key, fetch those accounts and iterate
# over them to POST the metrics to New Relic Plugins

Account.with_new_relic_license.each do |account|
  # Prepare an HTTP POST request
  request =

  # Set the BODY to the JSON structure containing the metrics
  request.body = account.gather_new_relic_metrics.as_json

  # Set the required headers
  request.add_field('X-License-Key', account.new_relic_license_key)
  request.add_field('Content-Type', 'application/json')
  request.delete('accept') # Need to remove the default 'Accept: */*'
  request.add_field('Accept', 'application/json')

  # Post the metric data to the New Relic Servers
  response =, url.port).start do |http|

  # Test for success
  success = JSON.parse(response.body)['status'] == 'ok'

Example: Single account

Here is a large JSON data example showing what could be sent to New Relic Plugins via HTTP POST for a single licensee. This example contains multiple metrics for multiple components or instances for a single plugin. This example represents a sample size of 60 seconds.

  "agent": {
    "host" : "",
    "pid" : 1234,
    "version" : "1.0.0"
  "components": [
      "name": "Database Server",
      "guid": "com.saas_company_name.postgresql",
      "duration" : 60,
      "metrics" : {
        "Component/Connections/Bytes received[bytes/sec]" : 200,
        "Component/Connections/Bytes sent[bytes/sec]" : 30,
        "Component/Queries/Query rate[Queries/sec]" : 10
      "name": "Cache Server",
      "guid": "com.saas_company_name.memcached",
      "duration" : 60,
      "metrics" : {
        "Component/Cache/Writes[count]" : 220,
        "Component/Cache/Hits[count]" : 300,
        "Component/Cache/Misses[count]" : 100,
        "Component/Cache/Memory/Used[bytes]" : 1000,
        "Component/Cache/Memory/Free[bytes]" : 10
      "name": "Message Queue",
      "guid": "com.saas_company_name.sidekiq",
      "duration" : 60,
      "metrics" : {
        "Component/Jobs/Queued[count]" : 2000,
        "Component/Jobs/Running[count]" : 100,
        "Component/Jobs/Failed[count]" : 10,
        "Component/Jobs/Processed[count]" : 1000000

Additional publisher details

Once your plugin has reported some data, you can edit it to include:

  • Your publisher (organization) name
  • Link to your website landing page
  • Link to your support page
  • URL to a branding image
  • Detailed description of the plugin

Note: When publishing your plugin, the Type of download field offers options for a file download or website URL. SaaS providers can enter their website landing page URL. In addition, New Relic's Connect partners can use a referral URL.

For more help

Additional documentation resources include:

Recommendations for learning more: