Skip to content

Commit

Permalink
chore: add language identifiers, remove dead link
Browse files Browse the repository at this point in the history
link to `#substitution-format` went nowhere, maybe linking this doc would be helpful but I just removed it for now
- https://docs.newrelic.com/docs/alerts-applied-intelligence/notifications/message-templates/#handlebars-syntax
  • Loading branch information
brnhensley committed Apr 29, 2024
1 parent ed0f988 commit eaa06fa
Showing 1 changed file with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ For some [types of conditions](#requirements), you can create a custom incident
* Define next steps
* Add metadata to downstream systems

The <DoNotTranslate>**Custom incident description**</DoNotTranslate> field allows you to use a general template structure that, when an incident is generated, [substitutes the generic sections with specific values](#substitution-format). For example, let's say you used this in a description:
The <DoNotTranslate>**Custom incident description**</DoNotTranslate> field allows you to use a general template structure that, when an incident is generated, substitutes the generic sections with specific values. For example, let's say you used this in a description:

```
```handlebars
This is my condition name : {{conditionName}}
The hostname is : {{tag.fullHostname}}
```
Expand Down Expand Up @@ -71,8 +71,8 @@ You can create a custom incident description using [the dedicated field for NRQL

Here's a custom incident description template example:

```
this is my condition name : {{conditionName}}
```handlebars
This is my condition name : {{conditionName}}
The hostname is : {{tag.fullHostname}}
Owning Team: {{tag.label.owning_team}}
Product: {{tag.label.product}}
Expand All @@ -96,20 +96,20 @@ The attributes you can use in a custom incident description are a subset of attr

* Incident event attributes: For any of the [standard attributes available for use in a custom incident description](/docs/alerts-applied-intelligence/new-relic-alerts/advanced-alerts/understand-technical-concepts/incident-event-attributes), use the format `{{AN_ATTRIBUTE}}`. For example:

```
```handlebars
The target name is : {{targetName}}
```
* Tag attributes: For tags, you would use the format `{{tag.TAG_NAME}}`. There are two types of tags:

* Entity-related tags: <DoNotTranslate>**For infrastructure conditions only.**</DoNotTranslate> You can find available [entity-related tags](/docs/new-relic-one/use-new-relic-one/core-concepts/tagging-use-tags-organize-group-what-you-monitor#) by going to the [entity explorer](/docs/new-relic-one/use-new-relic-one/ui-data/new-relic-one-entity-explorer-view-performance-across-apps-services-hosts) and looking under a service's <DoNotTranslate>**Metadata and tags**</DoNotTranslate>, or by viewing incident details. Here's an example of using tags in a custom incident description:

```
```handlebars
The AWS region is : {{tag.aws.awsRegion}}
Responsible team : {{tag.label.owning_team}}
```
* Facet clause tags: <DoNotTranslate>**For NRQL conditions only.**</DoNotTranslate> If a NRQL condition uses a `FACET` clause, you can use `tag` formatting to use those values in your custom incident description. For example, if the NRQL query included `FACET hostName, cluster`, you could then use this:

```
```handlebars
The host is : {{tag.hostName}}
The cluster is : {{tag.cluster}}
```
Expand All @@ -122,19 +122,27 @@ You can create a custom incident description on a NRQL alert condition through a

Here's an empty mutation template:

```
```graphql
mutation {
alertsNrqlConditionStaticUpdate(accountId: YOUR_ACCOUNT_ID, id: "YOUR_CONDITION_ID", condition: {description: ""}) {
alertsNrqlConditionStaticUpdate(
accountId: YOUR_ACCOUNT_ID
id: "YOUR_CONDITION_ID"
condition: {description: ""}
) {
YOUR_CUSTOM_INCIDENT_DESCRIPTION
}
}
```

Here's an example mutation with a custom incident description:

```
```graphql
mutation {
alertsNrqlConditionStaticUpdate(accountId: 123456, id: "123456", condition: {description: "timestamp : {{timestamp}} \n accountId : {{accountId}} \n type : {{type}} \n event : {{event}} \n description : {{description}} \n policyId : {{policyId}} \n policyName: {{policyName}} \n conditionName : {{conditionName}} \n conditionId : {{conditionId}} \n product : {{product}} \n conditionType : {{conditionType}} \n RunbookUrl : {{runbookUrl}} \n nrqlQuery : {{nrqlQuery}} \n nrqlEventType : {{nrqlEventType}} \n targetID : {{targetId}} \n targetName : {{targetName}} \n commandLine : {{tag.commandLine}} \n entityGuid : {{tag.entityGuid}} \n entityName : {{tag.entityName}} \n fullHostname : {{tag.fullHostname}} \n instanceType : {{tag.instanceType}} \n processDisplayName : {{tag.processDisplayName}}"}) {
alertsNrqlConditionStaticUpdate(
accountId: 123456
id: "123456"
condition: {description: "timestamp : {{timestamp}} \n accountId : {{accountId}} \n type : {{type}} \n event : {{event}} \n description : {{description}} \n policyId : {{policyId}} \n policyName: {{policyName}} \n conditionName : {{conditionName}} \n conditionId : {{conditionId}} \n product : {{product}} \n conditionType : {{conditionType}} \n RunbookUrl : {{runbookUrl}} \n nrqlQuery : {{nrqlQuery}} \n nrqlEventType : {{nrqlEventType}} \n targetID : {{targetId}} \n targetName : {{targetName}} \n commandLine : {{tag.commandLine}} \n entityGuid : {{tag.entityGuid}} \n entityName : {{tag.entityName}} \n fullHostname : {{tag.fullHostname}} \n instanceType : {{tag.instanceType}} \n processDisplayName : {{tag.processDisplayName}}"}
) {
description
}
}
Expand Down

0 comments on commit eaa06fa

Please sign in to comment.