• /
  • EnglishEspañol日本語한국어Português
  • EntrarComeçar agora

NerdGraph tutorial: Create and configure dashboard widgets

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 case configuration is null and rawConfiguration 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

accountId

Integer

Source account to fetch data from.

query

String

The NRQL query that provides the data for the widget.

Bar

Widget data element

Description

accountId

Integer

Source account to fetch data from.

query

String

The NRQL query that provides the data for the widget.

Billboard

Widget data element

Description

accountId

Integer

Source account to fetch data from.

query

String

The NRQL query that provides the data for the widget.

thresholds

[Object]

Optional. Array of thresholds to categorize the results of the query in different groups:

  • alertSeverity: It can be NOT_ALERTING, WARNING, and CRITICAL.
  • value: Threshold value for the alerting group.

Line

Line supports multiple nrql queries.

Widget data element

Description

accountId

Integer

Source account to fetch data from.

query

String

The NRQL query that provides the data for the widget.

Markdown

Widget data element

Description

text

String

Content to be added in the markdown widget.

Pie

Widget data element

Description

accountId

Integer

Source account to fetch data from.

query

String

The NRQL query that provides the data for the widget.

Table

Widget data element

Description

accountId

Integer

Source account to fetch data from.

query

String

The NRQL query that provides the data for the widget.

Untyped widget definitions

Area (predefined metrics)

Widget data element

Description

duration

Long

Duration of the requested time window, in milliseconds.

  • When provided with endTime, the time window is set to the last x milliseconds ending at the specified time.
  • If endTime is null, the time window is set to the last x milliseconds ending now.

endTime

Long

Optional. End of the time window, in milliseconds.

entityIds

[Integer]

Array of source agent Ids to fetch data from.

metrics

[Object]

For type SCOPE_BREAKDOWN only. List of metrics to be fetched.

type

String

Type of the predefined chart. It can be: APPLICATION_BREAKDOWN, BACKGROUND_BREAKDOWN, BROWSER_BREAKDOWN, GC_RUNS_BREAKDOWN, SCOPE_BREAKDOWN, SOLR_BREAKDOWN.

Bullet

Widget data element

Description

accountId

Integer

Source account to fetch data from.

query

String

The NRQL query that provides the data for the widget.

limit

Float

Goal against which all query results are compared to.

Event feed

Widget data element

Description

accountId

Integer

Source account to fetch data from.

query

String

The NRQL query that provides the data for the widget.

Funnel

Widget data element

Description

accountId

Integer

Source account to fetch data from.

query

String

The NRQL query that provides the data for the widget.

Heatmap

Widget data element

Description

accountId

Integer

Source account to fetch data from.

query

String

The NRQL query that provides the data for the widget.

Histogram

Widget data element

Description

accountId

Integer

Source account to fetch data from.

query

String

The NRQL query that provides the data for the widget.

Inventory

Widget data element

Description

accountId

Integer

Source account to fetch data from.

filters

Object

Map of the filters to be applied to the infrastructure sources.

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

accountId

Integer

Source account to fetch data from.

query

String

The NRQL query that provides the data for the widget.

Line (metrics)

Widget data element

Description

accountId

Integer

Source account to fetch data from.

compareWith

Object

Optional. Additional time window to query. For example:

{
offsetDuration: 86400000
presentation: { "#c001", "Yesterday" }
}

duration

Long

Duration of the requested time window, in milliseconds.

  • When provided with endTime, the time window is set to the last x milliseconds ending at the specified time.
  • If endTime is null, the time window is set to the last x milliseconds ending now.

endTime

Long

End of the time window, in milliseconds.

entityIds

[Integer]

Array of source agent Ids to fetch data from.

facet

String

Optional. Facet the data by the given attribute. It can be host, agent, application, or mobile_version.

limit

Integer

Optional. Maximum amount of series to be returned.

metrics

[Object]

List of metrics to be fetched.

orderBy

String

Optional. Used to sort the results in descending order.

Service map

Widget data element

Description

accountId

Integer

Source account to fetch data from.

additionalEntities

[Object]

Optional. An array of additional entities to include. The target is the entity downstream, while the source is upstream. Type, vendor, target, and source are optional.

deemphasizedConditions

[Object]

Optional. Entities with these conditions have a faded appearance in the map.

hiddenEntities

[Object]

Optional. Entities to be excluded from the map.

primaryEntities

[Object]

The primary entities which start the map (most upstream).

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.