```
- cannot create subaccount -- multiple parent account ids found. Please use Partnership API.", {
- extensions: { nerdGraphExtensions: { errorClass: "SERVER_ERROR" } }
- }
+ "cannot create subaccount -- multiple parent account ids found. Please use Partnership API.", {
+ extensions: { nerdGraphExtensions: { errorClass: "SERVER_ERROR" } }
+ }
```
|
From c3d509fc60c372d8afe0a5e94adeeb958ddcb564 Mon Sep 17 00:00:00 2001
From: Brian Hensley <48165493+brnhensley@users.noreply.github.com>
Date: Mon, 20 Jan 2025 11:15:56 -0800
Subject: [PATCH 14/20] chore: add syntax highlighting
---
.../examples/export-import-dashboards-using-api.mdx | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/content/docs/apis/nerdgraph/examples/export-import-dashboards-using-api.mdx b/src/content/docs/apis/nerdgraph/examples/export-import-dashboards-using-api.mdx
index 26bd5335eb4..52a602f2cad 100644
--- a/src/content/docs/apis/nerdgraph/examples/export-import-dashboards-using-api.mdx
+++ b/src/content/docs/apis/nerdgraph/examples/export-import-dashboards-using-api.mdx
@@ -25,7 +25,7 @@ To do so:
Use the following query to retrieve a list of your existing dashboards:
-```
+```graphql
{
actor {
entitySearch(queryBuilder: {type: DASHBOARD}) {
@@ -47,10 +47,10 @@ Use the following query to retrieve a list of your existing dashboards:
Use the following query to export, then extract the dashboard's entity information from the output:
-```
+```graphql
{
actor {
- entity(guid: "your_guid_xxxxxxx") {
+ entity(guid: "YOUR_DASHBOARD_GUID") {
... on DashboardEntity {
name
permissions
@@ -81,9 +81,9 @@ Example entity information in GraphiQL output:
Use the following mutation to import the dashboard into another account:
-```
+```graphql
mutation create($dashboard: DashboardInput!) {
- dashboardCreate(accountId: your_new_AccountID, dashboard: $dashboard) {
+ dashboardCreate(accountId: YOUR_NEW_ACCOUNT_ID, dashboard: $dashboard) {
entityResult {
guid
name
From f5d0eab41a30be9eabfe5bb85845c19b00207193 Mon Sep 17 00:00:00 2001
From: Brian Hensley <48165493+brnhensley@users.noreply.github.com>
Date: Mon, 20 Jan 2025 11:42:30 -0800
Subject: [PATCH 15/20] chore: format grapql, replace `` with
`VAR_NAME`
---
...dgraph-cloud-integrations-api-tutorial.mdx | 263 +++++++++---------
1 file changed, 134 insertions(+), 129 deletions(-)
diff --git a/src/content/docs/apis/nerdgraph/examples/nerdgraph-cloud-integrations-api-tutorial.mdx b/src/content/docs/apis/nerdgraph/examples/nerdgraph-cloud-integrations-api-tutorial.mdx
index bf601a4e29d..d481448b258 100644
--- a/src/content/docs/apis/nerdgraph/examples/nerdgraph-cloud-integrations-api-tutorial.mdx
+++ b/src/content/docs/apis/nerdgraph/examples/nerdgraph-cloud-integrations-api-tutorial.mdx
@@ -52,10 +52,10 @@ Queries are requests that are intended to only fetch data (no side effects). Que
**Anonymous:**
- ```
+ ```graphql
{
actor {
- account(id: ) {
+ account(id: YOUR_ACCOUNT_ID) {
cloud {
providers {
id
@@ -75,10 +75,10 @@ Queries are requests that are intended to only fetch data (no side effects). Que
**Named:**
- ```
+ ```graphql
query cloudProviders {
actor {
- account(id: ) {
+ account(id: YOUR_ACCOUNT_ID) {
cloud {
providers {
id
@@ -98,10 +98,10 @@ Queries are requests that are intended to only fetch data (no side effects). Que
>
This query returns information about a specific provider account for your AWS integration. The properties `id`, `name`, `slug` are requested, along with a list of integrations available to be monitored.
- ```
+ ```graphql
{
actor {
- account(id: ) {
+ account(id: YOUR_ACCOUNT_ID) {
cloud {
provider(slug: "aws") {
id
@@ -126,10 +126,10 @@ Queries are requests that are intended to only fetch data (no side effects). Que
>
This query returns information about a specific cloud service integration of a provider. In this example, the integration is the [AWS ALB monitoring integration](/docs/integrations/amazon-integrations/aws-integrations-list/aws-alb-monitoring-integration) and the provider is AWS. The properties `id`, `name`, `slug`, and `isAllowed` are requested with the available configuration parameters.
- ```
+ ```graphql
{
actor {
- account(id: ) {
+ account(id: YOUR_ACCOUNT_ID) {
cloud {
provider(slug: "aws") {
service(slug: "alb") {
@@ -152,10 +152,10 @@ Queries are requests that are intended to only fetch data (no side effects). Que
>
This query returns the list of cloud accounts enabled with your New Relic account. (Your cloud account associates your New Relic account and a specific provider account with your integration.) You can enable multiple cloud provider accounts in the same New Relic account, even with the same cloud provider.
- ```
+ ```graphql
{
actor {
- account(id: ) {
+ account(id: YOUR_ACCOUNT_ID) {
cloud {
linkedAccounts {
id
@@ -179,12 +179,12 @@ Queries are requests that are intended to only fetch data (no side effects). Que
>
This query returns information about a linked account, including the properties `name`, `providerId`, and a list of the cloud integrations enabled for monitoring.
- ```
+ ```graphql
{
actor {
- account(id: ) {
+ account(id: YOUR_ACCOUNT_ID) {
cloud {
- linkedAccount(id: ) {
+ linkedAccount(id: LINKED_CLOUD_ACCOUNT_ID) {
name
provider {
id
@@ -210,10 +210,10 @@ Queries are requests that are intended to only fetch data (no side effects). Que
>
This query returns all monitored integrations for all the provider cloud accounts.
- ```
+ ```graphql
{
actor {
- account(id: ) {
+ account(id: YOUR_ACCOUNT_ID) {
cloud {
linkedAccounts {
name
@@ -245,18 +245,18 @@ Queries are requests that are intended to only fetch data (no side effects). Que
>
This query returns information about a specific integration from a specific linked account.
- ```
+ ```graphql
{
actor {
- account(id: ) {
+ account(id: YOUR_ACCOUNT_ID) {
cloud {
- linkedAccount(id: ) {
+ linkedAccount(id: LINKED_CLOUD_ACCOUNT_ID) {
name
provider {
id
name
}
- integration(id: ) {
+ integration(id: INTEGRATION_ID) {
id
name
service {
@@ -290,25 +290,25 @@ Mutations are requests that are intended to have side effects, such as creating
**Required:**
- * The parameter `` is required and cannot be empty. It must be unique in your New Relic account.
+ * The parameter `PROVIDER_ACCOUNT_NAME` is required and cannot be empty. It must be unique in your New Relic account.
* Other parameters are specific to the provider (AWS, GCP, and Azure) and are also required. In the following sections, you can see which parameters are required for each provider account. After linking an account the `createdAt` and `updatedAt` values are equal.
- ```
+ ```graphql
mutation {
cloudLinkAccount(
accounts: {
- accountId: ,
+ accountId: YOUR_ACCOUNT_ID,
aws: [{
- name: ,
-
+ name: PROVIDER_ACCOUNT_NAME,
+ # other parameters
}]
azure: [{
- name: ,
-
+ name: PROVIDER_ACCOUNT_NAME,
+ # other parameters
}]
gcp: [{
- name: ,
-
+ name: PROVIDER_ACCOUNT_NAME,
+ # other parameters
}]
}
) {
@@ -331,14 +331,14 @@ Mutations are requests that are intended to have side effects, such as creating
>
This mutation links an AWS provider account to your New Relic account.
- ```
+ ```graphql
mutation {
cloudLinkAccount(
- accountId: ,
+ accountId: YOUR_ACCOUNT_ID,
accounts: {
aws: [{
- name: ,
- arn:
+ name: PROVIDER_ACCOUNT_NAME,
+ arn: AWS_ROLE_ARN
}]
}
) {
@@ -361,14 +361,14 @@ Mutations are requests that are intended to have side effects, such as creating
>
This mutation links an AWS account sending data through CloudWatch Metric Streams to your New Relic account.
- ```
+ ```graphql
mutation {
cloudLinkAccount(
- accountId: ,
+ accountId: YOUR_ACCOUNT_ID,
accounts: {
aws: [{
- name: ,
- arn: ,
+ name: PROVIDER_ACCOUNT_NAME,
+ arn: AWS_ROLE_ARN,
metricCollectionMode: PUSH
}]
}
@@ -392,17 +392,17 @@ Mutations are requests that are intended to have side effects, such as creating
>
This mutation links a Microsoft Azure cloud subscription to the New Relic account.
- ```
+ ```graphql
mutation {
cloudLinkAccount(
- accountId: ,
+ accountId: YOUR_ACCOUNT_ID,
accounts: {
azure: [{
- name: ,
- applicationId: ,
- clientSecret: ,
- tenantId: ,
- subscriptionId:
+ name: PROVIDER_ACCOUNT_NAME,
+ applicationId: AZURE_APP_ID,
+ clientSecret: AZURE_APP_KEY,
+ tenantId: AZURE_TENANT_ID,
+ subscriptionId: AZURE_SUBSCRIPTION_ID
}]
}
) {
@@ -424,14 +424,14 @@ Mutations are requests that are intended to have side effects, such as creating
>
This mutation rotates the client secret on an existing Microsoft Azure account.
- ```
+ ```graphql
mutation {
cloudUpdateAccount(
- accountId:
+ accountId: YOUR_ACCOUNT_ID
accounts: {
azure: {
- linkedAccountId: ,
- clientSecret:
+ linkedAccountId: NR_LINKED_ACCOUNT_ID,
+ clientSecret: AZURE_SECRET_TOKEN
}
}
) {
@@ -453,14 +453,14 @@ Mutations are requests that are intended to have side effects, such as creating
>
This mutation links a GCP project to the New Relic account.
- ```
+ ```graphql
mutation {
cloudLinkAccount(
- accountId: ,
+ accountId: YOUR_ACCOUNT_ID,
accounts: {
gcp: [{
- name: ,
- projectId:
+ name: PROVIDER_ACCOUNT_NAME,
+ projectId: GCP_PROJECT_ID
}]
}
) {
@@ -482,18 +482,18 @@ Mutations are requests that are intended to have side effects, such as creating
>
This mutation allows you to rename one or more linked provider accounts. The `name` parameter is required, cannot be empty, and must be unique within your New Relic account.
- ```
+ ```graphql
mutation {
cloudRenameAccount(
- accountId: ,
+ accountId: YOUR_ACCOUNT_ID,
accounts: [
{
- id: ,
- name:
+ id: LINKED_CLOUD_ACCOUNT_ID_1,
+ name: PROVIDER_ACCOUNT_NAME
},
{
- id: ,
- name:
+ id: LINKED_CLOUD_ACCOUNT_ID_2,
+ name: PROVIDER_ACCOUNT_NAME
}
]
) {
@@ -512,15 +512,15 @@ Mutations are requests that are intended to have side effects, such as creating
>
This mutation allows you to enable the monitoring of one or more specific cloud integrations in an existing cloud account. With this mutation, New Relic records data for the enabled integration from the provider account. For each provider account you have access to different input parameters, matching each available service.
- ```
+ ```graphql
mutation {
cloudConfigureIntegration (
- accountId: ,
+ accountId: YOUR_ACCOUNT_ID,
integrations: {
- : {
- : [{
- linkedAccountId: ,
-
+ PROVIDER_SLUG : {
+ INTEGRATION_SLUG: [{
+ linkedAccountId: LINKED_CLOUD_ACCOUNT_ID,
+ # other parameters
}]
}
}
@@ -549,15 +549,15 @@ Mutations are requests that are intended to have side effects, such as creating
For the output of the operation, you can use [GraphQL fragments](https://graphql.org/learn/queries/#fragments) for integration specific configuration parameters.
- ```
+ ```graphql
mutation {
cloudConfigureIntegration (
- accountId: ,
+ accountId: YOUR_ACCOUNT_ID,
integrations: {
- : {
- : [
- { linkedAccountId: },
- { linkedAccountId: }
+ PROVIDER_SLUG : {
+ INTEGRATION_SLUG : [
+ { linkedAccountId: LINKED_CLOUD_ACCOUNT_ID_1 },
+ { linkedAccountId: LINKED_CLOUD_ACCOUNT_ID_2 }
]
}
}
@@ -586,23 +586,23 @@ Mutations are requests that are intended to have side effects, such as creating
For the output of the operation, you can use [GraphQL fragments](https://graphql.org/learn/queries/#fragments) to ask for integration specific configuration parameters.
- ```
+ ```graphql
mutation {
cloudConfigureIntegration (
- accountId: ,
+ accountId: YOUR_ACCOUNT_ID,
integrations: {
- : {
- : [
- { linkedAccountId: }
+ PROVIDER_SLUG_1: {
+ INTEGRATION_SLUG_1: [
+ { linkedAccountId: LINKED_CLOUD_ACCOUNT_ID_1 }
]
- : [
- { linkedAccountId: }
+ INTEGRATION_SLUG_2: [
+ { linkedAccountId: LINKED_CLOUD_ACCOUNT_ID_2 }
]
},
- : {
- : [
- { linkedAccountId: },
- { linkedAccountId: }
+ PROVIDER_SLUG_2: {
+ INTEGRATION_SLUG_3: [
+ { linkedAccountId: LINKED_CLOUD_ACCOUNT_ID_3},
+ { linkedAccountId: LINKED_CLOUD_ACCOUNT_ID_4}
]
}
}
@@ -631,17 +631,17 @@ Mutations are requests that are intended to have side effects, such as creating
For parameters of a type list (for example, `awsRegion`) supply the full list. For the output of the operation, you can use [GraphQL fragments](https://graphql.org/learn/queries/#fragments) to ask for integration specific configuration parameters.
- ```
+ ```graphql
mutation {
cloudConfigureIntegration (
- accountId: ,
+ accountId: YOUR_ACCOUNT_ID,
integrations: {
- : {
- : [{
- linkedAccountId: ,
- metricsPollingInterval: ,
- : ,
- : ,
+ PROVIDER_SLUG: {
+ INTEGRATION_SLUG: [{
+ linkedAccountId: LINKED_CLOUD_ACCOUNT_ID,
+ metricsPollingInterval: NEW_POLLING_INTERVAL,
+ PARAMETER_1: VALUE_1,
+ PARAMETER_N: VALUE_N,
}]
}
}
@@ -655,8 +655,8 @@ Mutations are requests that are intended to have side effects, such as creating
}
... on SqsIntegration {
metricsPollingInterval,
- ,
-
+ PARAMETER_1,
+ PARAMETER_N
}
}
errors {
@@ -674,14 +674,14 @@ Mutations are requests that are intended to have side effects, such as creating
>
This mutation allows you to disable an integration and stop data collection for the specific cloud integration.
- ```
+ ```graphql
mutation {
cloudDisableIntegration (
- accountId: ,
+ accountId: YOUR_ACCOUNT_ID,
integrations: {
: {
: [
- { linkedAccountId: }
+ { linkedAccountId: LINKED_CLOUD_ACCOUNT_ID }
]
}
}
@@ -713,12 +713,12 @@ Mutations are requests that are intended to have side effects, such as creating
This action can not be undone. However, you can link the account again, but account history will still be lost.
- ```
+ ```graphql
mutation {
cloudUnlinkAccount (
- accountId: ,
+ accountId: YOUR_ACCOUNT_ID,
accounts: {
- { linkedAccountId: }
+ { linkedAccountId: LINKED_CLOUD_ACCOUNT_ID }
}
) {
unlinkedAccounts {
@@ -748,10 +748,10 @@ To enable an AWS integration:
>
Send a query to fetch data about the account, specifically available providers and already created provider accounts:
- ```
+ ```graphql
{
actor {
- account(id: ) {
+ account(id: YOUR_ACCOUNT_ID) {
cloud {
providers {
id
@@ -778,18 +778,18 @@ To enable an AWS integration:
>
Link an AWS provider account, if there is not one already linked or if you want to link another AWS account:
- 1. Use your New Relic account identifier in the `` parameter.
- 2. Provide a name for the provider account in the ``.
+ 1. Use your New Relic account identifier in the `YOUR_ACCOUNT_ID` parameter.
+ 2. Provide a name for the provider account in the `PROVIDER_ACCOUNT_NAME`.
3. Include the ARN of the AWS role used to fetch data from your AWS account.
- ```
+ ```graphql
mutation {
cloudLinkAccount(
- accountId: ,
+ accountId: YOUR_ACCOUNT_ID,
accounts: {
aws: [{
- name: ,
- arn: }]
+ name: PROVIDER_ACCOUNT_NAME,
+ arn: AWS_ROLE_ARN }]
}
) {
linkedAccounts {
@@ -812,16 +812,16 @@ To enable an AWS integration:
id="enable-sqs-integration"
title="Enable the AWS SQS integration"
>
- Use your New Relic account ID in the `` parameter and the ID of the provider account in the `` parameter value.
+ Use your New Relic account ID in the `YOUR_ACCOUNT_ID` parameter and the ID of the provider account in the `LINKED_CLOUD_ACCOUNT_ID` parameter value.
- ```
+ ```graphql
mutation {
cloudConfigureIntegration (
- accountId: ,
+ accountId: YOUR_ACCOUNT_ID,
integrations: {
aws: {
sqs: [
- { linkedAccountId: }
+ { linkedAccountId: LINKED_CLOUD_ACCOUNT_ID }
]
}
}
@@ -847,17 +847,23 @@ To enable an AWS integration:
id="enable-sqs-multiple-provider-accounts"
title="Enable integration in multiple provider accounts"
>
- If you have multiple accounts with the same provider account, you can enable the same integration in multiple provider accounts at the same time. Use your New Relic account ID in the `` parameter and the ID of the provider accounts in the `` parameter value.
+ If you have multiple accounts with the same provider account, you can enable the same integration in multiple provider accounts at the same time. Use your New Relic account ID in the `YOUR_ACCOUNT_ID` parameter and the ID of the provider accounts in the `LINKED_CLOUD_ACCOUNT_ID_N` parameter value.
- ```
+ ```graphql
mutation {
cloudConfigureIntegration (
- accountId: ,
+ accountId: YOUR_ACCOUNT_ID,
integrations: {
aws: {
sqs: [
- { linkedAccountId: },
- { linkedAccountId: , configuration_param_1: value_1, configuration_param_2: value_2 }
+ {
+ linkedAccountId: LINKED_CLOUD_ACCOUNT_ID_1
+ },
+ {
+ linkedAccountId: LINKED_CLOUD_ACCOUNT_ID_2,
+ configuration_param_1: value_1,
+ configuration_param_2: value_2
+ }
]
}
}
@@ -889,16 +895,19 @@ This example uses an [AWS SQS](/docs/integrations/amazon-integrations/aws-integr
id="update-sqs-polling"
title="Update the polling interval"
>
- To update the polling interval for an AWS SQS integration, use your New Relic account ID in the `` parameter and the `id` of the linked provider account in the `` parameter value:
+ To update the polling interval for an AWS SQS integration, use your New Relic account ID in the `YOUR_ACCOUNT_ID` parameter and the `id` of the linked provider account in the `LINKED_ACCOUNT_ID` parameter value:
- ```
+ ```graphql
mutation {
cloudConfigureIntegration(
- accountId: ,
+ accountId: YOUR_ACCOUNT_ID,
integrations: {
aws : {
sqs: [
- { linkedAccountId: , metricsPollingInterval: 300 }
+ {
+ linkedAccountId: LINKED_CLOUD_ACCOUNT_ID,
+ metricsPollingInterval: 300
+ }
]
}
}
@@ -933,24 +942,20 @@ This example uses an [AWS SQS](/docs/integrations/amazon-integrations/aws-integr
id="disable-sqs-scenario"
title="Disable the SQS integration"
>
- Use your New Relic account identifier in the `` parameter and the ID of the linked cloud account the `` parameter value.
+ Use your New Relic account identifier in the `YOUR_ACCOUNT_ID` parameter and the ID of the linked cloud account the `LINKED_ACCOUNT_ID` parameter value.
- ```
+ ```graphql
mutation {
- cloudDisableIntegration (
- accountId: ,
+ cloudDisableIntegration(
+ accountId: YOUR_ACCOUNT_ID
integrations: {
- aws: {
- sqs: [
- { linkedAccountId: }
- ]
- }
+ aws: { sqs: [{ linkedAccountId: LINKED_CLOUD_ACCOUNT_ID }] }
}
) {
- disabledIntegrations {
- id
+ disabledIntegrations {
+ id
accountId
- name
+ name
}
errors {
type
From 96c5dbd9f93f774f3361841049997756b10c3715 Mon Sep 17 00:00:00 2001
From: Brian Hensley <48165493+brnhensley@users.noreply.github.com>
Date: Mon, 20 Jan 2025 11:56:59 -0800
Subject: [PATCH 16/20] chore: format code
---
.../nerdgraph-concurrency-tutorial.mdx | 117 +++++++++---------
1 file changed, 59 insertions(+), 58 deletions(-)
diff --git a/src/content/docs/apis/nerdgraph/examples/nerdgraph-concurrency-tutorial.mdx b/src/content/docs/apis/nerdgraph/examples/nerdgraph-concurrency-tutorial.mdx
index e6f7ca45f3b..40937729724 100644
--- a/src/content/docs/apis/nerdgraph/examples/nerdgraph-concurrency-tutorial.mdx
+++ b/src/content/docs/apis/nerdgraph/examples/nerdgraph-concurrency-tutorial.mdx
@@ -14,34 +14,36 @@ New Relic's NerdGraph API enforces a limit of **25 concurrent requests per
One way to handle concurrency is to use a worker pool. The below example uses the [async module](https://caolan.github.io/async/v3/docs.html#queue) to do so. It creates a queue that has a set concurrency execution limit, pushes requests as tasks onto that queue, and empties the queue once completeing all tasks.
-```node
-import got from 'got';
-import async from 'async';
+```js
+import got from "got";
+import async from "async";
-const API_KEY = '' //GraphQL User Key
-const MAX_CONCURRENCY = 25; //Maximum amount of requests in queue at a given time
-
-const GRAPH_API = 'https://api.newrelic.com/graphql';
-const HEADERS = { 'Content-Type': 'application/json', 'Api-Key': API_KEY };
+const API_KEY = "YOUR_GRAPHQL_USER_KEY"; // GraphQL User Key
+const MAX_CONCURRENCY = 25; // Maximum amount of requests in queue at a given time
+const GRAPH_API = "https://api.newrelic.com/graphql";
+const HEADERS = { "Content-Type": "application/json", "Api-Key": API_KEY };
async function main() {
- let accounts = await getAccounts(); //All accounts to run a query against
+ let accounts = await getAccounts(); // All accounts to run a query against
var allResults = [];
//Queue initialization
const q = async.queue(async (task, cb) => {
- let result = await makeRequest(task.acct)
- allResults.push({'transactionCount': result[0].count, 'account': task.acct.id});
+ let result = await makeRequest(task.acct);
+ allResults.push({
+ transactionCount: result[0].count,
+ account: task.acct.id,
+ });
cb();
}, MAX_CONCURRENCY);
- //Push requests on to the queue (one for each account)
- accounts.forEach(acct => {
- q.push({acct: acct});
+ // Push requests on to the queue (one for each account)
+ accounts.forEach((acct) => {
+ q.push({ acct: acct });
});
- await q.drain(); //Drain event listener when all tasks are complete
+ await q.drain(); // Drain event listener when all tasks are complete
console.log(allResults);
}
@@ -49,53 +51,51 @@ async function main() {
async function makeRequest(acct) {
let nrql = `SELECT count(*) FROM Transaction`;
let gql = `{
- actor {
- account(id: ${acct.id}) {
- nrql(query: "${nrql}", timeout: 90) {
- results
- }
- }
- }
- }`;
+ actor {
+ account(id: ${acct.id}) {
+ nrql(query: "${nrql}", timeout: 90) {
+ results
+ }
+ }
+ }
+ }`;
let opts = {
url: GRAPH_API,
headers: HEADERS,
- json: {'query': gql, 'variables': {}}
+ json: { query: gql, variables: {} },
};
let response = await got.post(opts).json();
if (!response.errors) {
return response.data.actor.account.nrql.results;
} else {
- console.log('Query Error');
+ console.log("Query Error");
console.log(response.errors);
}
}
async function getAccounts() {
var q = `{
- actor {
- accounts {
- id
- name
- }
- }
- }`
+ actor {
+ accounts {
+ id
+ name
+ }
+ }
+ }`;
var opts = {
url: GRAPH_API,
headers: HEADERS,
- json: {'query': q, 'variables': {}}
- }
+ json: { query: q, variables: {} },
+ };
let resp = await got.post(opts).json();
return resp.data.actor.accounts;
}
-
main();
-
```
## Python
@@ -107,35 +107,33 @@ You can also use Python by leveraging the following packages to handle asynchron
Below sets a [Semaphore](https://docs.python.org/3/library/asyncio-sync.html?highlight=semaphore#asyncio.Semaphore) that manages the amount of concurrent simultaneous requests. It then uses `asyncio.gather()` to execute multiple co-routines concurrently and waits for their completion.
-```
+```py
import aiohttp
import asyncio
-API_KEY = ''
+API_KEY = "YOUR_GRAPHQL_USER_KEY"
MAX_CONCURRENCY = 25
-GRAPHQL_API = 'https://api.newrelic.com/graphql'
-HEADERS = {'Content-Type': 'application/json', 'Api-Key': API_KEY}
-
+GRAPHQL_API = "https://api.newrelic.com/graphql"
+HEADERS = {"Content-Type": "application/json", "Api-Key": API_KEY}
async def main():
- #All accounts to run a query against
+ # All accounts to run a query against
accounts = await get_accounts()
# Semaphore for controlling concurrency
limit = asyncio.Semaphore(MAX_CONCURRENCY)
- #Add all accounts to run a query against
+ # Add all accounts to run a query against
tasks = [send_request(acct, limit) for acct in accounts]
- #Schedule all tasks to run concurrently
+ # Schedule all tasks to run concurrently
allResults = await asyncio.gather(*tasks)
print(allResults)
-
async def send_request(acct, limit):
nrql = "SELECT count(*) FROM Transaction"
- gql = f'''
+ gql = f"""
{{
actor {{
account(id: {acct['id']}) {{
@@ -145,19 +143,22 @@ async def send_request(acct, limit):
}}
}}
}}
- '''
+ """
async with limit:
try:
async with aiohttp.ClientSession() as session:
- async with session.post(GRAPHQL_API, json={"query": gql, "variables":{}}, headers=HEADERS) as response:
+ async with session.post(
+ GRAPHQL_API, json={"query": gql, "variables": {}}, headers=HEADERS
+ ) as response:
result = await response.json()
- return {'transactionCount': result['data']['actor']['account']['nrql']['results'][0]['count'], 'account': acct['id']}
+ return {
+ "transactionCount": result["data"]["actor"]["account"]["nrql"]["results"][0]["count"],"account": acct["id"],
+ }
except Exception as error:
print("Query Error")
raise error
-
async def get_accounts():
gql = """
{
@@ -166,19 +167,19 @@ async def get_accounts():
id
name
}
- }
- }
+ }
+ }
"""
async with aiohttp.ClientSession() as session:
- async with session.post(GRAPHQL_API, json={"query": gql, "variables":{}}, headers=HEADERS) as response:
+ async with session.post(
+ GRAPHQL_API, json={"query": gql, "variables": {}}, headers=HEADERS
+ ) as response:
result = await response.json()
- return result['data']['actor']['accounts']
-
-
-if __name__ == '__main__':
- asyncio.run(main()) #Run event loop
+ return result["data"]["actor"]["accounts"]
+if __name__ == "__main__":
+ asyncio.run(main()) # Run event loop
```
For more detail on NerdGraph limits, see [NerdGraph usage limits](/docs/apis/nerdgraph/nerdgraph-usage-limits).
From 2b3467973a3b3623c4ec410f557d9cfe7b1521d2 Mon Sep 17 00:00:00 2001
From: Brian Hensley <48165493+brnhensley@users.noreply.github.com>
Date: Mon, 20 Jan 2025 13:42:13 -0800
Subject: [PATCH 17/20] chore: formatting & syntax highlighting
---
.../nerdgraph-synthetics-tutorial.mdx | 763 +++++++++---------
1 file changed, 360 insertions(+), 403 deletions(-)
diff --git a/src/content/docs/apis/nerdgraph/examples/nerdgraph-synthetics-tutorial.mdx b/src/content/docs/apis/nerdgraph/examples/nerdgraph-synthetics-tutorial.mdx
index bc4e47802f2..d891d45485d 100644
--- a/src/content/docs/apis/nerdgraph/examples/nerdgraph-synthetics-tutorial.mdx
+++ b/src/content/docs/apis/nerdgraph/examples/nerdgraph-synthetics-tutorial.mdx
@@ -57,7 +57,7 @@ Configure simple browser, scripted browser, and step monitors to use one or more
>
To identify a [private location](/docs/synthetics/synthetic-monitoring/private-locations/private-locations-overview-monitor-internal-sites-add-new-locations) in your scripts, use the private location's entity GUID. If the private location is configured to use [verified script execution](/docs/synthetics/synthetic-monitoring/private-locations/verified-script-execution-private-locations/), also include the `vsePassword` attribute. For example:
- ```
+ ```graphql
locations: {
private: {
guid: LOCATION_ENTITY_GUID,
@@ -68,7 +68,7 @@ Configure simple browser, scripted browser, and step monitors to use one or more
[Public locations](/docs/synthetics/synthetic-monitoring/administration/synthetic-public-minion-ips/#location) use the location identifier without the AWS\_ prefix, for example:
- ```
+ ```graphql
locations: {
public: ["US_EAST_2", "US_WEST_1"]
}
@@ -193,7 +193,7 @@ Queries make requests to fetch data. To learn additional query capabilities avai
>
You can query your synthetic monitors to get current status information about your data or details about the monitor configuration. Many monitor configurations are surfaced as tags.
- ```
+ ```graphql
{
actor {
entitySearch(query: "domain = 'SYNTH' AND type = 'MONITOR'") {
@@ -223,7 +223,7 @@ Queries make requests to fetch data. To learn additional query capabilities avai
>
You're able to query your private locations:
- ```
+ ```graphql
{
actor {
entitySearch(query: "domain = 'SYNTH' AND type = 'PRIVATE_LOCATION'") {
@@ -250,7 +250,7 @@ Queries make requests to fetch data. To learn additional query capabilities avai
>
Query existing monitor downtimes. Configuration details are stored in tags.
- ```
+ ```graphql
{
actor {
entitySearch(query: "domain = 'SYNTH' AND type = 'MONITOR_DOWNTIME'") {
@@ -277,7 +277,7 @@ Queries make requests to fetch data. To learn additional query capabilities avai
>
Querying secure credentials lets you retrieve metadata only, but not the credential values themselves:
- ```
+ ```graphql
{
actor {
entitySearch(query: "domain = 'SYNTH' AND type = 'SECURE_CRED'") {
@@ -307,10 +307,10 @@ Queries make requests to fetch data. To learn additional query capabilities avai
>
Retrieve the script used in a scripted API or scripted browser monitor. Other monitor types will return an error.
- ```
+ ```graphql
{
actor {
- account(id: YOUR_ACCOUNT_ID) {
+ account(id: ACCOUNT_ID) {
synthetics {
script(monitorGuid: "ENTITY_GUID") {
text
@@ -328,10 +328,10 @@ Queries make requests to fetch data. To learn additional query capabilities avai
>
Retrieve the steps configured for a step monitor. Other monitor types will return an error.
- ```
+ ```graphql
{
actor {
- account(id: YOUR_ACCOUNT_ID) {
+ account(id: ACCOUNT_ID) {
synthetics {
steps(monitorGuid: "ENTITY_GUID") {
ordinal
@@ -351,7 +351,7 @@ Queries make requests to fetch data. To learn additional query capabilities avai
>
Retrieve the entity GUID for a synthetic monitor using the monitor ID.
- ```
+ ```graphql
{
actor {
entitySearch(
@@ -378,7 +378,7 @@ Queries make requests to fetch data. To learn additional query capabilities avai
>
Retrieve the status of all runtime upgrade tests for legacy runtime monitors. These tests populate the [runtime upgrades UI](/docs/synthetics/synthetic-monitoring/using-monitors/runtime-upgrade-ui/). The test result is stored in the `validationStatus` tag. If the upgrade test failed, the error message is available in the `validationError` tag.
- ```
+ ```graphql
{
actor {
entitySearch(query: "domain = 'SYNTH' AND type = 'RUNTIME_VALIDATION'") {
@@ -405,10 +405,12 @@ Queries make requests to fetch data. To learn additional query capabilities avai
>
Retrieve the status of a runtime upgrade test for a single legacy runtime monitor. These test results populate the [runtime upgrades UI](/docs/synthetics/synthetic-monitoring/using-monitors/runtime-upgrade-ui/). The test result is stored in the `validationStatus` tag. If the upgrade test failed, the error message is available in the `validationError` tag.
- ```
+ ```graphql
{
actor {
- entitySearch(query: "domain = 'SYNTH' AND type = 'RUNTIME_VALIDATION' and domainId = 'MONITOR_ID'") {
+ entitySearch(
+ query: "domain = 'SYNTH' AND type = 'RUNTIME_VALIDATION' AND domainId = 'MONITOR_ID'"
+ ) {
results {
entities {
accountId
@@ -449,31 +451,26 @@ Below are some sample requests to automate the creation of your synthetic monito
>
Ping monitors check that your application is running. Here's an example for creating one in NerdGraph:
- ```
+ ```graphql
mutation {
- syntheticsCreateSimpleMonitor (
- accountId: YOUR_ACCOUNT_ID
+ syntheticsCreateSimpleMonitor(
+ accountId: ACCOUNT_ID
monitor: {
- locations: {
- public: ["LOCATION_1", "LOCATION_2"]
- },
- name: "YOUR_MONITOR_NAME",
- period: PERIOD,
- status: STATUS,
- uri: "MONITORED_URI",
+ locations: { public: ["LOCATION_1", "LOCATION_2"] }
+ name: "YOUR_MONITOR_NAME"
+ period: PERIOD
+ status: STATUS
+ uri: "MONITORED_URI"
advancedOptions: {
- customHeaders: {
- name: "HEADER_NAME",
- value: "HEADER_VALUE"
- },
- redirectIsFailure: REDIRECT_IS_FAILURE,
- responseValidationText: "VALIDATION_TEXT",
- shouldBypassHeadRequest: BYPASS_HEAD_REQUEST,
+ customHeaders: { name: "HEADER_NAME", value: "HEADER_VALUE" }
+ redirectIsFailure: REDIRECT_IS_FAILURE
+ responseValidationText: "VALIDATION_TEXT"
+ shouldBypassHeadRequest: BYPASS_HEAD_REQUEST
useTlsValidation: TLS_VALIDATION
- },
+ }
apdexTarget: APDEX_TARGET
}
- ) {
+ ) {
errors {
description
type
@@ -489,43 +486,39 @@ Below are some sample requests to automate the creation of your synthetic monito
>
Simple browser monitors use Chrome instances to mimic customer visits. Here's an example for creating one in NerdGraph:
- ```
+ ```graphql
mutation {
- syntheticsCreateSimpleBrowserMonitor (
- accountId: YOUR_ACCOUNT_ID,
+ syntheticsCreateSimpleBrowserMonitor(
+ accountId: ACCOUNT_ID
monitor: {
- browsers: [BROWSERS],
- devices: [DEVICES],
- locations: {
- public: ["LOCATION_1", "LOCATION_2"]
- },
- name: "YOUR_MONITOR_NAME",
- period: PERIOD,
+ browsers: [BROWSERS]
+ devices: [DEVICES]
+ locations: { public: ["LOCATION_1", "LOCATION_2"] }
+ name: "YOUR_MONITOR_NAME"
+ period: PERIOD
runtime: {
- runtimeType: "RUNTIME_TYPE",
- runtimeTypeVersion: "RUNTIME_TYPE_VERSION",
+ runtimeType: "RUNTIME_TYPE"
+ runtimeTypeVersion: "RUNTIME_TYPE_VERSION"
scriptLanguage: "SCRIPT_LANGUAGE"
}
- status: STATUS,
- uri: "MONITORED_URI",
+ status: STATUS
+ uri: "MONITORED_URI"
advancedOptions: {
- customHeaders: {
- name: "HEADER_NAME",
- value: "HEADER_VALUE"
- },
- enableScreenshotOnFailureAndScript: ENABLE_SCREENSHOT,
- responseValidationText: "VALIDATION_TEXT",
+ customHeaders: { name: "HEADER_NAME", value: "HEADER_VALUE" }
+ enableScreenshotOnFailureAndScript: ENABLE_SCREENSHOT
+ responseValidationText: "VALIDATION_TEXT"
useTlsValidation: TLS_VALIDATION
- },
+ }
apdexTarget: APDEX_TARGET
- ) {
+ }
+ ) {
errors {
description
type
}
}
}
- ```
+ ```
[Scripted browser monitors](/docs/synthetics/synthetic-monitoring/scripting-monitors/introduction-scripted-browser-monitors) are more complex interactions with your pages and applications. Here's an example for creating one in NerdGraph:
- ```
- mutation {
- syntheticsCreateScriptBrowserMonitor (
- accountId: YOUR_ACCOUNT_ID,
- monitor: {
- browsers: [BROWSERS],
- devices: [DEVICES],
- locations: {
- public: ["LOCATION_1", "LOCATION_2"]
- },
- name: "MONITOR_NAME",
- period: PERIOD,
- runtime: {
- runtimeType: "RUNTIME_TYPE",
- runtimeTypeVersion: "RUNTIME_TYPE_VERSION",
- scriptLanguage: "SCRIPT_LANGUAGE"
- }
- script: "SCRIPT_CONTENT",
- status: STATUS,
- advancedOptions: {
- enableScreenshotOnFailureAndScript: ENABLE_SCREENSHOT
- },
- apdexTarget: APDEX_TARGET
- }
- ) {
- errors {
- description
- type
+ ```graphql
+ mutation {
+ syntheticsCreateScriptBrowserMonitor(
+ accountId: ACCOUNT_ID
+ monitor: {
+ browsers: [BROWSERS]
+ devices: [DEVICES]
+ locations: { public: ["LOCATION_1", "LOCATION_2"] }
+ name: "MONITOR_NAME"
+ period: PERIOD
+ runtime: {
+ runtimeType: "RUNTIME_TYPE"
+ runtimeTypeVersion: "RUNTIME_TYPE_VERSION"
+ scriptLanguage: "SCRIPT_LANGUAGE"
}
+ script: "SCRIPT_CONTENT"
+ status: STATUS
+ advancedOptions: { enableScreenshotOnFailureAndScript: ENABLE_SCREENSHOT }
+ apdexTarget: APDEX_TARGET
+ }
+ ) {
+ errors {
+ description
+ type
}
}
+ }
```
@@ -574,32 +563,30 @@ Below are some sample requests to automate the creation of your synthetic monito
>
[Scripted API monitors](/docs/synthetics/synthetic-monitoring/scripting-monitors/write-synthetic-api-tests) check your API endpoints. Here's an example for creating one in NerdGraph:
- ```
- mutation {
- syntheticsCreateScriptApiMonitor (
- accountId: YOUR_ACCOUNT_ID,
- monitor: {
- locations: {
- public: ["LOCATION_1", "LOCATION_2"]
- },
- name: "YOUR_MONITOR_NAME",
- period: PERIOD,
- runtime: {
- runtimeType: "RUNTIME_TYPE",
- runtimeTypeVersion: "RUNTIME_TYPE_VERSION",
- scriptLanguage: "SCRIPT_LANGUAGE"
- }
- script: "SCRIPT_CONTENT",
- status: STATUS,
- apdexTarget: APDEX_TARGET
- }
- ) {
- errors {
- description
- type
+ ```graphql
+ mutation {
+ syntheticsCreateScriptApiMonitor(
+ accountId: ACCOUNT_ID
+ monitor: {
+ locations: { public: ["LOCATION_1", "LOCATION_2"] }
+ name: "YOUR_MONITOR_NAME"
+ period: PERIOD
+ runtime: {
+ runtimeType: "RUNTIME_TYPE"
+ runtimeTypeVersion: "RUNTIME_TYPE_VERSION"
+ scriptLanguage: "SCRIPT_LANGUAGE"
}
+ script: "SCRIPT_CONTENT"
+ status: STATUS
+ apdexTarget: APDEX_TARGET
+ }
+ ) {
+ errors {
+ description
+ type
}
}
+ }
```
@@ -609,44 +596,42 @@ Below are some sample requests to automate the creation of your synthetic monito
>
Step monitors provide codeless multi-step browser based monitors. Here's an example for creating one in NerdGraph:
- ```
+ ```graphql
mutation {
- syntheticsCreateStepMonitor (
- accountId: NR_ACCOUNT_ID,
- monitor: {
- browsers: [BROWSERS],
- devices: [DEVICES],
- locations: {
- public: ["LOCATION_1", "LOCATION_2"]
- },
- name: "MONITOR_NAME",
- period: PERIOD,
- runtime: {
- runtimeType: "RUNTIME_TYPE",
- runtimeTypeVersion: "RUNTIME_TYPE_VERSION",
- scriptLanguage: "SCRIPT_LANGUAGE"
+ syntheticsCreateStepMonitor(
+ accountId: ACCOUNT_ID
+ monitor: {
+ browsers: [BROWSERS]
+ devices: [DEVICES]
+ locations: { public: ["LOCATION_1", "LOCATION_2"] }
+ name: "MONITOR_NAME"
+ period: PERIOD
+ runtime: {
+ runtimeType: "RUNTIME_TYPE"
+ runtimeTypeVersion: "RUNTIME_TYPE_VERSION"
+ scriptLanguage: "SCRIPT_LANGUAGE"
}
- status: STATUS,
- steps: [{
- ordinal: 0,
- type: NAVIGATE,
- values: ["MONITORED_URI"],["USER_AGENT"]
- },{
- ordinal: STEP_NUMBER,
- type: STEP_TYPE,
- values: ["CONDITIONAL_TYPE","VALUE"]
- }]
- advancedOptions: {
- enableScreenshotOnFailureAndScript: ENABLE_SCREENSHOT
- },
- apdexTarget: APDEX_TARGET
- }
- ) {
+ status: STATUS
+ steps: [
+ {
+ ordinal: 0,
+ type: NAVIGATE,
+ values: ["MONITORED_URI", "USER_AGENT"] }
+ {
+ ordinal: STEP_NUMBER
+ type: STEP_TYPE
+ values: ["CONDITIONAL_TYPE", "VALUE"]
+ }
+ ]
+ advancedOptions: { enableScreenshotOnFailureAndScript: ENABLE_SCREENSHOT }
+ apdexTarget: APDEX_TARGET
+ }
+ ) {
errors {
description
type
}
- }
+ }
}
```
@@ -657,28 +642,26 @@ Below are some sample requests to automate the creation of your synthetic monito
>
Set up monitors to notify you when your SSL certificates are about to expire. Here's an example for creating one in NerdGraph:
- ```
- mutation {
- syntheticsCreateCertCheckMonitor (
- accountId: YOUR_ACCOUNT_ID,
- monitor: {
- domain: "DOMAIN",
- locations: {
- public: ["LOCATION_1", "LOCATION_2"]
- },
- name: "YOUR_MONITOR_NAME",
- numberDaysToFailBeforeCertExpires: DAYS_UNTIL_EXPIRATION,
- period: PERIOD,
- status: STATUS,
- apdexTarget: APDEX_TARGET
- }
- ) {
- errors {
- description
- type
- }
+ ```graphql
+ mutation {
+ syntheticsCreateCertCheckMonitor(
+ accountId: ACCOUNT_ID
+ monitor: {
+ domain: "DOMAIN"
+ locations: { public: ["LOCATION_1", "LOCATION_2"] }
+ name: "YOUR_MONITOR_NAME"
+ numberDaysToFailBeforeCertExpires: DAYS_UNTIL_EXPIRATION
+ period: PERIOD
+ status: STATUS
+ apdexTarget: APDEX_TARGET
+ }
+ ) {
+ errors {
+ description
+ type
}
}
+ }
```
@@ -688,32 +671,26 @@ Below are some sample requests to automate the creation of your synthetic monito
>
Broken links monitors check the links on a webpage for failure. Here's an example for creating one in NerdGraph:
- ```
+ ```graphql
mutation {
- syntheticsCreateBrokenLinksMonitor (
- accountId: YOUR_ACCOUNT_ID,
+ syntheticsCreateBrokenLinksMonitor(
+ accountId: ACCOUNT_ID
monitor: {
- locations: {
- public: ["LOCATION_1", "LOCATION_2"]
- },
- name: "YOUR_MONITOR_NAME",
- period: PERIOD,
- status: STATUS,
- apdexTarget: APDEX_TARGET,
- uri: "MONITOR_URI",
- tags: {
- key: "YOUR_TAG_NAME",
- values: "TAG_VALUE"
- }
- }
- ) {
- errors {
- description
- type
- }
+ locations: { public: ["LOCATION_1", "LOCATION_2"] }
+ name: "YOUR_MONITOR_NAME"
+ period: PERIOD
+ status: STATUS
+ apdexTarget: APDEX_TARGET
+ uri: "MONITOR_URI"
+ tags: { key: "YOUR_TAG_NAME", values: "TAG_VALUE" }
+ }
+ ) {
+ errors {
+ description
+ type
+ }
}
}
-
```
@@ -733,28 +710,23 @@ While you can't change the monitor type after creating it, you can update its se
>
Use this to update your ping monitors:
- ```
+ ```graphql
mutation {
- syntheticsUpdateSimpleMonitor (
- guid: "ENTITY_GUID",
+ syntheticsUpdateSimpleMonitor(
+ guid: "ENTITY_GUID"
monitor: {
- locations: {
- public: ["LOCATION_1", "LOCATION_2"]
- },
- name: "YOUR_MONITOR_NAME",
- period: PERIOD,
- status: STATUS,
- uri: "MONITORED_URI",
+ locations: { public: ["LOCATION_1", "LOCATION_2"] }
+ name: "YOUR_MONITOR_NAME"
+ period: PERIOD
+ status: STATUS
+ uri: "MONITORED_URI"
advancedOptions: {
- customHeaders: {
- name: "HEADER_NAME",
- value: "HEADER_VALUE"
- },
- redirectIsFailure: REDIRECT_IS_FAILURE,
- responseValidationText: "VALIDATION_TEXT",
- shouldBypassHeadRequest: BYPASS_HEAD_REQUEST,
+ customHeaders: { name: "HEADER_NAME", value: "HEADER_VALUE" }
+ redirectIsFailure: REDIRECT_IS_FAILURE
+ responseValidationText: "VALIDATION_TEXT"
+ shouldBypassHeadRequest: BYPASS_HEAD_REQUEST
useTlsValidation: TLS_VALIDATION
- },
+ }
apdexTarget: APDEX_TARGET
}
) {
@@ -773,42 +745,38 @@ While you can't change the monitor type after creating it, you can update its se
>
To update a simple browser monitor (including the ability to upgrade the runtime version), use this:
- ```
- mutation {
- syntheticsUpdateSimpleBrowserMonitor (
- guid: ENTITY_GUID,
- monitor: {
- browsers: [BROWSERS],
- devices: [DEVICES],
- locations: {
- public: ["LOCATION_1", "LOCATION_2"]
- },
- name: "YOUR_MONITOR_NAME",
- period: PERIOD,
- runtime: {
- runtimeType: "RUNTIME_TYPE",
- runtimeTypeVersion: "RUNTIME_TYPE_VERSION",
- scriptLanguage: "SCRIPT_LANGUAGE"
- }
- status: STATUS,
- uri: "MONITORED_URI",
- advancedOptions: {
- customHeaders: {
- name: "HEADER_NAME",
- value: "HEADER_VALUE"
- },
- enableScreenshotOnFailureAndScript: ENABLE_SCREENSHOT,
- responseValidationText: "VALIDATION_TEXT",
- useTlsValidation: TLS_VALIDATION
- },
- apdexTarget: APDEX_TARGET
- ) {
- errors {
- description
- type
+ ```graphql
+ mutation {
+ syntheticsUpdateSimpleBrowserMonitor(
+ guid: ENTITY_GUID
+ monitor: {
+ browsers: [BROWSERS]
+ devices: [DEVICES]
+ locations: { public: ["LOCATION_1", "LOCATION_2"] }
+ name: "YOUR_MONITOR_NAME"
+ period: PERIOD
+ runtime: {
+ runtimeType: "RUNTIME_TYPE"
+ runtimeTypeVersion: "RUNTIME_TYPE_VERSION"
+ scriptLanguage: "SCRIPT_LANGUAGE"
+ }
+ status: STATUS
+ uri: "MONITORED_URI"
+ advancedOptions: {
+ customHeaders: { name: "HEADER_NAME", value: "HEADER_VALUE" }
+ enableScreenshotOnFailureAndScript: ENABLE_SCREENSHOT
+ responseValidationText: "VALIDATION_TEXT"
+ useTlsValidation: TLS_VALIDATION
}
+ apdexTarget: APDEX_TARGET
+ }
+ ) {
+ errors {
+ description
+ type
}
}
+ }
```
@@ -818,37 +786,33 @@ While you can't change the monitor type after creating it, you can update its se
>
To update a scripted browser monitor (including the ability to upgrade the runtime version), use this:
- ```
- mutation {
- syntheticsUpdateScriptBrowserMonitor (
- guid: ENTITY_GUID,
- monitor: {
- browsers: [BROWSERS],
- devices: [DEVICES],
- locations: {
- public: ["LOCATION_1", "LOCATION_2"]
- },
- name: "MONITOR_NAME",
- period: PERIOD,
- runtime: {
- runtimeType: "RUNTIME_TYPE",
- runtimeTypeVersion: "RUNTIME_TYPE_VERSION",
- scriptLanguage: "SCRIPT_LANGUAGE"
- }
- script: "SCRIPT_CONTENT",
- status: STATUS,
- advancedOptions: {
- enableScreenshotOnFailureAndScript: ENABLE_SCREENSHOT
- },
- apdexTarget: APDEX_TARGET
- }
- ) {
- errors {
- description
- type
+ ```graphql
+ mutation {
+ syntheticsUpdateScriptBrowserMonitor(
+ guid: ENTITY_GUID
+ monitor: {
+ browsers: [BROWSERS]
+ devices: [DEVICES]
+ locations: { public: ["LOCATION_1", "LOCATION_2"] }
+ name: "MONITOR_NAME"
+ period: PERIOD
+ runtime: {
+ runtimeType: "RUNTIME_TYPE"
+ runtimeTypeVersion: "RUNTIME_TYPE_VERSION"
+ scriptLanguage: "SCRIPT_LANGUAGE"
}
+ script: "SCRIPT_CONTENT"
+ status: STATUS
+ advancedOptions: { enableScreenshotOnFailureAndScript: ENABLE_SCREENSHOT }
+ apdexTarget: APDEX_TARGET
+ }
+ ) {
+ errors {
+ description
+ type
}
}
+ }
```
@@ -858,33 +822,30 @@ While you can't change the monitor type after creating it, you can update its se
>
To update a scripted API monitor (including the ability to upgrade the runtime version), use this:
- ```
- mutation {
- syntheticsUpdateScriptApiMonitor (
- guid: ENTITY_GUID,
- monitor: {
- locations: {
- public: ["LOCATION_1", "LOCATION_2"]
- },
- name: "YOUR_MONITOR_NAME",
- period: PERIOD,
- runtime: {
- runtimeType: "RUNTIME_TYPE",
- runtimeTypeVersion: "RUNTIME_TYPE_VERSION",
- scriptLanguage: "SCRIPT_LANGUAGE"
- }
- script: "SCRIPT_CONTENT",
- status: STATUS,
- apdexTarget: APDEX_TARGET
- }
- ) {
- errors {
- description
- type
+ ```graphql
+ mutation {
+ syntheticsUpdateScriptApiMonitor(
+ guid: ENTITY_GUID
+ monitor: {
+ locations: { public: ["LOCATION_1", "LOCATION_2"] }
+ name: "YOUR_MONITOR_NAME"
+ period: PERIOD
+ runtime: {
+ runtimeType: "RUNTIME_TYPE"
+ runtimeTypeVersion: "RUNTIME_TYPE_VERSION"
+ scriptLanguage: "SCRIPT_LANGUAGE"
}
+ script: "SCRIPT_CONTENT"
+ status: STATUS
+ apdexTarget: APDEX_TARGET
+ }
+ ) {
+ errors {
+ description
+ type
}
}
-
+ }
```
@@ -894,43 +855,42 @@ While you can't change the monitor type after creating it, you can update its se
>
Use this to update a step monitor:
- ```
+ ```graphql
mutation {
- syntheticsUpdateStepMonitor (
- guid: ENTITY_GUID,
+ syntheticsUpdateStepMonitor(
+ guid: ENTITY_GUID
monitor: {
- browsers: [BROWSERS],
- devices: [DEVICES],
- locations: {
- public: ["LOCATION_1", "LOCATION_2"]
- },
- name: "MONITOR_NAME",
- period: PERIOD,
+ browsers: [BROWSERS]
+ devices: [DEVICES]
+ locations: { public: ["LOCATION_1", "LOCATION_2"] }
+ name: "MONITOR_NAME"
+ period: PERIOD
runtime: {
- runtimeType: "RUNTIME_TYPE",
- runtimeTypeVersion: "RUNTIME_TYPE_VERSION",
+ runtimeType: "RUNTIME_TYPE"
+ runtimeTypeVersion: "RUNTIME_TYPE_VERSION"
scriptLanguage: "SCRIPT_LANGUAGE"
+ }
+ status: STATUS
+ steps: [
+ {
+ ordinal: 0,
+ type: NAVIGATE,
+ values: ["MONITORED_URI", "USER_AGENT"]
}
- status: STATUS,
- steps: [{
- ordinal: 0,
- type: NAVIGATE,
- values: ["MONITORED_URI"],["USER_AGENT"]
- },{
- ordinal: STEP_NUMBER,
- type: STEP_TYPE,
- values: ["VALUE_1","VALUE_2"]
- }]
- advancedOptions: {
- enableScreenshotOnFailureAndScript: ENABLE_SCREENSHOT
- },
+ {
+ ordinal: STEP_NUMBER,
+ type: STEP_TYPE,
+ values: ["VALUE_1", "VALUE_2"]
+ }
+ ]
+ advancedOptions: { enableScreenshotOnFailureAndScript: ENABLE_SCREENSHOT }
apdexTarget: APDEX_TARGET
}
) {
- errors {
- description
- type
- }
+ errors {
+ description
+ type
+ }
}
}
```
@@ -942,28 +902,26 @@ While you can't change the monitor type after creating it, you can update its se
>
Use this to update a certificate check monitor:
- ```
- mutation {
- syntheticsUpdateCertCheckMonitor (
- guid: ENTITY_GUID,
- monitor: {
- domain: "DOMAIN",
- locations: {
- public: ["LOCATION_1", "LOCATION_2"]
- },
- name: "YOUR_MONITOR_NAME",
- numberDaysToFailBeforeCertExpires: DAYS_UNTIL_EXPIRATION,
- period: PERIOD,
- status: STATUS,
- apdexTarget: APDEX_TARGET
- }
- ) {
- errors {
- description
- type
- }
+ ```graphql
+ mutation {
+ syntheticsUpdateCertCheckMonitor(
+ guid: ENTITY_GUID
+ monitor: {
+ domain: "DOMAIN"
+ locations: { public: ["LOCATION_1", "LOCATION_2"] }
+ name: "YOUR_MONITOR_NAME"
+ numberDaysToFailBeforeCertExpires: DAYS_UNTIL_EXPIRATION
+ period: PERIOD
+ status: STATUS
+ apdexTarget: APDEX_TARGET
+ }
+ ) {
+ errors {
+ description
+ type
}
}
+ }
```
@@ -973,29 +931,27 @@ While you can't change the monitor type after creating it, you can update its se
>
Use this to update a broken links monitor:
- ```
+ ```graphql
mutation {
- syntheticsUpdateBrokenLinksMonitor (
- guid: ENTITY_GUID,
+ syntheticsUpdateBrokenLinksMonitor(
+ guid: ENTITY_GUID
monitor: {
- locations: {
- public: ["LOCATION_1", "LOCATION_2"]
- },
- name: "YOUR_MONITOR_NAME",
- period: PERIOD,
- status: STATUS,
- apdexTarget: APDEX_TARGET,
- uri: "MONITOR_URI",
- tags: {
+ locations: { public: ["LOCATION_1", "LOCATION_2"] }
+ name: "YOUR_MONITOR_NAME"
+ period: PERIOD
+ status: STATUS
+ apdexTarget: APDEX_TARGET
+ uri: "MONITOR_URI"
+ tags: {
key: "YOUR_TAG_NAME",
- values: "TAG_VALUE"
- }
- }
- ) {
- errors {
- description
- type
+ values: "TAG_VALUE"
}
+ }
+ ) {
+ errors {
+ description
+ type
+ }
}
}
```
@@ -1012,10 +968,10 @@ While you can't change the monitor type after creating it, you can update its se
Check out [optional-fields](#optional-fields) for additional details on runtime settings.
- ```
+ ```graphql
mutation {
syntheticsUpdateScriptBrowserMonitor (
- guid: "",
+ guid: "ENTITY_GUID",
monitor: {
runtime: {
runtimeType: "RUNTIME_TYPE",
@@ -1044,10 +1000,10 @@ While you can't change the monitor type after creating it, you can update its se
Check out [optional-fields](#optional-fields) for additional details on runtime settings.
- ```
+ ```graphql
mutation {
syntheticsUpdateScriptBrowserMonitor (
- guid: "",
+ guid: "ENTITY_GUID",
monitor: {
runtime: {
runtimeType: "",
@@ -1077,11 +1033,11 @@ Use these scripts to delete your monitors:
>
Delete a monitor using the monitor entity GUID.
- ```
+ ```graphql
mutation {
syntheticsDeleteMonitor (
guid: "ENTITY_GUID"
- ) {
+ ) {
deletedGuid
}
}
@@ -1098,10 +1054,10 @@ A [private location](/docs/synthetics/synthetic-monitoring/private-locations/pri
id="private-location"
title="Create a private location"
>
- ```
- mutation{
+ ```graphql
+ mutation {
syntheticsCreatePrivateLocation (
- accountId: NR_ACCOUNT_ID,
+ accountId: ACCOUNT_ID,
name: "PrivateLocationName",
description: "Optional description",
verifiedScriptExecution: false
@@ -1120,18 +1076,18 @@ A [private location](/docs/synthetics/synthetic-monitoring/private-locations/pri
id="private-location"
title="Update a private location"
>
- ```
+ ```graphql
mutation {
syntheticsUpdatePrivateLocation (
- guid: YOUR_ENTITY_GUID,
+ guid: ENTITY_GUID,
description: "EnterYourDescription",
verifiedScriptExecution: true
) {
- description
- verifiedScriptExecution
- errors {
description
- type
+ verifiedScriptExecution
+ errors {
+ description
+ type
}
}
}
@@ -1142,11 +1098,11 @@ A [private location](/docs/synthetics/synthetic-monitoring/private-locations/pri
id="delete-private locations"
title="Delete a private location"
>
- ```
+ ```graphql
mutation {
syntheticsDeletePrivateLocation (
- guid: YOUR_ENTITY_GUID
- ) {
+ guid: ENTITY_GUID
+ ) {
errors {
description
type
@@ -1162,11 +1118,11 @@ A [private location](/docs/synthetics/synthetic-monitoring/private-locations/pri
>
If you need to clear an unwieldy backlog, use this:
- ```
+ ```graphql
mutation {
syntheticsPurgePrivateLocationQueue (
- guid: YOUR_ENTITY_GUID
- ) {
+ guid: ENTITY_GUID
+ ) {
errors {
description
type
@@ -1186,14 +1142,14 @@ You use [secure credentials](/docs/synthetics/synthetic-monitoring/using-monitor
id="secure-credential"
title="Create a secure credential"
>
- ```
+ ```graphql
mutation {
syntheticsCreateSecureCredential (
- accountId: YOUR_ENTITY_GUID,
+ accountId: ACCOUNT_ID,
description: "YourOptionalDescription",
key: SECURE_CREDENTIAL_NAME,
value: SECURE_CREDENTIAL_VALUE
- ) {
+ ) {
errors {
description
}
@@ -1206,13 +1162,14 @@ You use [secure credentials](/docs/synthetics/synthetic-monitoring/using-monitor
id="update-secure"
title="Update a secure credential"
>
- ```
+ ```graphql
mutation {
- syntheticsUpdateSecureCredential (
- accountId: YOUR_ACCOUNT_ID,
- description: "YourOptionalDescription",
- key: SECURE_CREDENTIAL_NAME,
- value: SECURE_CREDENTIAL_VALUE) {
+ syntheticsUpdateSecureCredential(
+ accountId: ACCOUNT_ID
+ description: "YourOptionalDescription"
+ key: SECURE_CREDENTIAL_NAME
+ value: SECURE_CREDENTIAL_VALUE
+ ) {
createdAt
lastUpdate
errors {
@@ -1227,12 +1184,12 @@ You use [secure credentials](/docs/synthetics/synthetic-monitoring/using-monitor
id="secure-credential"
title="Delete a secure credential"
>
- ```
+ ```graphql
mutation {
syntheticsDeleteSecureCredential (
- accountId: YOUR_ACCOUNT_ID,
+ accountId: ACCOUNT_ID,
key: SECURE_CREDENTIAL_NAME
- ) {
+ ) {
errors {
description
}
@@ -1251,13 +1208,13 @@ Monitor downtimes let you specify times that your synthetics should stop running
id="create-once-downtime"
title="Create a monitor downtime that runs once"
>
- ```
+ ```graphql
mutation {
syntheticsCreateOnceMonitorDowntime (
- accountId: NR_ACCOUNT_ID,
+ accountId: ACCOUNT_ID,
name: "MonitorDowntimeName",
monitorGuids: ["OptionalMonitorEntityGuid", "OptionalMonitorEntityGuid"],
- timezone: "Timezone",
+ timezone: "TIMEZONE",
startTime: "yyyy-MM-ddTHH:mm:ss",
endTime: "yyyy-MM-ddTHH:mm:ss"
) {
@@ -1277,13 +1234,13 @@ Monitor downtimes let you specify times that your synthetics should stop running
id="create-daily-downtime"
title="Create a monitor downtime that runs daily"
>
- ```
+ ```graphql
mutation {
syntheticsCreateDailyMonitorDowntime (
- accountId: NR_ACCOUNT_ID,
+ accountId: ACCOUNT_ID,
name: "MonitorDowntimeName",
monitorGuids: ["OptionalMonitorEntityGuid", "AnotherOptionalMonitorEntityGuid"],
- timezone: "Timezone",
+ timezone: "TIMEZONE",
startTime: "yyyy-MM-ddTHH:mm:ss",
endTime: "yyyy-MM-ddTHH:mm:ss",
endRepeat: {
@@ -1311,13 +1268,13 @@ Monitor downtimes let you specify times that your synthetics should stop running
id="create-weekly-downtime"
title="Create a monitor downtime that runs weekly"
>
- ```
+ ```graphql
mutation {
syntheticsCreateWeeklyMonitorDowntime (
- accountId: NR_ACCOUNT_ID,
+ accountId: ACCOUNT_ID,
name: "MonitorDowntimeName",
monitorGuids: ["OptionalMonitorEntityGuid", "AnotherOptionalMonitorEntityGuid"],
- timezone: "Timezone",
+ timezone: "TIMEZONE",
startTime: "yyyy-MM-ddTHH:mm:ss",
endTime: "yyyy-MM-ddTHH:mm:ss",
endRepeat: {
@@ -1347,13 +1304,13 @@ Monitor downtimes let you specify times that your synthetics should stop running
id="create-monthly-downtime"
title="Create a monitor downtime that runs monthly"
>
- ```
+ ```graphql
mutation {
syntheticsCreateMonthlyMonitorDowntime (
- accountId: NR_ACCOUNT_ID,
+ accountId: ACCOUNT_ID,
name: "MonitorDowntimeName",
monitorGuids: ["OptionalMonitorEntityGuid", "AnotherOptionalMonitorEntityGuid"],
- timezone: "Timezone",
+ timezone: "TIMEZONE",
startTime: "yyyy-MM-ddTHH:mm:ss",
endTime: "yyyy-MM-ddTHH:mm:ss",
endRepeat: {
@@ -1395,19 +1352,19 @@ Monitor downtimes let you specify times that your synthetics should stop running
id="update-downtime"
title="Update a monitor downtime"
>
- ```
+ ```graphql
mutation {
syntheticsEditMonitorDowntime (
guid: "MonitorDowntimeEntityGuid",
name: "MONITOR_DOWNTIME_NAME",
monitorGuids: ["OptionalMonitorEntityGuid", "AnotherOptionalMonitorEntityGuid"],
once: {
- timezone: "Timezone",
+ timezone: "TIMEZONE",
startTime: "yyyy-MM-ddTHH:mm:ss",
endTime: "yyyy-MM-ddTHH:mm:ss"
},
daily: {
- timezone: "Timezone",
+ timezone: "TIMEZONE",
startTime: "yyyy-MM-ddTHH:mm:ss",
endTime: "yyyy-MM-ddTHH:mm:ss",
endRepeat: {
@@ -1416,7 +1373,7 @@ Monitor downtimes let you specify times that your synthetics should stop running
}
},
weekly: {
- timezone: "Timezone",
+ timezone: "TIMEZONE",
startTime: "yyyy-MM-ddTHH:mm:ss",
endTime: "yyyy-MM-ddTHH:mm:ss",
endRepeat: {
@@ -1426,7 +1383,7 @@ Monitor downtimes let you specify times that your synthetics should stop running
maintenanceDays: [WeekDaysEnums]
},
monthly: {
- timezone: "Timezone",
+ timezone: "TIMEZONE",
startTime: "yyyy-MM-ddTHH:mm:ss",
endTime: "yyyy-MM-ddTHH:mm:ss",
endRepeat: {
@@ -1469,7 +1426,7 @@ Monitor downtimes let you specify times that your synthetics should stop running
id="delete-downtime"
title="Delete a monitor downtime"
>
- ```
+ ```graphql
mutation {
syntheticsDeleteMonitorDowntime (
guid: DOWNTIME_ENTITY_GUID
From 7b7004f783896d7de409bd055cddfacbe8ebda00 Mon Sep 17 00:00:00 2001
From: Abhilash Dutta
Date: Tue, 21 Jan 2025 09:41:11 +0530
Subject: [PATCH 18/20] Update change-tracking-view-analyze.mdx
---
.../docs/change-tracking/change-tracking-view-analyze.mdx | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/content/docs/change-tracking/change-tracking-view-analyze.mdx b/src/content/docs/change-tracking/change-tracking-view-analyze.mdx
index d1891c11b23..89e51a8efcb 100644
--- a/src/content/docs/change-tracking/change-tracking-view-analyze.mdx
+++ b/src/content/docs/change-tracking/change-tracking-view-analyze.mdx
@@ -249,9 +249,10 @@ Try these examples or create your own queries:
#### How markers are selected for inclusion on a chart [#nrql-markers-inclusion]
-Most charts are driven by a NRQL query that you can see by clicking on the three-dots at the tile's top-right corner. Given a query, we go through the following steps to determine which markers to include on the resulting chart.
- 1. Derive the set of entities relevant to the query - this includes both entities mentioned directly in the query as well as related entities. See below for more details.
- 2. Paint a marker for each change tracking event recorded for this set of entities (up to a limit of 5000 events).
+Most charts are driven by a NRQL query, which you can view by clicking the three dots in the tile's top-right corner. When working with a query, follow these steps to determine which markers to include on the resulting chart:
+
+1. Derive the set of relevant entities that includes both entities mentioned directly in the query and related entities. Refer to the section below for more details.
+2. Paint a marker for each change-tracking event recorded for this set of entities, plot a marker, with a limit of up to 5,000 events.
The entities relevant to the chart are derived from the NRQL query based on the following logic:
* Entities that are directly specified in the query for the chart using either an `IN` or `=` operator (e.g. queries with an `WHERE entity.guid IN ('MTE2NjAxMzJ8QVBNfEFQUExJQ0FUSU9OfDEyMDk1MjY5')` clause). While we use `entity.guid` as an example, other properties may also be used to explicitly designate entities for the query. They are:
From 28bcbc1ab3af79dc5cdf2e308695fc256ecdce37 Mon Sep 17 00:00:00 2001
From: Abhilash Dutta
Date: Tue, 21 Jan 2025 09:43:20 +0530
Subject: [PATCH 19/20] Update change-tracking-view-analyze.mdx
---
.../docs/change-tracking/change-tracking-view-analyze.mdx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/content/docs/change-tracking/change-tracking-view-analyze.mdx b/src/content/docs/change-tracking/change-tracking-view-analyze.mdx
index 89e51a8efcb..23624d7c527 100644
--- a/src/content/docs/change-tracking/change-tracking-view-analyze.mdx
+++ b/src/content/docs/change-tracking/change-tracking-view-analyze.mdx
@@ -271,7 +271,7 @@ The entities relevant to the chart are derived from the NRQL query based on the
Please be advised that __NRQL queries for charts are currently scoped to a single account__. This means that if you specify entity-GUIDs belonging to multiple accounts, only markers from a single account will be visualized.
-For example, let's say that the query for your chart looks like the following:
+For example, let's consider that the query for your chart looks like the following:
```
FROM Transaction SELECT count(*) WHERE entityGuid IN ('MTE2NjAxMzJ8QVBNfEFQUExJQ0FUSU9OfDg0MTY1OTI','MTEwNjI2OTl8QVBNfEFQUExJQ0FUSU9OfDg5ODEwMDk5') TIMESERIES MAX SINCE 2 weeks AGO
```
From 6462f59eeee70f15bc28025224cb26b2bf82fea4 Mon Sep 17 00:00:00 2001
From: NewRelic-K8s-Agents-Bot
Date: Tue, 21 Jan 2025 12:03:24 +0000
Subject: [PATCH 20/20] feat: Add release notes for Kubernetes integration
v3.33.0
---
.../kubernetes-integration-3-33-0.mdx | 11 +++++++++++
1 file changed, 11 insertions(+)
create mode 100644 src/content/docs/release-notes/infrastructure-release-notes/kubernetes-integration-release-notes/kubernetes-integration-3-33-0.mdx
diff --git a/src/content/docs/release-notes/infrastructure-release-notes/kubernetes-integration-release-notes/kubernetes-integration-3-33-0.mdx b/src/content/docs/release-notes/infrastructure-release-notes/kubernetes-integration-release-notes/kubernetes-integration-3-33-0.mdx
new file mode 100644
index 00000000000..62375ecfe1a
--- /dev/null
+++ b/src/content/docs/release-notes/infrastructure-release-notes/kubernetes-integration-release-notes/kubernetes-integration-3-33-0.mdx
@@ -0,0 +1,11 @@
+---
+subject: Kubernetes integration
+releaseDate: '2025-01-21'
+version: 3.33.0
+---
+
+For a detailed description of changes, see the [release notes](https://github.com/newrelic/nri-kubernetes/releases/tag/v3.33.0).
+
+This integration is included in the following chart versions:
+* [newrelic-infrastructure-3.38.0](https://github.com/newrelic/nri-kubernetes/releases/tag/newrelic-infrastructure-3.38.0)
+* [nri-bundle-5.0.107](https://github.com/newrelic/helm-charts/releases/tag/nri-bundle-5.0.107)