Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chor(Nerdgraph): Metric Normalization Rule #19415

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,346 @@
---
title: "NerdGraph tutorial: Managing the Metric Normalization Rules"
metaDescription: "Learn how to manage metric normalization rules using NerdGraph."
freshnessValidatedDate: never
---

<Callout title="preview">
We're still working on this feature, but we'd love for you to try it out!
This feature is currently provided as part of a preview program pursuant to our [pre-release policies](/docs/licenses/license-information/referenced-policies/new-relic-pre-release-policy).
</Callout>


The [NerdGraph API explorer](https://docs.newrelic.com/docs/apis/nerdgraph/get-started/introduction-new-relic-nerdgraph/) is a powerful tool designed to manage metric normalization rules for your applications. By leveraging NerdGraph mutations, you can create, edit, enable, and disable these rules directly from your New Relic account. This provides a streamlined and programmatic approach to resolve Metric Grouping Issues (MGIs).

Metric Grouping Issues arise when an application generates an excessive number of unique metrics, often from web transaction metrics named from URLs. This high cardinality can lead to performance degradation and make it difficult to analyze and monitor application performance effectively. Metric normalization rules offer a solution by grouping or filtering out metric timeslice data, thereby reducing high cardinality and preventing metric grouping issues.

Check notice on line 15 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L15

[Microsoft.Wordiness] Consider using 'too many' instead of 'excessive number'.
Raw output
{"message": "[Microsoft.Wordiness] Consider using 'too many' instead of 'excessive number'.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 15, "column": 63}}}, "severity": "INFO"}

Check notice on line 15 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L15

[new-relic.ComplexWords] Consider using 'check' or 'watch' instead of 'monitor'.
Raw output
{"message": "[new-relic.ComplexWords] Consider using 'check' or 'watch' instead of 'monitor'.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 15, "column": 246}}}, "severity": "INFO"}

The NerdGraph API Explorer acts as a single-pane-of-glass interface to manage all your metric normalization rules across multiple applications or instances. This centralized and flexible solution ensures consistency and significantly reduces the effort required to maintain these rules.

Check notice on line 17 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L17

[new-relic.ComplexWords] Consider using 'many' instead of 'multiple'.
Raw output
{"message": "[new-relic.ComplexWords] Consider using 'many' instead of 'multiple'.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 17, "column": 122}}}, "severity": "INFO"}

Check notice on line 17 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L17

[new-relic.ComplexWords] Consider using 'keep' or 'support' instead of 'maintain'.
Raw output
{"message": "[new-relic.ComplexWords] Consider using 'keep' or 'support' instead of 'maintain'.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 17, "column": 266}}}, "severity": "INFO"}


## Requirements [#review-requirements]

* You need a [New Relic account](https://newrelic.com/signup), and with that account, you can access your API user key that you need to include with [queries and mutations]((https://docs.newrelic.com/docs/apis/nerdgraph/get-started/introduction-new-relic-nerdgraph/#terminology)).

* User type and assigned roles can affect your NerdGraph permissions. For more details, see [Factors affecting access](https://docs.newrelic.com/docs/accounts/accounts-billing/account-structure/factors-affecting-access-features-data/#user-permissions).


## Mutations [#nerdgraph-mutations]

Manage your metric normalization rules with the following [NerdGraph mutations](https://docs.newrelic.com/docs/apis/nerdgraph/get-started/introduction-new-relic-nerdgraph/#terminology):



<CollapserGroup>

<Collapser
id="create-metric-normalization-rule"
title="Create a metric normalization rule"
>

Use `metricNormalizationCreateRule` mutation creates a new metric normalization rule in New Relic. This rule helps to manage the high cardinality metrics by renaming, dropping, or transforming them before they are ingested to New Relic. This helps in addressing the MGI and ensuring that your metrics are well-organized and meaningful.

Check failure on line 40 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L40

[Microsoft.Contractions] Use 'they're' instead of 'they are'.
Raw output
{"message": "[Microsoft.Contractions] Use 'they're' instead of 'they are'.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 40, "column": 206}}}, "severity": "ERROR"}

Check notice on line 40 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L40

[Microsoft.Passive] 'are ingested' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'are ingested' looks like passive voice.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 40, "column": 211}}}, "severity": "INFO"}

### Input parameters

<table>
<thead>
<tr>
<th>Attribute name</th>
<th>Data type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>accountId</td>
<td>String</td>
<td>(Required) The account ID associated with the rule.</td>
</tr>
<tr>
<td> action </td>
<td> String </td>
<td> (Required) From the drop-down list select the required action:
- `REPLACE`: Replace the `matchExpression` metrics with value defined in the `replacement`.
- `IGNORE`: Block any metrics that match the `matchExpression` from reporting to New Relic.
- `DENY_NEW_METRICS`: Prevent the creation of new metric names that match the matchExpression, but allow existing metric names to continue reporting.
</td>
</tr>
<tr>
<td>applicationGuid</td>
<td>String</td>
<td>(Optional) The unique GUID for the application in New Relic. If left blank, this becomes an account-wide rule.</td>
</tr>
<tr>
<td>enabled</td>
<td>Boolean</td>
<td>(Required) If set to `true` to enable the rule.</td>
</tr>
<tr>
<td>evalOrder</td>
<td>Integer</td>
<td>(Required) Specify the order in which the rule is applied relative to other rules. Lower the numbers, higher the evaluated priority. Recommend value is `2000`</td>

Check notice on line 80 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L80

[Microsoft.Passive] 'is applied' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'is applied' looks like passive voice.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 80, "column": 64}}}, "severity": "INFO"}
</tr>
<tr>
<td>matchExpression</td>
<td>String</td>
<td>(Required) Accepts [regex](https://regexone.com/) pattern that matches the metrics to be normalized. This field always starts with a `^` and ends with a `$`. It defines the pattern for identifying which metrics should be affected by the normalization rule. For example:

Check notice on line 85 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L85

[Microsoft.Passive] 'be normalized' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'be normalized' looks like passive voice.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 85, "column": 103}}}, "severity": "INFO"}

Check notice on line 85 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L85

[Microsoft.Passive] 'be affected' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'be affected' looks like passive voice.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 85, "column": 235}}}, "severity": "INFO"}
```^WebTransaction/Uri/RESTfulExample/users/username/[a-zA-Z0-9]+$```
The pattern `^[a-zA-Z0-9]+$` matches any string made up of lowercase characters `(a-z)`, uppercase characters `(A-Z)`, and numbers `(0-9)`. </td>

Check warning on line 87 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L87

[new-relic.RangeFormat] Use an en dash in a range of numbers.
Raw output
{"message": "[new-relic.RangeFormat] Use an en dash in a range of numbers.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 87, "column": 146}}}, "severity": "WARNING"}
</tr>
<tr>
<td>notes</td>
<td>String</td>
<td>Additional notes or comments about the normalization rule.</td>

Check notice on line 92 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L92

[new-relic.ComplexWords] Consider using 'more' or 'extra' instead of 'Additional'.
Raw output
{"message": "[new-relic.ComplexWords] Consider using 'more' or 'extra' instead of 'Additional'.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 92, "column": 17}}}, "severity": "INFO"}
</tr>
<tr>
<td>replacement</td>
<td>String</td>
<td>This field is only required when from the `action` drop-down list `REPLACE` option has selected. It replaces any metric name matched via the `matchExpression`. For example: `WebTransaction/Uri/RESTfulExample/users/username/{username}$`</td>
</tr>
<tr>
<td>terminateChain</td>
<td>Boolean</td>
<td>(Required) If set to `true`, no further rules will be applied once this rule matches a metric.</td>

Check notice on line 102 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L102

[Microsoft.Passive] 'be applied' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'be applied' looks like passive voice.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 102, "column": 64}}}, "severity": "INFO"}
</tr>
</tbody>
</table>

### Sample query

```graphql

mutation {
metricNormalizationCreateRule(
rule: {action: IGNORE, applicationGuid: "", enabled: false, matchExpression: "^WebTransaction/Uri/RESTfulExample/users/username/[a-zA-Z0-9]+$", notes: "", terminateChain: false, replacement: "WebTransaction/Uri/RESTfulExample/users/username/{username}", evalOrder: 2000}
accountId: 0
)
}

```


### Response parameters

Once the rule has been created, the response will have an additional a `ruleId` parameter. You can use the `ruleId` parameter to manage the rule.

Check notice on line 123 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L123

[Microsoft.Passive] 'been created' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'been created' looks like passive voice.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 123, "column": 19}}}, "severity": "INFO"}

Check notice on line 123 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L123

[new-relic.ComplexWords] Consider using 'more' or 'extra' instead of 'additional'.
Raw output
{"message": "[new-relic.ComplexWords] Consider using 'more' or 'extra' instead of 'additional'.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 123, "column": 59}}}, "severity": "INFO"}

```graphql

query response for create rule

```

### Sample response


```graphql

query response for create rule

```


</Collapser>

<Collapser
id="edit-metric-normalization-rule"
title="Edit a metric normalization rule">

Use the `metricNormalizationEditRule` mutation to update the value of existing existing rule using the `ruleId` parameters. It provides a flexibility to adjust the rule as per the new insights or changing requirements.

### Input parameters

<table>
<thead>
<tr>
<th>Attribute name</th>
<th>Data type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>accountId</td>
<td>String</td>
<td>(Required) The account ID associated with the rule.</td>
</tr>
<tr>
<td>action</td>
<td>String</td>
<td>(Required) From the drop-down list select the required action:
- `REPLACE`: Replace the `matchExpression` metrics with value defined in the `replacement`.
- `IGNORE`: Block any metrics that match the `matchExpression` from reporting to New Relic.
- `DENY_NEW_METRICS`: Prevent the creation of new metric names that match the matchExpression, but allow existing metric names to continue reporting.
</td>
</tr>
<tr>
<td>applicationGuid</td>
<td>String</td>
<td>(Optional) The unique GUID for the application in New Relic. If left blank, this becomes an account-wide rule.</td>
</tr>
<tr>
<td>enabled</td>
<td>Boolean</td>
<td>(Required) If set to `true` to enable the rule.</td>
</tr>
<tr>
<td>evalOrder</td>
<td>Integer</td>
<td>(Required) Specify the order in which the rule is applied relative to other rules. Lower the numbers, higher the evaluated priority. Recommend value is `2000`</td>

Check notice on line 187 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L187

[Microsoft.Passive] 'is applied' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'is applied' looks like passive voice.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 187, "column": 64}}}, "severity": "INFO"}
</tr>
<tr>
<td>id</td>
<td>String</td>
<td>(Required) The `ruleId` of the metric rule for which you want to update the value. </td>
</tr>
<tr>
<td>matchExpression</td>
<td>String</td>
<td>(Required) Accepts [regex](https://regexone.com/) pattern that matches the metrics to be normalized. This field always starts with a `^` and ends with a `$`. It defines the pattern for identifying which metrics should be affected by the normalization rule. For example:

Check notice on line 197 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L197

[Microsoft.Passive] 'be normalized' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'be normalized' looks like passive voice.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 197, "column": 40}}}, "severity": "INFO"}

Check notice on line 197 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L197

[Microsoft.Passive] 'be affected' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'be affected' looks like passive voice.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 197, "column": 172}}}, "severity": "INFO"}
```^WebTransaction/Uri/RESTfulExample/users/username/[a-zA-Z0-9]+$```
The pattern `^[a-zA-Z0-9]+$` matches any string made up of lowercase characters (a-z), uppercase characters (A-Z), and numbers (0-9). </td>

Check warning on line 199 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L199

[new-relic.RangeFormat] Use an en dash in a range of numbers.
Raw output
{"message": "[new-relic.RangeFormat] Use an en dash in a range of numbers.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 199, "column": 141}}}, "severity": "WARNING"}
</tr>
<tr>
<td>notes</td>
<td>String</td>
<td>Additional notes or comments about the normalization rule.</td>

Check notice on line 204 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L204

[new-relic.ComplexWords] Consider using 'more' or 'extra' instead of 'Additional'.
Raw output
{"message": "[new-relic.ComplexWords] Consider using 'more' or 'extra' instead of 'Additional'.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 204, "column": 17}}}, "severity": "INFO"}
</tr>
<tr>
<td>replacement</td>
<td>String</td>
<td>This field is only required when from the `action` drop-down list `REPLACE` option is selected. It replaces any metric name matched via the `matchExpression`. For example: `WebTransaction/Uri/RESTfulExample/users/username/{username}$`</td>

Check notice on line 209 in src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx

View workflow job for this annotation

GitHub Actions / vale

[vale] src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx#L209

[Microsoft.Passive] 'is selected' looks like passive voice.
Raw output
{"message": "[Microsoft.Passive] 'is selected' looks like passive voice.", "location": {"path": "src/content/docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule.mdx", "range": {"start": {"line": 209, "column": 100}}}, "severity": "INFO"}
</tr>
<tr>
<td>terminateChain</td>
<td>Boolean</td>
<td>(Required) If `true`, no further rules will apply once this rule matches a metric.</td>
</tr>
</tbody>
</table>

### Sample query

```graphql

graphql query for edit rule

```

### Response Parameters

```graphql

query response

```

### Sample Response

`Example response `


</Collapser>

<Collapser
id="enable-metric-normalization-rule"
title="Enable a metric normalization rule">

Use the `metricNormalizationEnableRule` mutation to enable a previously disabled rule using the `accountId` and `ruleId` parameters

### Input Parameters

<table>
<thead>
<tr>
<th>Attribute name</th>
<th>Data type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>accountId</td>
<td>String</td>
<td>(Required) The account ID associated with the rule.</td>
</tr>
<tr>
<td>ruleId</td>
<td>String</td>
<td>(Required) The `ruleId` of the metric rule. </td>
</tr>
</tbody>
</table>

### Example query

```graphql

mutation {
metricNormalizationEnableRule(accountId: test, ruleId: test)
}

```

### Response Parameters

`response`


### Sample response




</Collapser>

<Collapser
id="disable-metric-normalization-rule"
title="Disable a metric normalization rule">

The `metricNormalizationDisableRule` mutation to disables a previously enabled rule using the `accountId` and `ruleId` parameters.


### Input Parameters

<table>
<thead>
<tr>
<th>Attribute name</th>
<th>Data type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>accountId</td>
<td>String</td>
<td>(Required) The account ID associated with the rule.</td>
</tr>
<tr>
<td>ruleId</td>
<td>String</td>
<td>(Required) The `ruleId` of the metric rule. </td>
</tr>
</tbody>
</table>

### Example query

```graphql

mutation {
metricNormalizationDisableRule(accountId: test, ruleId: test)
}

```

### Response Parameters

```response```


### Sample response

```sample response```


</Collapser>
</CollapserGroup>
2 changes: 2 additions & 0 deletions src/nav/telemetry-data-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ pages:
path: /docs/apis/nerdgraph/examples/nerdgraph-slm
- title: Synthetic monitoring tutorial
path: /docs/apis/nerdgraph/examples/nerdgraph-synthetics-tutorial
- title: Metric normalization rules tutorial
path: /docs/apis/nerdgraph/examples/nerdgraph-metric-normalization-rule
- title: REST APIs
pages:
- title: REST API v2
Expand Down
Loading