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

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

In the event of any inconsistency between the English version and the translated version, the English versionwill take priority. Please visit this page for more information.

Criar um problema

Adicionar atributo personalizado aos dados de monitoramento sintético

O $util.insights da New Relic é um conjunto de ferramentas para definir e manipular eventos relatados a partir de monitoramento sintético.

Você pode adicionar dados customizados como atributo personalizado, com o prefixo custom, ao evento SyntheticCheck . Esses atributo são adicionais ao atributo padrão do evento.

Compatibilidade

Esta funcionalidade está disponível para monitores versões 0.2.0 ou posteriores.

Funções

Função

Valor de retorno

$util.insights.set(key: string, value: ?)

Define um par de valor principal.

vazio

$util.insights.get(key: string)

Retorna o valor da chave fornecida.

objeto

$util.insights.getKeys()

Retorna uma matriz de chaves atualmente definidas.

objeto

$util.insights.has(key: string)

Retornará true se a chave existir nos dados.

boleano

$util.insights.unset(key: string)

Remove o par valor principal.

vazio

$util.insights.unsetAll()

Remove todos os dados personalizados.

vazio

Exemplo

O exemplo obtém o incidente mais recente do feed de status RSS da New Relic e salva os detalhes desse evento.

var parseString = require('xml2js').parseString;
// Get the New Relic status RSS feed
$http.get('https://status.newrelic.com/history.rss', function(err, response, body) {
parseString(body, function(err, result){
// Parse the RSS, and get the latest incident
var latestIncident = result.rss.channel[0].item[0];
// Push the incident details to New Relic
$util.insights.set('Incident', latestIncident.title[0]);
$util.insights.set('Description', latestIncident.description[0]);
$util.insights.set('Date', latestIncident.pubDate[0]);
});
});

Para visualizar os dados do incidente enviados para a New Relic neste exemplo, use esta consulta:

FROM SyntheticCheck SELECT latest(custom.Date), latest(custom.Incident), latest(custom.Description) WHERE monitorName = "Monitor Name Here"
Copyright © 2024 New Relic Inc.

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