Code Monkey home page Code Monkey logo

adonis-newrelic's Introduction

Registering provider

Setup

Add new relic provider in the top of providers list.

// app/start.js

const providers = [
  `@frubana/adonis-newrelic/providers/Provider`
  // ...
];

In the main directory add newrelic.js and copy

/** @type {import('@adonisjs/framework/src/Env')} */
const Env = use("Env");

/**
 * New Relic agent configuration.
 *
 * See lib/config/default.js in the agent distribution for a more complete
 * description of configuration variables and their potential values.
 */
exports.config = {
  /**
   * Array of application names.
   */
  app_name: [Env.get("APP_NAME")],
  /**
   * Your New Relic license key.
   */
  license_key: Env.get("NEW_RELIC"),

  logging: {
    /**
     * Level at which to log. 'trace' is most useful to New Relic when diagnosing
     * issues with the agent, 'info' and higher will impose the least overhead on
     * production applications.
     */
    level: "info"
  },
  /**
   * When true, all request headers except for those listed in attributes.exclude
   * will be captured for all traces, unless otherwise specified in a destination's
   * attributes include/exclude lists.
   */
  allow_all_headers: true,

  attributes: {
    /**
     * Prefix of attributes to exclude from all destinations. Allows * as wildcard
     * at end.
     *
     * NOTE: If excluding headers, they must be in camelCase form to be filtered.
     *
     * @env NEW_RELIC_ATTRIBUTES_EXCLUDE
     */
    exclude: [
      "request.headers.cookie",
      "request.headers.authorization",
      "request.headers.proxyAuthorization",
      "request.headers.setCookie*",
      "request.headers.x*",
      "response.headers.cookie",
      "response.headers.authorization",
      "response.headers.proxyAuthorization",
      "response.headers.setCookie*",
      "response.headers.x*"
    ]
  }
};

In your .env file add this variable and paste your new relic key

NEW_RELIC=

adonis-newrelic's People

Contributors

alejandrognz avatar andresilvagomez avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adonis-newrelic's Issues

Memory leak

Greetings!

I've been using your package in a production environment and I've detected a memory leak coming from this module that I'm now investigating.

By using the chrome dev tools I was able to detect that somehow the following lines are the ones that cause the memory leak, can you help me out find why is that so?

this.Route.match = shim.recordMiddleware(this.Route.match, {
   type: shim.ROUTER,
   route: request.url(),
   req() {
       return req;
   },
   res() {
       return res;
    },
});

Testing methodology:

  • I cloned the code in the master branch to my Providers folder and linked it to the start/app.js providers.
  • I started commenting out parts of the code and after commenting that piece of code, the memory leak disappeared

Proof:

  • A memory snapshot was taken every 100 requests to a generic route
    No changes:
    image

After commenting out that piece of code:
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.