Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

newrelic-node

Package Overview
Dependencies
Maintainers
3
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

newrelic-node

Logger para newrelic

  • 0.3.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
increased by66.67%
Maintainers
3
Weekly downloads
 
Created
Source

Agente de newrelic para node.

Instalación

npm install newrelic-node

Configuración

Editar el archivo newrelic/newrelic.yml con la license_key y app_name de la aplicación correspondiente.

Use con Express:

var newrelic = require( "newrelic-node" );
app.use(newrelic.express);	

Uso manual:

var newrelic = require( "newrelic-node" );

newrelic.logRequest(request, response, timespent);
o
newrelic.log({timespent:{"URI_WEB_TRANSACTION":5000}, 
	path:"/test", httpStatus:200, httpMethod:"GET"});
o
newrelic.log({timespent:{"URI_WEB_TRANSACTION":5000, WEB_TRANSACTION_EXTERNAL_ALL: 1000}}, }
	path:"/test", httpStatus:200, httpMethod:"GET"});
o
newrelic.log({timespent:{"URI_WEB_TRANSACTION":100}, 
	path:"/test", httpStatus:200, httpMethod:"GET", calls:100}); //simula 100 request

Loguear errores manualmente:

var newrelic = require( "newrelic-node" );
newrelic.logRequestError("Un mensaje de error", request, response, timespent);
o
newrelic.log({timespent:{"URI_WEB_TRANSACTION":12}, error: "Mensaje de error", 
	path:"/error", httpStatus:500, httpMethod:"GET"}});		

Custom Metrics:

var newrelic = require( "newrelic-node" );
newrelic.log({timespent:{URI_WEB_TRANSACTION:5}, path:"/test", httpStatus:201, httpMethod:"GET", 
	custom_metric:[{name:"tiempo", type: "time", value:1 }, {name:"tiempo", type: "counter", value:1000 }]});

Las custom metrics son de tipo "counter" o "time". Las mismas se pueden graficar en una custom view como /CUSTOM/name.

Tipos de timespent:

  • External/allWeb

  • WebTransaction/Uri

  • WebFrontend/QueueTime

  • Database/allWeb

  • Solr/allWeb

Cada timespent es independiente en el dashboard de newrelic, se pueden enviar varios concatenados en el mismo mensaje.

Formato de Json:

{timespent:
	{type_timespent:(number|double|date), type_timespent:(number|double|date)},
	path:string, 
	httpStatus:number, 
	httpMethod:string, 
	custom_metric:[
		{name:string, type:counter, value:(numbre|double|string) }, 
		{name:string, type:time, value:(number|double) }
	],
	calls: number}

Entorno de desarrollo:

Para que no levante el proceso en entorno de desarrollo se puede usar: NODE_ENV=development node app.js

Requisitos:

JAVA 1.6

Como funciona?

Como newrelic no tiene soporte nativo para nodejs, lo que hace el modulo es levantar un proceso java que loguea en newrelic. El proceso java usa MINA para comunicarse con nodejs.

Herramientas usadas:

Mina (mina.apache.org)

FAQs

Package last updated on 06 Dec 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc