NerdGraph relationships API tutorial

New Relic One provides unified access to all of the entities you monitor with New Relic. The relationships service captures how your monitored entities relate, and allows you to see these relationships using NerdGraph.

The NerdGraph relationship API captures how pairs of entities interact and how they're related. By using the API, you can troubleshoot upstream and downstream services and understand how minor issues may have larger repercussions, similar to service maps.

Relationship types

Relationship types provide additional information about how two entities are related. The supported relationship types are:

Type Description
CALLS The relationship between one service or application calling another. Used to display upstream and downstream services.
CONTAINS The relationship and hierarchical use cases common to modern and cloud infrastructure. For example, this could indicate that the HOST contains a container.
HOSTS The relationship between an application or process and the system it runs on.
SERVES The relationship between a back-end application and the browser application it returns in the response.

Read relationships of an entity

You can use the NerdGraph relationship API to read the existing relationship of your monitored entities. The following example shows how to query an entity by its specific GUID, using the NerdGraph GraphiQL explorer. For more information, see Use NerdGraph to query entities.

query{
  actor{
    entity(guid: YOUR_ENTITY_GUID){
      name
      relationships{
        source {
          entity{
            guid,
            name
          }
        }
        target {
          entity{
            guid,
            name
          }
        },
        type
      }
    }
  }
}

For more help

Recommendations for learning more: