With the New Relic dashboards API you can use NerdGraph to build your dashboards. This document explains the different types of widgets you can add to your dashboards, and how to create and get them using the API.
Widget schema and types
The widget GraphQL schema for query and mutation outputs looks like this:
type Widget { id visualization layout title linkedEntities configuration rawConfiguration}
Where:
id
: The id of the widget.visualization
: The widget’s visualization type, as a string. For example:viz.line
,viz.area
. See the examples below.layout
: The widget's position and size in the dashboard. The maximum amount of columns is 12.title
: The title of the widget.linkedEntities
: Dashboard Entities related to the widget. Currently it only supports dashboard entities. It is used by the facet linking feature.configuration
: The typed configuration of the widget. It’s a conveniently typed GraphQL representation of the most common widgets: area, bar, billboard, line, markdown, pie, and table.rawConfiguration
: The untyped configuration of the widget. It’s a free-form way (JSON scalar) of storing widget properties not covered by the typed configuration such as heatmap, histogram, bullet, funnel, etc. In this caseconfiguration
is null andrawConfiguration
holds all the data required by the widget.
Types of widgets
The dashboards API supports typed and untyped widgets:
Typed widget definitions
Area
Area supports multiple nrql queries.
Widget data element | Description |
---|---|
Integer | Source account to fetch data from. |
String | The NRQL query that provides the data for the widget. |
Bar
Widget data element | Description |
---|---|
Integer | Source account to fetch data from. |
String | The NRQL query that provides the data for the widget. |
Billboard
Widget data element | Description |
---|---|
Integer | Source account to fetch data from. |
String | The NRQL query that provides the data for the widget. |
[Object] | Optional. Array of thresholds to categorize the results of the query in different groups:
|
Line
Line supports multiple nrql queries.
Widget data element | Description |
---|---|
Integer | Source account to fetch data from. |
String | The NRQL query that provides the data for the widget. |
Markdown
Widget data element | Description |
---|---|
String | Content to be added in the markdown widget. |
Pie
Widget data element | Description |
---|---|
Integer | Source account to fetch data from. |
String | The NRQL query that provides the data for the widget. |
Table
Widget data element | Description |
---|---|
Integer | Source account to fetch data from. |
String | The NRQL query that provides the data for the widget. |
Untyped widget definitions
Area (predefined metrics)
Widget data element | Description |
---|---|
Long | Duration of the requested time window, in milliseconds.
|
Long | Optional. End of the time window, in milliseconds. |
[Integer] | Array of source agent Ids to fetch data from. |
[Object] | For |
String | Type of the predefined chart. It can be: |
Bullet
Widget data element | Description |
---|---|
Integer | Source account to fetch data from. |
String | The NRQL query that provides the data for the widget. |
Float | Goal against which all query results are compared to. |
Event feed
Widget data element | Description |
---|---|
Integer | Source account to fetch data from. |
String | The NRQL query that provides the data for the widget. |
Funnel
Widget data element | Description |
---|---|
Integer | Source account to fetch data from. |
String | The NRQL query that provides the data for the widget. |
Heatmap
Widget data element | Description |
---|---|
Integer | Source account to fetch data from. |
String | The NRQL query that provides the data for the widget. |
Histogram
Widget data element | Description |
---|---|
Integer | Source account to fetch data from. |
String | The NRQL query that provides the data for the widget. |
Inventory
Widget data element | Description |
---|---|
Integer | Source account to fetch data from. |
Object | Map of the filters to be applied to the infrastructure sources. |
[String] | List of the infrastructure sources to get data from. For more information see our docs on how inventory entries look like. |
JSON
Widget data element | Description |
---|---|
Integer | Source account to fetch data from. |
String | The NRQL query that provides the data for the widget. |
Line (metrics)
Widget data element | Description |
---|---|
Integer | Source account to fetch data from. |
Object | Optional. Additional time window to query. For example:
|
Long | Duration of the requested time window, in milliseconds.
|
Long | End of the time window, in milliseconds. |
[Integer] | Array of source agent Ids to fetch data from. |
String | Optional. Facet the data by the given attribute. It can be |
Integer | Optional. Maximum amount of series to be returned. |
[Object] | List of metrics to be fetched. |
String | Optional. Used to sort the results in descending order. |
Service map
Widget data element | Description |
---|---|
Integer | Source account to fetch data from. |
[Object] | Optional. An array of additional entities to include. The target is the entity downstream, while the source is upstream. |
[Object] | Optional. Entities with these conditions have a faded appearance in the map. |
[Object] | Optional. Entities to be excluded from the map. |
[Object] | The primary entities which start the map (most upstream). |