• EnglishEspañol日本語한국어Português
  • ログイン今すぐ開始

NerdGraph tutorial: Configure Infinite Tracing

You can configure many of the settings for Infinite Tracing with the Infinite Tracing settings app. You can also perform a variety of these configuration tasks using GraphQL. With our NerdGraph GraphiQL explorer you can execute and see the results of queries and mutations for Infinite Tracing configuration. This document explains some of the options that are available.

ヒント

If you need help getting started with GraphQL, check out Introduction to New Relic NerdGraph.

Update the random sampler on a trace observer

As described in our docs on the tail-based sampling algorithms there are several ways Infinite Tracing chooses to sample a trace. The random sampler is configurable, allowing you to control the percent of traces kept.

ヒント

If you need help about when it's appropriate to change the random filter, see Infinite Tracing: Random trace filter.

The following example shows you how to update the value from the default of 1%:

  1. Go to the NerdGraph GraphiQL explorer at api.newrelic.com/graphiql.

  2. Execute the following query to find the trace observer that contains the random sampler to modify:

    {
    actor {
    account(id: YOUR_ACCOUNT_ID) {
    edge {
    tracing {
    traceObservers {
    id
    name
    providerRegion
    status
    traceFilters {
    randomTraceFilter {
    percentKept
    }
    }
    endpoints {
    agent {
    host
    }
    }
    }
    }
    }
    }
    }
    }
  3. In the response, find the trace observer id. Here is an example where the value is 123456789:

    {
    "data": {
    "actor": {
    "account": {
    "edge": {
    "tracing": {
    "traceObservers": [
    {
    "endpoints": [
    {
    "agent": {
    "host": "YOUR_UUID_GOES_HERE.aws-us-east-1.tracing.edge.nr-data.net"
    }
    }
    ],
    "id": 123456789,
    "name": "Production Workload, US-EAST-1",
    "providerRegion": "AWS_US_EAST_1",
    "status": "CREATED",
    "traceFilters": {
    "randomTraceFilter": {
    "percentKept": 1
    }
    }
    }
    ]
    }
    }
    }
    }
    }
    }
  4. Execute a mutation using the id and the percent you want to keep. For example, to raise the value to 50% for the trace observer with id 123456789 that we found in the previous step, run the following:

    mutation {
    edgeUpdateTraceObservers(
    accountId: YOUR_ACCOUNT_ID
    traceObserverConfigs: {
    id: 123456789
    randomTraceFilterConfig: { percentKept: 50 }
    }
    ) {
    responses {
    errors {
    message
    type
    }
    traceObserver {
    traceFilters {
    randomTraceFilter {
    percentKept
    }
    }
    id
    endpoints {
    agent {
    host
    }
    }
    name
    status
    }
    }
    }
    }

Here's the response confirming the change:

{
"data": {
"edgeUpdateTraceObservers": {
"responses": [
{
"errors": null,
"traceObserver": {
"endpoints": [
{
"agent": {
"host": "YOUR_UUID_GOES_HERE.aws-us-east-1.tracing.edge.nr-data.net"
}
}
],
"id": 123456789,
"name": "Production Workload, US-EAST-1",
"status": "CREATED",
"traceFilters": {
"randomTraceFilter": {
"percentKept": 50
}
}
}
}
]
}
}
}

Update the data sources on a trace observer

While some entities can be configured to send their tracing data directly to an Infinite Tracing trace observer, others can have their data routed by New Relic to a trace observer. Currently, we support this feature for mobile, browser, and Lambda entities. In the context of Infinite Tracing, we call these entities data sources.

ヒント

If you need help about data sources in the trace observer, see Set up the trace observer.

There are three ways you can update the data sources on a trace observer:

  • ADD: If you'd like to add new data sources to the existing ones on a trace observer, use the ADD DataSourceGroupUpdateType. No data sources will be removed with this mutation.
  • REPLACE: If you'd like to replace your existing data sources on a trace observer with a new set of values, use the REPLACE DataSourceGroupUpdateType. Any existing values not in the new set will have their status set to INACTIVE.
  • REMOVE: If you'd like to remove one or more of your existing data sources on a trace observer, use the REMOVE DataSourceGroupUpdateType. Any values passed will have their status set to INACTIVE.

The following example shows you how to add to the existing data sources:

  1. Go to the NerdGraph GraphiQL explorer at api.newrelic.com/graphiql.

  2. Execute the following query to find the trace observer that contains the data source group you would like to modify:

    {
    actor {
    account(id: YOUR_ACCOUNT_ID) {
    edge {
    tracing {
    traceObservers {
    id
    name
    dataSourceGroup {
    dataSources {
    entity {
    guid
    name
    entityType
    }
    status
    }
    }
    endpoints {
    agent {
    host
    }
    }
    }
    }
    }
    }
    }
    }
  3. In the response, find the trace observer id. Here is an example with two trace observers. Let's say you want the one in US-EAST-1 called "Production services", whose id value is 259:

    {
    "data": {
    "actor": {
    "account": {
    "edge": {
    "tracing": {
    "traceObservers": [
    {
    "dataSourceGroup": {
    "dataSources": [
    {
    "entity": {
    "entityType": "BROWSER_APPLICATION_ENTITY",
    "guid": "MXxCUk9XU0VSfEFQUExJQ0FUSU9OfDE",
    "name": "My 1st Browser App"
    },
    "status": "ACTIVE"
    },
    {
    "entity": {
    "entityType": "MOBILE_APPLICATION_ENTITY",
    "guid": "MXxNT0JJTEV8QVBQTElDQVRJT058Mg",
    "name": "My 1st iOS App"
    },
    "status": "ACTIVE"
    },
    {
    "entity": {
    "entityType": "INFRASTRUCTURE_AWS_LAMBDA_FUNCTION_ENTITY",
    "guid": "MXxJTkZSQXxOQXwz",
    "name": "My 1st Lambda Function"
    },
    "status": "ACTIVE"
    }
    ]
    },
    "endpoints": [
    {
    "agent": {
    "host": "YOUR_UUID_GOES_HERE.aws-us-east-1.tracing.edge.nr-data.net"
    }
    }
    ],
    "id": 259,
    "name": "Production services"
    },
    {
    "dataSourceGroup": {
    "dataSources": [
    {
    "entity": {
    "entityType": "BROWSER_APPLICATION_ENTITY",
    "guid": "MXxCUk9XU0VSfEFQUExJQ0FUSU9OfDEw",
    "name": "My Staging Browser App"
    },
    "status": "ACTIVE"
    },
    {
    "entity": {
    "entityType": "MOBILE_APPLICATION_ENTITY",
    "guid": "MXxNT0JJTEV8QVBQTElDQVRJT058MTE",
    "name": "My Staging Android App"
    },
    "status": "ACTIVE"
    },
    {
    "entity": {
    "entityType": "INFRASTRUCTURE_AWS_LAMBDA_FUNCTION_ENTITY",
    "guid": "MXxJTkZSQXxOQXwxMg",
    "name": "My Staging Lambda Function"
    },
    "status": "ACTIVE"
    }
    ]
    },
    "endpoints": [
    {
    "agent": {
    "host": "YOUR_UUID_GOES_HERE.aws-us-west-2.tracing.edge.nr-data.net"
    }
    }
    ],
    "id": 632,
    "name": "Staging Environment"
    }
    ]
    }
    }
    }
    }
    }
    }
  4. Execute a mutation using the ID, one or more entity guids, and whether you would like to ADD, REPLACE, or REMOVE them. For example, to add a new browser app and mobile app to the Production services trace observer with id 259, which we found in the previous step, run the following:

    mutation {
    edgeUpdateTraceObservers(
    traceObserverConfigs: {
    id: 259
    dataSourceGroupConfig: {
    updateType: ADD
    guids: [
    "MXxCUk9XU0VSfEFQUExJQ0FUSU9OfDQ5"
    "MXxNT0JJTEV8QVBQTElDQVRJT058MTY"
    ]
    }
    }
    accountId: 1
    ) {
    responses {
    errors {
    message
    type
    }
    traceObserver {
    dataSourceGroup {
    dataSources {
    entity {
    guid
    name
    }
    status
    }
    }
    }
    }
    }
    }

Here's the response confirming the change:

{
"data": {
"edgeUpdateTraceObservers": {
"responses": [
{
"errors": null,
"traceObserver": {
"dataSourceGroup": {
"dataSources": [
{
"entity": {
"guid": "MXxCUk9XU0VSfEFQUExJQ0FUSU9OfDE",
"name": "My 1st Browser App"
},
"status": "ACTIVE"
},
{
"entity": {
"guid": "MXxNT0JJTEV8QVBQTElDQVRJT058Mg",
"name": "My 1st iOS App"
},
"status": "ACTIVE"
},
{
"entity": {
"guid": "MXxJTkZSQXxOQXwz",
"name": "My 1st Lambda Function"
},
"status": "ACTIVE"
},
{
"entity": {
"guid": "MXxCUk9XU0VSfEFQUExJQ0FUSU9OfDQ5",
"name": "My 2nd Browser App"
},
"status": "ACTIVE"
},
{
"entity": {
"guid": "MXxNT0JJTEV8QVBQTElDQVRJT058MTY",
"name": "My 2nd Mobile App"
},
"status": "ACTIVE"
}
]
}
}
}
]
}
}
}

Update the name on a trace observer

Here's how you can change the name of a trace observer:

  1. Go to the NerdGraph GraphiQL explorer at api.newrelic.com/graphiql.

  2. Find the trace observer whose name you'd like to update:

    {
    actor {
    account(id: YOUR_ACCOUNT_ID) {
    edge {
    tracing {
    traceObservers {
    id
    name
    providerRegion
    status
    endpoints {
    agent {
    host
    }
    }
    }
    }
    }
    }
    }
    }
  3. In the response, find the trace observer id that is returned:

    {
    "data": {
    "actor": {
    "account": {
    "edge": {
    "tracing": {
    "traceObservers": [
    {
    "endpoints": [
    {
    "agent": {
    "host": "YOUR_UUID_GOES_HERE.aws-us-east-1.tracing.edge.nr-data.net"
    }
    }
    ],
    "id": 123456789,
    "name": "Production Workload, US-EAST-1",
    "providerRegion": "AWS_US_EAST_1",
    "status": "CREATED"
    }
    ]
    }
    }
    }
    }
    }
    }
  4. Execute a mutation that includes the new value for the name. For example, to change the name to Global Workload, US-EAST-1 for the trace observer with id 123456789, run the following:

    mutation {
    edgeUpdateTraceObservers(
    accountId: YOUR_ACCOUNT_ID
    traceObserverConfigs: { id: 123456789, name: "Global Workload, US-EAST-1" }
    ) {
    responses {
    errors {
    message
    type
    }
    traceObserver {
    id
    endpoints {
    agent {
    host
    }
    }
    name
    status
    }
    }
    }
    }

Here's the response confirming the change:

{
"data": {
"edgeUpdateTraceObservers": {
"responses": [
{
"errors": null,
"traceObserver": {
"endpoints": [
{
"agent": {
"host": "YOUR_UUID_GOES_HERE.aws-us-east-1.tracing.edge.nr-data.net"
}
}
],
"id": 123456789,
"name": "Global Workload, US-EAST-1",
"status": "CREATED"
}
}
]
}
}
}
Copyright © 2024 New Relic株式会社。

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