How to use the @automattic/vip-go.newrelic function in @automattic/vip-go

To help you get started, we’ve selected a few @automattic/vip-go examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alleyinteractive / irving / packages / vip-go / services / monitorService.js View on Github external
const getService = () => {
  // newrelic cannot be imported in a browser environment.
  if (! process.env.BROWSER) {
    // Attempt to create newrelic client using vip go package.
    try {
      const { newrelic, logger } = require('@automattic/vip-go'); // eslint-disable-line global-require
      const client = newrelic({
        logger: logger('irving:newrelic'),
      });

      // VIP Go's package can return nothing if newrelic is not instsalled or configured improperly.
      if (! client) {
        return defaultService;
      }

      return {
        client,
        start: () => {},
        logError(err) {
          client.noticeError(err);
        },
        logTransaction(method, status, category) {
          client.setTransactionName(`${method} ${status} ${category}`);

@automattic/vip-go

Node package helpers for the VIP Go platform

ISC
Latest version published 4 years ago

Package Health Score

52 / 100
Full package analysis

Similar packages