NewRelic

What is NewRelic

New Relic is a San Francisco, California-based technology company which develops cloud-based software to help website and application owners track the performance of their services. New Relic is a Software as a Service offering that focuses on performance and availability monitoring. It uses a standardized Apdex (application performance index) score to set and rate application performance across the environment in a unified manner.

Observability Platform; New Relic is an observability platform that helps you build better software. You can bring in data from any digital source so that you can fully understand your system and how to improve it. New Relic receives data over the network and then processes and analyzes it. Users view the data through a dashboard-type interface. New Relic uses agents — small segments of code installed into the application or application environment.

What is the difference between New Relic and Splunk?

New Relic is the monitoring tool implemented to track the characteristic views based on mobile, web browsers, and desktop applications, Whereas Splunk is based on event management and handles the data to give their enterprise with alerts and event logs. It also provides high security to the data.

What is the difference between Prometheus and New Relic?

New Relic is the all-in-one web application performance tool that lets you see performance from the end user experience, through servers, and down to the line of application code. On the other hand, Prometheus is detailed as “An open-source service monitoring system and time series database, developed by SoundCloud.

Automate workflows

When building today’s complex systems, you want an easy, predictable way to verify that your configuration is defined as expected. This concept, Observability as Code, is brought to life through a collection of New Relic-supported orchestration tools, including Pulumi, Terraform, AWS CloudFormation, and a command-line interface. These tools enable you to integrate New Relic into your existing workflows, easing adoption, accelerating deployment, and returning focus to your main job and getting stuff done.

Get started with the New Relic CLI

Access the New Relic platform from the comfort of your terminal. You can use the New Relic CLI to manage entity tags, define workloads, record deployment markers, and much more. In short, you can use the CLI to automate common tasks in your DevOps workflow. This guide walks you through the essentials of New Relic CLI, from install and configuration to basic usage.

Before you begin

For this guide you just need:

  • Your New Relic user key.
  • An instrumented application in your New Relic account.

STEP 1 OF 10

Install the New Relic CLI

Download the New Relic CLI for your operating system, as described below. You can also download pre-built binaries for all platforms, including .deb and .rpm packages, and our Windows x64 .msi installer.

Linux

Using Snapcraft, run:

bashCopy

$sudo snap install newrelic-cli

macOS

Using Homebrew, run:

bashCopy

$brew install newrelic-cli

Windows

Using Scoop, run:

bashCopy

$scoop bucket add newrelic-cli https://github.com/newrelic/newrelic-cli.git
$scoop install newrelic-cli

STEP 2 OF 10

Create your New Relic CLI profile.

After you install the New Relic CLI, it’s time to create your first profile. Profiles contain credentials and settings that you can apply to any CLI command, which is useful when switching between accounts.

Run the profiles add command:

bashCopy

$ #Create the tutorial account for the US region
$newrelic profiles add --profile tutorial --apiKey YOUR_NEW_RELIC_USER_KEY -r YOUR_REGION
$ #Set the profile as defaults
$newrelic profiles default --profile tutorial

IMPORTANT

You must set the region of your New Relic account. Use -r to set either us or eu.

STEP 3 OF 10

Get your application details.

Now, add tags to the application you’ve instrumented with New Relic. Tags are key-value pairs that can help you organize and filter your entities. An entity (for example, an application) can have a maximum of 100 key-value pairs tied to it.

Before searching for your application using the New Relic CLI, write down or copy your Account ID and the name of your application in New Relic – you need both to find applications in the New Relic platform.

STEP 4 OF 10

Retrieve your application details as a JSON object.

To search for your APM application, use the apm application search command:

bashCopy

$newrelic apm application search --accountId YOUR_ACCOUNT_ID --name NAME_OF_YOUR_APP

TIP

If you get an error, check that your account ID and application name are correct.

STEP 5 OF 10

Find the guid value.

If the account ID is valid, and the application name exists in your account, apm application search yields data similar to this example:

[
  {
    "accountId": YOUR_ACCOUNT_ID,
    "applicationId": YOUR_APP_ID,
    "domain": "APM",
    "entityType": "APM_APPLICATION_ENTITY",
    "guid": "A_LONG_GUID",
    "name": "NAME_OF_YOUR_APP",
    "permalink": "https://one.newrelic.com/redirect/entity/A_LONG_GUID",
    "reporting": true,
    "type": "APPLICATION"
  }
]

Copy

When you’ve successfully searched for your application, look for the guid value. It’s a unique identifier for your application. You should copy it or write it down.

STEP 6 OF 10

Add a simple tag to your application.

Now that you have the GUID, you can point the New Relic CLI directly at your application. Adding a tag is the simplest way to try out the CLI capabilities (don’t worry, tags can be deleted by using entity tags delete).

Here, you add an environment tag to your application. Add the dev:testing tag⁠ (or any other key-value pair) to your application using the entities tags create command:

bashCopy

$newrelic entity tags create --guid YOUR_APP_GUID --tag devkit:testing

STEP 7 OF 10

Add tag sets.

What if you want to add multiple tags? Tag sets to the rescue! While tags are key-value pairs separated by colons, tag sets are comma separated lists of tags. For example:

tag1:value1,tag2:value2

To add multiple tags to your application at once, modify and run this snippet:

bashCopy

$newrelic entity tags create --guid YOUR_APP_GUID --tag tag1:test,tag2:test

IMPORTANT

Adding tags is an asynchronous operation: this means it could take a while for the tags to get created.

STEP 8 OF 10

Retrieve your application’s tags.

You’ve created and added some tags to your application, but to test that they’re working, you need to retrieve them.

Run the entity tags get command:

bashCopy

$newrelic entity tags get --guid YOUR_APP_GUID

All tags associated with your application are retrieved as a JSON array:

[
  {
    "Key": "tag1",
    "Values": ["true"]
  },
  {
    "Key": "tag2",
    "Values": ["test"]
  },
  {
    "Key": "tag3",
    "Values": ["testing"]
  }
  // ...
]

Copy

STEP 9 OF 10

Bonus step: create a deployment marker.

Deployments of applications often go wrong. Deployment markers are labels that, when attached to your application data, help you track deployments and troubleshoot what happened.

To create a deployment marker, run the apm deployment create command using the same application ID from your earlier search:

bashCopy

$newrelic apm deployment create --applicationId YOUR_APP_ID --revision $(git describe --tags --always)

STEP 10 OF 10

Check the JSON response for the revision and timestamp of the deployment.

You can build this workflow into a continuous integration or continuous deployment (CI/CD) system to indicate changes in your application’s behavior after deployments.

Here’s an example:

{
  "id": 37075986,
  "links": {
    "application": 204261368
  },
  "revision": "v1.2.4",
  "timestamp": "2020-03-04T15:11:44-08:00",
  "user": "Developer Toolkit Test Account"
}

Copy

Next steps

Have a look at all the available commands in the New Relic CLI. For example, you can create a New Relic workflow using workload create.

Follow by Email
LinkedIn
Share
WhatsApp

New Report

Close