Someone tells you, "Hey your site is being slow right now." What do you do? Restart Odoo? Look at Nginx access logs? Could it be PostgreSQL? We've all been there...
- Install the newrelic python package through pip or from source:
`
pip3 install newrelic
`
- Create a newrelic.ini file New Relic Python Quick Start (you can skip if you'd rather use ENV variable, see (3) from below):
`
newrelic-admin generate-config YOUR_LICENSE_KEY /etc/odoo-newrelic.ini
`
- Add this module to your existing addons folder or create a new addons folder and add it to the Odoo addons path.
4) Make sure that Odoo loads and uses your New Relic details which are usually set in a New Relic configuration file. Add the New Relic configuration file to your odoo-server.conf file:
`
new_relic_config_file = /etc/odoo-newrelic.ini
# optionally you can set type of the environment "development", "test", "staging" or "production"
new_relic_environment = staging
# optionally set tracing level (default is odoo.models.BaseModel:limited)
new_relic_odoo_trace = odoo.models.BaseModel:public
`
Optionally you can set environment variables for the whole New Relic configuration. See New Relic Python Agent Configuration
Set environment variable NEW_RELIC_ODOO_TRACE to control what functions the module will purpusefully trace.
- Restart your odoo process and install the 'newrelic' module in Odoo Apps. (You may need to restart your odoo server again and look at the logs for information about a misconfiguration or missing modules.)
- Web errors (like 404's) are not treated as errors.
- Server errors (like 500's) are caught and show up in the Errors area.
- Transactions are named by route.
- PostgreSQL and Python metrics are easily visible.
- Front end page metrics (page rendering) is enabled by default. (only on the front end)
- Works in threaded (workers=0) and multi process (workers>0) modes.
- Configurable function tracing with defaults for a subset of ORM Methods to preserve performance.
- Due to the nature of /longpolling, this transaction is ignored on purpose. (feature?)
- Background tasks are not profiled.
- Could probably use better transaction naming.
Please see LICENSE.
Copyright Hibou Corp. 2020. This module was not sponsored in any way by New Relic, I just happen to like profiling.