As part of New Relic's support for OpenTelemetry Protocol (OTLP) attributes can contain arrays. Arrays are a data structure that contains an ordered collection of values.
Currently only simple arrays are supported. You can query them with NRQL. To quickly verify that any data is in an array, you can use the JSON chart type to see if the data displays as an array.
Simple arrays are used to store a list of values of the same primitive type; for example, numeric, boolean, or string. An array looks like [1, 2, 3, 4, 5] or ["US", "CA", "UK"].
Array attributes are supported in the FACET clause.
The functions getfield(), length(), and contains() can be run on arrays.
The uniques(), uniqueCount(), and latest() aggregator functions are also supported.
Arrays can contain up to 64 elements.
Comparison operators such as =, !=, and IN are not supported with arrays.
Arrays cannot be aggregated with other aggregator functions such as sum(), min(), max(), etc.
Arrays cannot contain other arrays. For example, ["UK", "US", ["CA", "OR", "ATL"]] are not allowed.
Arrays cannot contain NULL.
Use the getfield() notation to get the ith element in an array.
Array indexing starts with 0.
Example: Consider a simple array, [100, 110, 90, 100, 105], stored in a durations attribute.
getfield(durations, 2) will return 90.
An alternative to the function getfield() is to use the square brackets [ ] shorthand.
Example:durations will return 105.
Use the length() function to return the number of elements in an array.
Example: Consider a simple array, countries, with the value ["US", "CA", "UK"].
length(countries) will return 3.
Use the contains() function to determine if an element is present in an array.
Example: Consider an array, guids, as ["9999-1234-9999", "3333-7890-3333", "5555-3456-555"].
contains(guids, '5555-3456-555') will return TRUE.
Consider a Transaction event type including a guids array with the value ["9999-1234-9999", "3333-7890-3333", "5555-3456-555"].
To find the count of transactions that include the "9999-1234-9999" GUID, use: