• /
  • EnglishEspañolFrançais日本語한국어Português
  • EntrarComeçar agora

Esta tradução de máquina é fornecida para sua comodidade.

Caso haja alguma divergência entre a versão em inglês e a traduzida, a versão em inglês prevalece. Acesse esta página para mais informações.

Criar um problema

RCA de alerta com Autopilot e Slack

Quando um alerta é acionado, acione o Autopilot para executar uma análise de causa raiz e publicar as descobertas diretamente em um canal do Slack. Se o Autopilot não retornar nenhuma resposta utilizável, o fluxo de trabalho enviará um aviso de erro para que a equipe saiba que deve investigar manualmente.

Antes de usar este fluxo de trabalho, certifique-se de ter:

  • Um ID de problema de alerta da New Relic em formato UUID
  • Um destino do Slack configurado no New Relic — consulte Criar Destinos
  • O UUID do destino e o nome do canal do Slack de destino

Este fluxo de trabalho completa as seguintes etapas:

  1. Envia uma mensagem inicial do Slack para reconhecer o alerta e informar à equipe que a RCA está em andamento
  2. Executa o Autopilot com um prompt de análise de causa raiz com escopo no ID do problema do alerta
  3. Verifica se o Autopilot retornou uma resposta utilizável
  4. Em caso de sucesso: reformata a resposta como blocos do Slack Block Kit e publica as descobertas no Slack se o Autopilot for bem-sucedido.
  5. Em caso de falha: publica uma mensagem de erro com o ID do problema se o Autopilot falhar.

Este fluxo de trabalho utiliza newrelic.autopilot.run e newrelic.notification.sendSlack

name: autopilotSlackRCA
description: Automatically analyze New Relic alerts with Autopilot and send cleanly formatted findings to Slack
workflowInputs:
issueId:
type: String
required: true
validations:
- errorMessage: Must be a valid New Relic issue ID in UUID format
pattern: '^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$'
type: regex
slackDestinationId:
type: String
required: true
validations:
- pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
errorMessage: "Invalid format. Please provide a valid UUID."
type: regex
channel:
type: String
required: true
steps:
- name: notifyAlertReceived
type: action
action: newrelic.notification.sendSlack
version: 1
inputs:
destinationId: ${{ .workflowInputs.slackDestinationId }}
channel: ${{ .workflowInputs.channel }}
text: |-
🔔 *Alert Received — Starting Root Cause Analysis*
⏳ Running Autopilot for RCA, please wait...
- name: runAutopilot
type: action
action: newrelic.autopilot.run
version: 1
inputs:
prompt: >-
Perform a root cause analysis for the following New Relic alert:
Issue ID: ${{ .workflowInputs.issueId }}
Provide your comprehensive analysis including Summary, Root Cause, and Remediation Actions.
selectors:
- name: agentResponse
expression: .response.finalAnswer
ignoreErrors: true
- name: checkAgentResponse
type: switch
switch:
- condition: ${{ (.steps.runAutopilot.outputs.agentResponse // "") != "" }}
next: buildSlackBlocks
next: sendAutopilotError
- name: buildSlackBlocks
type: assign
inputs:
blocks: '${{ (.steps.runAutopilot.outputs.agentResponse // "") as $r | (if ($r|type)=="string" then ($r | try fromjson catch null) else $r end) as $json | (if ($json|type)=="array" then ($json[0].text // ($json | tostring)) elif ($json|type)=="object" and ($json.card.body|type)=="array" then [ $json.card.body[] | if .type=="Text" then (.value // "") else "" end ] | join("\n\n") elif ($json|type)=="object" and ($json.text|type)=="string" then $json.text else ($r | tostring) end) | gsub("\\*\\*"; "*") | gsub("### "; "*") | gsub("## "; "*") as $text | ([ $text / "\n" ]) as $lines | [ { "type": "header", "text": { "type": "plain_text", "text": "✅ Autopilot RCA Complete" } }, { "type": "divider" } ] + [ $lines[][] | select(. != "") | { "type": "section", "text": { "type": "mrkdwn", "text": . } } ] }}'
next: sendRcaFindings
- name: sendRcaFindings
type: action
action: newrelic.notification.sendSlack
version: 1
inputs:
destinationId: ${{ .workflowInputs.slackDestinationId }}
channel: ${{ .workflowInputs.channel }}
blocks: ${{ .steps.buildSlackBlocks.outputs.blocks }}
next: end
- name: sendAutopilotError
type: action
action: newrelic.notification.sendSlack
version: 1
inputs:
destinationId: ${{ .workflowInputs.slackDestinationId }}
channel: ${{ .workflowInputs.channel }}
text: |-
🟥 *Autopilot RCA Failed*
Could not extract findings from Autopilot response for issue: ${{ .workflowInputs.issueId }}
Please investigate manually.
next: end

Visão geral do Autopilot

Saiba como o Autopilot investiga alertas e incidentes

Lógica condicional

Utilize instruções switch para ramificar em caso de sucesso ou falha

Enviar notificações do Slack

Referência completa para a ação sendSlack

Criar destinos

Configure o destino do Slack exigido por este fluxo de trabalho

Copyright © 2026 New Relic Inc.

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