Skip to content

Commit

Permalink
fix(bucketed): SME addition
Browse files Browse the repository at this point in the history
  • Loading branch information
zuluecho9 committed Jun 5, 2023
1 parent c2b6177 commit 3451f92
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1778,11 +1778,11 @@ SELECT histogram(duration, 10, 20) FROM PageView SINCE 1 week ago

It takes three arguments:

* Attribute name
* Maximum value of the sample range. Any outliers will appear in the final bucket.
* Total number of buckets
* Attribute name
* Maximum value of the sample range. Any outliers will appear in the final bucket.
* Total number of buckets

For more information and examples, see [Split your data into buckets](/docs/insights/nrql-new-relic-query-language/nrql-query-examples/segment-your-insights-data-buckets).
For more information and examples, see [Split your data into buckets](/docs/insights/nrql-new-relic-query-language/nrql-query-examples/segment-your-insights-data-buckets).
</Collapser>

<Collapser
Expand Down Expand Up @@ -1864,7 +1864,7 @@ SELECT histogram(duration, 10, 20) FROM PageView SINCE 1 week ago
FROM Metric SELECT count(node_filesystem_size) TIMESERIES FACET dimensions()
```

When used with a `FACET` clause, `dimensions()` produces a unique timeseries for all facets available on the event type, similar to how Prometheus behaves with non-aggregated queries.
When used with a `FACET` clause, `dimensions()` produces a unique timeseries for all facets available on the event type, similar to how Prometheus behaves with non-aggregated queries.
</Collapser>

<Collapser
Expand Down Expand Up @@ -2082,7 +2082,7 @@ SELECT histogram(duration, 10, 20) FROM PageView SINCE 1 week ago
* Use [`TIMESERIES`](#sel-timeseries) to generate a line chart with rates mapped over time.
* Omit [`TIMESERIES`](#sel-timeseries) to generate a billboard showing a single rate value averaged over time.

Here's a basic query that will generate a line chart showing the rate of throughput for <InlinePopover type="apm" /> transactions per 10 minutes over the past 6 hours:
Here's a basic query that will generate a line chart showing the rate of throughput for <InlinePopover type="apm" /> transactions per 10 minutes over the past 6 hours:

```sql
SELECT rate(count(*), 10 minute) FROM Transaction SINCE 6 hours ago
Expand Down Expand Up @@ -2324,8 +2324,9 @@ Note: `aparse()` is case-insensitive.
Use `capture()` to extract values from an attribute using a regular expression with [RE2 syntax](https://github.com/google/re2/wiki/Syntax).

It takes two arguments:
* Attribute name.
* Regular expression with capture syntax. Regex expressions in NRQL use Python-like syntax, `r'...'`.

* Attribute name.
* Regular expression with capture syntax. Regex expressions in NRQL use Python-like syntax, `r'...'`.

When capturing, use the RE2 named-capture syntax `...(?P<name> pattern )...` to capture the contained pattern, given the specified name.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,19 @@ import queriesnrqlFacetbyBucketsNRQLQueryBuilder from 'images/queries-nrql_scree

Using [NRQL](/docs/query-data/nrql-new-relic-query-language/getting-started/introduction-nrql), you can split your query results into buckets that cover certain ranges using the [`buckets` function](/docs/query-your-data/nrql-new-relic-query-language/get-started/nrql-syntax-clauses-functions/#func-buckets).

## Why use bucketed results? [#overview]

You can use the `FACET buckets()` function to group and categorize data into buckets based on specified ranges, such as for creating histograms or frequency distributions. Use it in combination with aggregating functions like [`count()`](/docs/query-your-data/nrql-new-relic-query-language/get-started/nrql-syntax-clauses-functions/#func-count) or [`sum()`](/docs/query-your-data/nrql-new-relic-query-language/get-started/nrql-syntax-clauses-functions/#func-sum) to analyze data distribution across different ranges.

Here are some use cases:
* Analyzing response times: You can use `FACET buckets()` to group response times into ranges (for example, 0-100ms, 100-200ms, 200-300ms) and calculate the count or average response time within each range. This allows you to understand the distribution of response times and identify performance issues.
* Examining request sizes: By using `FACET buckets()` on request sizes, you can categorize the size of requests into different buckets (for example, 0-1KB, 1-5KB, 5-10KB) and analyze the frequency of requests falling within each bucket. This can help you identify patterns and optimize resource allocation.
* Monitoring error rates: You can use `FACET buckets()` on error codes or error rates to group them into specific ranges. For example, you could create buckets for different HTTP error codes (like 400, 500, and others) or error rate ranges (for example, 0-1%, or 1-5%). This allows you to track your error distribution and identify areas requiring attention.
* Tracking user engagement: If you have a metric related to user engagement, such as session durations or page views, you can use `FACET buckets()` to group them into time intervals. This lets you analyze how users engage with your application or website across different time ranges.

## Create bucketed NRQL query [#segmentation]

To return bucketed results, use the `FACET buckets()` clause in a NRQL query. A bucketing query has this structure:
To return bucketed results, use the `FACET buckets()` clause in a NRQL query. A bucketed query has this structure:

```
SELECT FUNCTION(ATTRIBUTE)
Expand Down

0 comments on commit 3451f92

Please sign in to comment.