Command Palette

Search for a command to run...

Назад к скиллам
скилл № 62030

new-relic

Set up and manage New Relic for full-stack observability including APM, browser monitoring, infrastructure monitoring, and alerting. Use when a user needs to…

БесплатноБез исполняемых скриптов
TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Установить new-relic в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

New Relic

Overview

Configure New Relic for application performance monitoring, infrastructure observability, browser real-user monitoring, and intelligent alerting. Covers agent installation, NRQL querying, dashboard creation, and alert policy configuration.

Instructions

Install the APM agent (Node.js)

# Install New Relic Node.js agent
npm install newrelic

Agent 14.x requires Node.js 22 or newer (engines.node in the npm package); 12.x is the line for older Node. The license key is the ingest license key of the account, not a NRAK- user API key.

// newrelic.js — New Relic agent configuration (must be first require)
'use strict'
exports.config = {
  app_name: ['payment-service'],
  license_key: process.env.NEW_RELIC_LICENSE_KEY,
  distributed_tracing: { enabled: true },
  logging: { level: 'info' },
  allow_all_headers: true,
  attributes: {
    exclude: [
      'request.headers.cookie',
      'request.headers.authorization',
    ]
  },
  transaction_tracer: {
    enabled: true,
    transaction_threshold: 'apdex_f',
    record_sql: 'obfuscated',
  },
  error_collector: {
    enabled: true,
    ignore_status_codes: [404, 401],
  },
}
// app.js — load New Relic before anything else
require('newrelic')
const express = require('express')
const app = express()

app.get('/api/orders', async (req, res) => {
  res.json([{ id: 'ord_1042', total: 59.9 }])
})

app.listen(3000)

For an ES-module app, rename newrelic.js to newrelic.cjs and start with node --import newrelic/esm-loader.mjs -r newrelic app.js.

Install the infrastructure agent (Ubuntu)

Per the official apt instructions (use your release codename in place of noble):

echo "license_key: ${NEW_RELIC_LICENSE_KEY}" | sudo tee -a /etc/newrelic-infra.yml
curl -fsSL https://download.newrelic.com/infrastructure_agent/gpg/newrelic-infra.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/newrelic-infra.gpg
echo "deb https://download.newrelic.com/infrastructure_agent/linux/apt noble main" | sudo tee -a /etc/apt/sources.list.d/newrelic-infra.list
sudo apt-get update && sudo apt-get install newrelic-infra -y

Then add the options you need to /etc/newrelic-infra.yml and restart with sudo systemctl restart newrelic-infra:

# /etc/newrelic-infra.yml — Infrastructure agent config
# license_key is already set by the echo step above
display_name: "web-server-01"
custom_attributes:
  environment: production
  team: platform
  region: us-east-1
enable_process_metrics: true
metrics_system_sample_rate: 15
metrics_network_sample_rate: 15

Browser monitoring

Create a Browser application in the New Relic UI (Add data > Browser monitoring), choose the copy/paste method and paste the generated <script> into <head> of every page, as high as possible. The snippet carries your application ID and keys; do not hand-write it. The same screen offers the npm @newrelic/browser-agent package for bundled apps.

Examples

NRQL queries

-- Find slowest transactions in the last hour
SELECT average(duration), max(duration), count(*)
FROM Transaction
WHERE appName = 'payment-service'
FACET name
SINCE 1 hour ago
ORDER BY average(duration) DESC
LIMIT 20
-- Error rate by deployment version
SELECT percentage(count(*), WHERE error IS true) AS 'Error Rate'
FROM Transaction
WHERE appName = 'payment-service'
FACET tags.version
SINCE 1 day ago
TIMESERIES 15 minutes
-- Apdex score trend over time
SELECT apdex(duration, 0.5) AS 'Apdex'
FROM Transaction
WHERE appName = 'payment-service'
SINCE 7 days ago
TIMESERIES 1 hour
-- Infrastructure: hosts with high CPU
SELECT average(cpuPercent), max(memoryUsedPercent)
FROM SystemSample
WHERE environment = 'production'
FACET hostname
SINCE 30 minutes ago

The three calls below use a user API key (NRAK-...) in NEW_RELIC_USER_API_KEY and a real account ID in place of 1234567; EU accounts post to https://api.eu.newrelic.com/graphql. Each returns the created id or guid.

Alert policy and condition via NerdGraph

# Create an alert policy via NerdGraph API
curl -sS -X POST 'https://api.newrelic.com/graphql' \
  -H "Content-Type: application/json" \
  -H "Api-Key: ${NEW_RELIC_USER_API_KEY}" \
  -d '{
    "query": "mutation { alertsPolicyCreate(accountId: 1234567, policy: { name: \"Payment Service - Production\", incidentPreference: PER_CONDITION_AND_TARGET }) { id name } }"
  }'
# Create a NRQL alert condition — High error rate
curl -sS -X POST 'https://api.newrelic.com/graphql' \
  -H "Content-Type: application/json" \
  -H "Api-Key: ${NEW_RELIC_USER_API_KEY}" \
  -d '{
    "query": "mutation { alertsNrqlConditionStaticCreate(accountId: 1234567, policyId: 987654, condition: { name: \"High Error Rate\", enabled: true, nrql: { query: \"SELECT percentage(count(*), WHERE error IS true) FROM Transaction WHERE appName = '\''payment-service'\''\" }, signal: { aggregationWindo
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • _scores.json

FAQ

Что делает скилл new-relic?

Set up and manage New Relic for full-stack observability including APM, browser monitoring, infrastructure monitoring, and alerting. Use when a user needs to instrument applications, write NRQL queries, create dashboards, configure alert policies, or integrate New Relic with their deployment pipeline.

Как установить скилл new-relic?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл new-relic запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить new-relic с