-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add a new doc covering entities context
- New doc: "Attach your Nerdlet to entities" - Reference in "Serve your New Relic One application"
- Loading branch information
1 parent
028d7d2
commit d4b8b59
Showing
7 changed files
with
367 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
359 changes: 359 additions & 0 deletions
359
src/markdown-pages/build-apps/attach-nerdlet-to-entities.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,359 @@ | ||
--- | ||
path: '/build-apps/attach-nerdlet-to-entities' | ||
title: 'Attach your Nerdlet to entities' | ||
template: 'GuideTemplate' | ||
description: 'Attach your Nerdlet to entities' | ||
--- | ||
|
||
<Intro> | ||
|
||
One way for users to access your Nerdlet is by creating a launcher. The launcher opens a Nerdlet from the **Apps** page in New Relic. You can also provide access to your Nerdlet from an [entity](https://docs.newrelic.com/docs/new-relic-one/use-new-relic-one/core-concepts/what-entity-new-relic/) in your account. | ||
|
||
In this guide, you'll learn how to attach your Nerdlet to your entities. | ||
|
||
</Intro> | ||
|
||
## Before you begin | ||
|
||
If you haven't already: | ||
|
||
- [Sign up](https://newrelic.com/signup/) for a New Relic account | ||
- [Install and configure the New Relic One CLI](https://one.newrelic.com/launcher/developer-center.launcher?pane=eyJuZXJkbGV0SWQiOiJkZXZlbG9wZXItY2VudGVyLmRldmVsb3Blci1jZW50ZXIifQ==) | ||
|
||
## Create a Nerdpack | ||
|
||
<Steps> | ||
|
||
<Step> | ||
|
||
Create a Nerdpack with the CLI: | ||
|
||
```sh | ||
nr1 create --type nerdpack --name entity-nerdlet | ||
``` | ||
|
||
This results in a Nerdpack, called `entity-nerdlet`, which consists of a launcher, called `entity-nerdlet-launcher`, and a Nerdlet, called `entity-nerdlet-nerdlet`. | ||
|
||
</Step> | ||
|
||
<Step> | ||
|
||
[Serve](https://developer.newrelic.com/build-apps/publish-deploy/serve/) your Nerdpack: | ||
|
||
```sh | ||
cd entity-nerdlet | ||
nr1 nerdpack:serve | ||
``` | ||
|
||
</Step> | ||
|
||
<Step> | ||
|
||
Go to [https://one.newrelic.com/?nerdpacks=local](https://one.newrelic.com/?nerdpacks=local) and navigate to **Apps**: | ||
|
||
![Navigate to Apps](../../images/ab-test/nav-to-apps.png) | ||
|
||
`?nerdpacks=local` is required to enable your locally served Nerdpacks to load in New Relic. | ||
|
||
</Step> | ||
|
||
<Step> | ||
|
||
Under **Your apps**, click your launcher to view your New Relic One application: | ||
|
||
![Click entity-nerdlet launcher](../../images/build-an-app/entity-nerdlet.png) | ||
|
||
</Step> | ||
|
||
</Steps> | ||
|
||
## Attach your Nerdlet to entities | ||
|
||
You've seen how you can access your Nerdlet from a launcher. Now, access your Nerdlet from your entities. | ||
|
||
<Tutorial> | ||
|
||
<Project> | ||
|
||
```json fileName=nerdlets/entity-nerdlet-nerdlet/nr1.json | ||
{ | ||
"schemaType": "NERDLET", | ||
"id": "entity-nerdlet-nerdlet", | ||
"displayName": "EntityNerdletNerdlet", | ||
"description": "" | ||
} | ||
``` | ||
|
||
</Project> | ||
|
||
<Steps> | ||
|
||
<Step> | ||
|
||
From inside your Nerdpack's root directory, open _nerdlets/entity-nerdlet-nerdlet/nr1.json_. This is your Nerdlet's metadata file. You'll use this file to attach your Nerdlet to entities. | ||
|
||
</Step> | ||
|
||
<Step> | ||
|
||
Add a `context` object with an `entities` array: | ||
|
||
```json fileName=nerdlets/entity-nerdlet-nerdlet/nr1.json | ||
{ | ||
"schemaType": "NERDLET", | ||
"id": "entity-nerdlet-nerdlet", | ||
"displayName": "EntityNerdletNerdlet", | ||
"description": "", | ||
"context": { | ||
"entities": [ | ||
] | ||
} | ||
} | ||
``` | ||
|
||
This tells New Relic that you want to surface your Nerdlet in an array of entity contexts. | ||
|
||
</Step> | ||
|
||
<Step> | ||
|
||
Add an entity context: | ||
|
||
```json fileName=nerdlets/entity-nerdlet-nerdlet/nr1.json | ||
{ | ||
"schemaType": "NERDLET", | ||
"id": "entity-nerdlet-nerdlet", | ||
"displayName": "EntityNerdletNerdlet", | ||
"description": "", | ||
"context": { | ||
"entities": [ | ||
{ | ||
"domain": "APM", | ||
"type": "APPLICATION" | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
Here, you've attached your Nerdlet to all _application_ entities in the _APM_ domain. | ||
|
||
</Step> | ||
|
||
<Step> | ||
|
||
Go to **APM**: | ||
|
||
![Navigate to APM](../../images/build-an-app/nav-to-apm.png) | ||
|
||
Because you're serving your Nerdpack locally, remember that you must still specify the `?nerdpacks=local` query string. | ||
|
||
</Step> | ||
|
||
<Step> | ||
|
||
Choose any of your applications: | ||
|
||
![Navigate to APM application](../../images/build-an-app/nav-to-apm-service.png) | ||
|
||
</Step> | ||
|
||
<Step> | ||
|
||
Scroll down to see your Nerdlet attached to the application: | ||
|
||
![Your Nerdlet attached to the application views](../../images/build-an-app/nerdlet-attached-to-app.png) | ||
|
||
Click this menu option and see your Nerdlet the same way you did with the launcher. | ||
|
||
</Step> | ||
|
||
</Steps> | ||
|
||
</Tutorial> | ||
|
||
## Configure your `entities` context | ||
|
||
The `context.entities` key in your Nerdlet's _nr1.json_ file specifies which entities your Nerdlet should be attached to. | ||
|
||
### Specify an entity `domain` | ||
|
||
Attach your Nerdlet to a certain entity domain by specifying the `domain` as one of the following values: | ||
|
||
- `APM`: [Application Performance Monitoring](https://docs.newrelic.com/docs/apm/) | ||
- `BROWSER`: [Browser](https://docs.newrelic.com/docs/browser/) | ||
- `INFRA`: [Infrastructure monitoring](https://docs.newrelic.com/docs/infrastructure/) | ||
- `MOBILE`: [Mobile monitoring](https://docs.newrelic.com/docs/mobile-monitoring/) | ||
- `SYNTH`: [Synthetic monitoring](https://docs.newrelic.com/docs/synthetics/) | ||
|
||
For example, attach your Nerdlet to all entities in the `APM` domain: | ||
|
||
```json | ||
{ | ||
"context": { | ||
"entities": [ | ||
{"domain": "APM"} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
Attach your Nerdlet to all entities _except_ those in a domain: | ||
|
||
```json | ||
{ | ||
"context": { | ||
"entities": [ | ||
{"domain": "!APM"} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
Attach your Nerdlet to all entities in multiple domains: | ||
|
||
```json | ||
{ | ||
"context": { | ||
"entities": [ | ||
{"domain": "APM"}, | ||
{"domain": "BROWSER"} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
### Specify an entity `type` | ||
|
||
Attach your Nerdlet to a certain entity type by specifying the `type` as one of the following values: | ||
|
||
- `APPLICATION` | ||
- `HOST` | ||
- `MONITOR` | ||
|
||
For example, attach your Nerdlet to all entities of the `APPLICATION` type: | ||
|
||
```json | ||
{ | ||
"context": { | ||
"entities": [ | ||
{"type": "APPLICATION"} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
Attach your Nerdlet to all entities _except_ those of a specified type: | ||
|
||
```json | ||
{ | ||
"context": { | ||
"entities": [ | ||
{"type": "!APPLICATION"} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
Attach your Nerdlet to every entity whose type matches one of an array of types: | ||
|
||
```json | ||
{ | ||
"context": { | ||
"entities": [ | ||
{"type": "APPLICATION"}, | ||
{"type": "MONITOR"} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
### Specify entity `tags` | ||
|
||
Attach your Nerdlet to entities that have a given [tag](https://docs.newrelic.com/docs/new-relic-one/use-new-relic-one/core-concepts/use-tags-help-organize-find-your-data/). | ||
|
||
For example, attach your Nerdlet to the entity which has a particular GUID: | ||
|
||
```json | ||
{ | ||
"context": { | ||
"entities": [ | ||
{ | ||
"tags": [ | ||
{ | ||
"key": "guid", | ||
"values": [ | ||
"<SOME ENTITY GUID>" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
Attach your Nerdlet to every entity which has particular `accountId` _and_ uses the Python programming language: | ||
|
||
```json | ||
{ | ||
"context": { | ||
"entities": [ | ||
{ | ||
"tags": [ | ||
{ | ||
"key": "accountId", | ||
"values": [ | ||
"<SOME ACCOUNT ID>" | ||
] | ||
}, | ||
{ | ||
"key": "language", | ||
"values": [ | ||
"python" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
### Combine filters | ||
|
||
When you filter the entities to which your Nerdlet will be added, you can combine `domain`, `type`, and `tags`: | ||
|
||
```json | ||
{ | ||
"context": { | ||
"entities": [ | ||
{ | ||
"domain": "APM", | ||
"type": "APPLICATION", | ||
"tags": [ | ||
{ | ||
"key": "language", | ||
"values": [ | ||
"python" | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"domain": "SYNTH", | ||
"type": "MONITOR" | ||
}, | ||
{ | ||
"domain": "BROWSER" | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
|
||
In this example, you've attached your Nerdlet to: | ||
|
||
- All APM applications whose metadata tags specify the `python` language | ||
- **AND** all Synthetic monitors | ||
- **AND** all Browser entities |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters