Configure Infinite Tracing with GraphQL

You can configure many of the settings for Infinite Tracing with the New Relic Edge 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 https://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 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 https://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"
          }
        }
      ]
    }
  }
}

For more help

If you need more help, check out these support and learning resources: