diff --git a/src/data/nav.yml b/src/data/nav.yml index 017850531..f256f4252 100644 --- a/src/data/nav.yml +++ b/src/data/nav.yml @@ -56,6 +56,8 @@ url: '/build-apps/publish-deploy' - title: Permissions for managing apps url: '/build-apps/permission-manage-apps' + - title: Attach your Nerdlet to your entities + url: '/build-apps/attach-nerdlet-to-entities' - title: Map pageviews by region url: '/build-apps/map-pageviews-by-region' - title: Add a time picker diff --git a/src/images/build-an-app/entity-nerdlet.png b/src/images/build-an-app/entity-nerdlet.png new file mode 100644 index 000000000..143cfc274 Binary files /dev/null and b/src/images/build-an-app/entity-nerdlet.png differ diff --git a/src/images/build-an-app/nav-to-apm-service.png b/src/images/build-an-app/nav-to-apm-service.png new file mode 100644 index 000000000..3b118e0e7 Binary files /dev/null and b/src/images/build-an-app/nav-to-apm-service.png differ diff --git a/src/images/build-an-app/nav-to-apm.png b/src/images/build-an-app/nav-to-apm.png new file mode 100644 index 000000000..9569f6cc8 Binary files /dev/null and b/src/images/build-an-app/nav-to-apm.png differ diff --git a/src/images/build-an-app/nerdlet-attached-to-app.png b/src/images/build-an-app/nerdlet-attached-to-app.png new file mode 100644 index 000000000..17ac76968 Binary files /dev/null and b/src/images/build-an-app/nerdlet-attached-to-app.png differ diff --git a/src/markdown-pages/build-apps/attach-nerdlet-to-entities.mdx b/src/markdown-pages/build-apps/attach-nerdlet-to-entities.mdx new file mode 100644 index 000000000..5a71e7f8a --- /dev/null +++ b/src/markdown-pages/build-apps/attach-nerdlet-to-entities.mdx @@ -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' +--- + + + +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. + + + +## 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 + + + + + +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`. + + + + + +[Serve](https://developer.newrelic.com/build-apps/publish-deploy/serve/) your Nerdpack: + +```sh +cd entity-nerdlet +nr1 nerdpack:serve +``` + + + + + +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. + + + + + +Under **Your apps**, click your launcher to view your New Relic One application: + +![Click entity-nerdlet launcher](../../images/build-an-app/entity-nerdlet.png) + + + + + +## Attach your Nerdlet to entities + +You've seen how you can access your Nerdlet from a launcher. Now, access your Nerdlet from your entities. + + + + + +```json fileName=nerdlets/entity-nerdlet-nerdlet/nr1.json +{ + "schemaType": "NERDLET", + "id": "entity-nerdlet-nerdlet", + "displayName": "EntityNerdletNerdlet", + "description": "" +} +``` + + + + + + + +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. + + + + + +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. + + + + + +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. + + + + + +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. + + + + + +Choose any of your applications: + +![Navigate to APM application](../../images/build-an-app/nav-to-apm-service.png) + + + + + +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. + + + + + + + +## 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": [ + "" + ] + } + ] + } + ] + } +} +``` + +Attach your Nerdlet to every entity which has particular `accountId` _and_ uses the Python programming language: + +```json +{ + "context": { + "entities": [ + { + "tags": [ + { + "key": "accountId", + "values": [ + "" + ] + }, + { + "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 \ No newline at end of file diff --git a/src/markdown-pages/build-apps/create-an-ab-test-application/serve-app.mdx b/src/markdown-pages/build-apps/create-an-ab-test-application/serve-app.mdx index 1a299c225..9ca5926d7 100644 --- a/src/markdown-pages/build-apps/create-an-ab-test-application/serve-app.mdx +++ b/src/markdown-pages/build-apps/create-an-ab-test-application/serve-app.mdx @@ -68,6 +68,12 @@ Select your launcher to see your root Nerdlet and its default welcome message: ![Your application's default welcome message](../../../images/ab-test/default-message.png) + + +Here, you've seen how to access your Nerdlet from a launcher. If you want your Nerdlet closer to your data, you can also [attach your Nerdlet to New Relic entities](/build-apps/attach-nerdlet-to-entities#attach-your-nerdlet-to-entities). + + +