Skip to content

Commit

Permalink
chore: capitlazie NRQL syntax & linebreaks
Browse files Browse the repository at this point in the history
per the style guide:

> Capitalize clause keywords such as FROM, SELECT, FACET, WHERE, AND, OR, AS, SINCE, ORDER BY, TIMESERIES, EXTRAPOLATE, and AUTO.

https://docs.newrelic.com/docs/style-guide/structure/code-examples/#NRQL
  • Loading branch information
brnhensley authored Jan 8, 2025
1 parent 5656ab4 commit efea9da
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions src/content/docs/service-level-management/create-slm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ Based on `Transaction` events, these SLIs are the most common for request-driven
To select an appropriate value for the duration condition, one typical practice is to select the 95 percentile duration of the responses for the last 7 or 15 days. Find this duration threshold using the [query builder](/docs/query-your-data/explore-query-data/query-builder/introduction-query-builder/), and use it to determine what you consider to be good events for your SLI:

```sql
SELECT percentile(duration, 95) FROM Transaction WHERE entityGuid = '{entityGuid}' SINCE 7 days ago LIMIT MAX
SELECT percentile(duration, 95) FROM Transaction
WHERE entityGuid = '{entityGuid}' SINCE 7 days ago LIMIT MAX
```

<DNT>
Expand Down Expand Up @@ -186,7 +187,8 @@ Based on OpenTelemetry spans, these SLIs are the most common for request-driven

```sql
FROM Span
WHERE entity.guid = '{entityGuid}' AND (span.kind IN ('server', 'consumer') OR kind IN ('server', 'consumer'))
WHERE entity.guid = '{entityGuid}' AND (span.kind IN ('server', 'consumer')
OR kind IN ('server', 'consumer'))
```

Where `{entityGuid}` is the service's GUID.
Expand All @@ -197,7 +199,8 @@ Based on OpenTelemetry spans, these SLIs are the most common for request-driven

```sql
FROM Span
WHERE entity.guid = '{entityGuid}' AND (span.kind IN ('server', 'consumer') OR kind IN ('server', 'consumer')) AND otel.status_code = 'ERROR'
WHERE entity.guid = '{entityGuid}' AND (span.kind IN ('server', 'consumer')
OR kind IN ('server', 'consumer')) AND otel.status_code = 'ERROR'
```

Where `{entityGuid}` is the service's GUID.
Expand All @@ -215,7 +218,9 @@ Based on OpenTelemetry spans, these SLIs are the most common for request-driven
To select an appropriate value for the duration condition, one typical practice is to select the 95 percentile duration of the responses for the last 7 or 15 days. Find this duration threshold using the [query builder](/docs/query-your-data/explore-query-data/query-builder/introduction-query-builder/), and use it to determine what you consider to be good events for your SLI:

```sql
SELECT percentile(duration.ms, 95) FROM Span WHERE entityGuid = '{entityGuid}' AND (span.kind IN ('server', 'consumer') OR kind IN ('server', 'consumer')) SINCE 7 days ago LIMIT MAX
SELECT percentile(duration.ms, 95) FROM Span
WHERE entityGuid = '{entityGuid}' AND (span.kind IN ('server', 'consumer')
OR kind IN ('server', 'consumer')) SINCE 7 days ago LIMIT MAX
```

<DNT>
Expand All @@ -224,7 +229,8 @@ Based on OpenTelemetry spans, these SLIs are the most common for request-driven

```sql
FROM Span
WHERE entity.guid = '{entityGuid}' AND (span.kind IN ('server', 'consumer') OR kind IN ('server', 'consumer'))
WHERE entity.guid = '{entityGuid}' AND (span.kind IN ('server', 'consumer')
OR kind IN ('server', 'consumer'))
```

Where `{entityGuid}` is the service's GUID.
Expand All @@ -235,7 +241,8 @@ Based on OpenTelemetry spans, these SLIs are the most common for request-driven

```sql
FROM Span
WHERE entity.guid = '{entityGuid}' AND (span.kind IN ('server', 'consumer') OR kind IN ('server', 'consumer')) AND duration.ms < {duration}
WHERE entity.guid = '{entityGuid}' AND (span.kind IN ('server', 'consumer')
OR kind IN ('server', 'consumer')) AND duration.ms < {duration}
```

* Where `{entityGuid}` is the service's GUID.
Expand Down Expand Up @@ -448,8 +455,8 @@ The following SLIs are based on Google's Browser Core Web Vitals.

If you’d like to create separate SLIs to track CLS in desktop and mobile devices separately, add one of these clauses at the end of the field:

* `and deviceType = 'Mobile'`
* `and deviceType = 'Desktop'`
* `AND deviceType = 'Mobile'`
* `AND deviceType = 'Desktop'`

<DNT>
**Good events fields**
Expand All @@ -465,14 +472,14 @@ The following SLIs are based on Google's Browser Core Web Vitals.

If you’ve decided to create separate SLIs to track CLS in desktop and mobile devices separately when you defined the valid events query, add this clause at the end of the field:

* `and deviceType = 'Mobile'`
* `and deviceType = 'Desktop'`
* `AND deviceType = 'Mobile'`
* `AND deviceType = 'Desktop'`

To determine a realistic number to select for `{cumulativeLayoutShift}` in your environment, one typical practice is to select the 75th percentile of page loads for the last 7 or 15 days, segmented across mobile and desktop devices. Find it by using the query builder:

```sql
SELECT percentile(cumulativeLayoutShift, 95) FROM PageViewTiming
WHERE entityGuid = '{entityGuid}' since 7 days ago limit max facet deviceType
WHERE entityGuid = '{entityGuid}' SINCE 7 days ago LIMIT MAX FACET deviceType
```
</Collapser>
</CollapserGroup>
Expand Down Expand Up @@ -622,10 +629,10 @@ To create service levels, follow these steps:

```sql
FROM Metric
SELECT getField(`newrelic.goldenmetrics.synth.monitor.medianDurationS`, count) as 'Valid'
SELECT getField(`newrelic.goldenmetrics.synth.monitor.medianDurationS`, count) AS 'Valid'

FROM Metric
SELECT getCdfCount(`newrelic.goldenmetrics.synth.monitor.medianDurationS`, 0.5) as 'Good'
SELECT getCdfCount(`newrelic.goldenmetrics.synth.monitor.medianDurationS`, 0.5) AS 'Good'
```

You can also use wildcards in your SLI queries, here's an example:
Expand Down

0 comments on commit efea9da

Please sign in to comment.