• /
  • EnglishEspañolFrançais日本語한국어Português
  • 로그인지금 시작하기

사용자의 편의를 위해 제공되는 기계 번역입니다.

영문본과 번역본이 일치하지 않는 경우 영문본이 우선합니다. 보다 자세한 내용은 이 페이지를 방문하시기 바랍니다.

문제 신고

Autopilot 및 Slack을 사용한 공지 RCA

|View as Markdown (English)

When an alert fires, trigger Autopilot to run a root cause analysis and post the findings directly to a Slack channel. If Autopilot returns no usable response, the workflow sends an error notice instead so the team knows to investigate manually.

이 워크플로우를 사용하기 전에 다음 사항을 확인하십시오:

  • UUID 형식의 뉴렐릭 공지 문제 ID
  • 뉴렐릭에 구성된 Slack 대상 ― 대상 생성참조
  • 대상의 UUID 및 타겟 Slack 채널 이름

When triggering this workflow from Alert Workflows, use {{ issueId }} as the value for the issueId input. This variable automatically passes the triggering alert's issue ID to the workflow.

이 워크플로우는 다음 단계를 완료합니다:

  1. 공지를 확인하고 팀에 RCA가 진행 중임을 알리는 초기 Slack 메시지를 보냅니다
  2. Runs Autopilot with a root cause analysis prompt scoped to the alert issue ID
  3. Checks whether Autopilot returned a usable response
  4. If Autopilot succeeds, reformats the response as Slack Block Kit blocks and posts findings to Slack
  5. If Autopilot fails, posts an error message with the issue ID

This workflow uses newrelic.autopilot.run and newrelic.notification.sendSlack.

중요

Selector expression values must be written on a single line. Multi-line YAML block scalars (| or |-) aren't evaluated for selector expressions and silently produce no output.

Autopilot's finalAnswer field can return as either a plain string or a JSON-encoded object depending on prompt context. The analysisText selector in this workflow handles both shapes automatically.

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: analysisRaw
expression: .response.finalAnswer
- name: analysisText
expression: '(.response.finalAnswer | if type=="string" then fromjson else . end).card.body | map(.value) | join("\n\n")'
ignoreErrors: true
- name: checkAgentResponse
type: switch
switch:
- condition: ${{ (.steps.runAutopilot.outputs.analysisRaw // "") != "" }}
next: buildSlackBlocks
next: sendAutopilotError
- name: buildSlackBlocks
type: assign
inputs:
blocks: '${{ (.steps.runAutopilot.outputs.analysisText // "") | 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

작동 원리

The runAutopilot step uses two selectors to handle finalAnswer shape variability at the data-extraction layer:

  • analysisRaw captures the raw finalAnswer value. The checkAgentResponse step uses this to determine whether Autopilot returned anything.
  • analysisText normalizes the value — if finalAnswer is a JSON-encoded string, it parses it first, then extracts text content from .card.body. The buildSlackBlocks step uses analysisText directly, which keeps the formatting logic simple.

buildSlackBlocks converts **bold** and ###/## heading markers to Slack mrkdwn format, splits the result on newlines, and wraps each non-empty line in a Block Kit section block.

오토파일럿 개요

Autopilot이 알림 및 인시던트를 조사하는 방법을 알아보십시오.

조건부 논리

성공 또는 실패 시 분기하기 위해 switch 문 사용

Slack 공지 보내기

sendSlack 작업에 대한 전체 참조

목적지를 생성하세요

이 워크플로우에 필요한 Slack 대상을 구성하십시오.

흐름 흐름 자동화 문제 해결

Solutions for common Autopilot and Slack integration issues

Copyright © 2026 New Relic Inc.

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