New Relic · Arazzo Workflow

New Relic Prune NRQL Condition

Version 1.0.0

Resolve a policy by name, list its NRQL conditions, and delete one.

1 workflow 1 source API 1 provider
View Spec View on GitHub AnalysisAnalyticsAPMDevOpsInfrastructureMonitoringObservabilityPerformancePlatformArazzoWorkflows

Provider

new-relic

Workflows

prune-nrql-condition
Resolve a policy, find a NRQL condition, and delete it.
Filters policies by name, lists the NRQL conditions scoped to the matched policy, captures the first condition id, and deletes it.
3 steps inputs: policyName outputs: deletedConditionId, policyId
1
findPolicy
getAlertsPolicies
Resolve the alert policy id by exact name.
2
listNrqlConditions
getAlertsNrqlConditions
List the NRQL conditions attached to the resolved policy and capture a condition id to delete.
3
deleteNrqlCondition
deleteAlertsNrqlConditionsConditionId
Delete the identified NRQL condition so the policy stops evaluating the retired query.

Source API Descriptions

Arazzo Workflow Specification

new-relic-prune-nrql-condition-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: New Relic Prune NRQL Condition
  summary: Resolve a policy by name, list its NRQL conditions, and delete one.
  description: >-
    A cleanup pattern for retiring stale NRQL alert conditions. The workflow
    resolves an alert policy by name, lists the NRQL conditions attached to that
    policy, captures one condition id, and deletes it so the policy no longer
    evaluates the retired query. Every step spells out its request inline so the
    flow can be read and executed without opening the underlying OpenAPI
    description.
  version: 1.0.0
sourceDescriptions:
- name: newRelicApi
  url: ../openapi/new-relic-openapi.yml
  type: openapi
workflows:
- workflowId: prune-nrql-condition
  summary: Resolve a policy, find a NRQL condition, and delete it.
  description: >-
    Filters policies by name, lists the NRQL conditions scoped to the matched
    policy, captures the first condition id, and deletes it.
  inputs:
    type: object
    required:
    - policyName
    properties:
      policyName:
        type: string
        description: The exact name of the alert policy whose NRQL condition to prune.
  steps:
  - stepId: findPolicy
    description: Resolve the alert policy id by exact name.
    operationId: getAlertsPolicies
    parameters:
    - name: filter[name]
      in: query
      value: $inputs.policyName
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      policyId: $response.body#/policy/id
  - stepId: listNrqlConditions
    description: >-
      List the NRQL conditions attached to the resolved policy and capture a
      condition id to delete.
    operationId: getAlertsNrqlConditions
    parameters:
    - name: policy_id
      in: query
      value: $steps.findPolicy.outputs.policyId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      conditionId: $response.body#/nrql_condition/id
  - stepId: deleteNrqlCondition
    description: >-
      Delete the identified NRQL condition so the policy stops evaluating the
      retired query.
    operationId: deleteAlertsNrqlConditionsConditionId
    parameters:
    - name: condition_id
      in: path
      value: $steps.listNrqlConditions.outputs.conditionId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      deletedCondition: $response.body#/nrql_condition
  outputs:
    policyId: $steps.findPolicy.outputs.policyId
    deletedConditionId: $steps.listNrqlConditions.outputs.conditionId