Segment your Insights data into buckets

Segmentation allows you to facet on bucket functions to more effectively break out your data in New Relic Insights. You can group your NRQL query on numerical values into buckets that cover a range.

Create segmented NRQL query

To return segmented results, use the FACET clause to segment a buckets function in a NRQL query.

SELECT function(attribute) 
    FROM source 
    FACET buckets(attributes)

Segmenting can be used with any attribute that is stored as a numerical value in the New Relic Insights event database.

For more information, check out the New Relic University tutorial Advanced Segmentation. Or, go directly to the full online course Writing NRQL Queries.

Segmentation example

To create a chart showing total page load times segmented into ranges:

  1. Create a NRQL statement with a select statement for an attribute; for example, average(duration).
  2. Add a FACET clause that facets on buckets for the same attribute; for example, buckets(duration,10,5).

This query segments the average durations into 5 buckets, with an upper limit of 10. All values above 10 are grouped in our last bucket, “>=8.0”.

SELECT average(duration) FROM PageView 
    SINCE 1 day ago 
    FACET buckets(duration,10,5)

This query returns the following results in Insights:

Screenshot - Insights segmentation query results Here is an example of a NRQL query with segments broken out into five buckets. The top bucket will include outliers, so you may want to adjust accordingly.

For more help

Recommendations for learning more: