Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install collective.newrelic

How to install collective.newrelic

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install collective.newrelic
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
1.0.7 Available View build log
Linux (64-bit)
1.0.7 Available View build log
 
License
GPL
Dependencies
Lastest release
version 1.0.7 on Jul 19th, 2013

Introduction

This package offers instrumentation for NewRelic ( http://www.newrelic.com ). Currently the catalog-tool, transformchains and zope-events are instrumented. A transform is included to support RUM (Real-User-Monitoring): it inserts small snippets of javascript at the top and bottom of the rendered pages. RUM does not work in the ZMI (Zope Management Interface).

Installation

You can add this egg 'collective.newrelic' to your eggs and it will pull in the 'newrelic' egg too. However, to get the scripts installed into your bin directory, you need to add this to your buildout.cfg (using mr.developer)

sources = sources

parts +=
    newrelic

auto-checkout =
    collective.newrelic

[sources]
collective.newrelic = git git@github.com:Goldmund-Wyldebeast-Wunderliebe/collective.newrelic.git

[newrelic]
recipe = zc.recipe.egg:scripts
eggs = newrelic

[instance]
eggs +=
    collective.newrelic

Please note: the newrelic package needs python >= 2.5. This package will not work on Plone 3.

Use

To enable the logging to newrelic.com, create an account at newrelic.com and get your license key. Create a 'newrelic.ini' file in the root of your project. Either by copying the template from this package or the newrelic package or run

$ bin/newrelic-admin generate-config YOUR-LICENSE-KEY newrelic.ini

This will create a newrelic.ini file in the current directory.

The default profile is 'staging', this can be changed in the __init__.py in the patches directory. You can change the default name of 'Python Application (Staging)' in the newrelic.ini file. To get sensible database-traces change

transaction_tracer.record_sql = obfuscated

to

transaction_tracer.record_sql = raw
Example usage

In utils you find a few helper functions to wrap (parts) of your products and/or plone and/or any python module. For example you could make a simple egg called myproduct.newrelic with only an __init__.py. Within that file you have a '''initialize''' function, therein you use the helper functions for further wrapping.

Full class+function wrapping of an entire module

from plone.app import viewletmanager as plone_viewletmanager
from collective.newrelic.utils import wrap_module_classes_functions
class_function_modules = [plone_viewletmanager, ]
wrapped_methods = wrap_module_classes_functions(class_function_modules)
print len(wrapped_methods)

Single class wrapping

from zope.tal.talinterpreter import TALInterpreter
from collective.newrelic.utils import wrap_class_found_functions
wrapped_methods = wrap_class_found_functions(TALInterpreter)
print len(wrapped_methods)

Pin point precision wrapping of single class function

from zope.tal.talinterpreter import TALInterpreter
from collective.newrelic.utils import wrap_class_function
wrapped_methods = wrap_class_function(TALInterpreter, TALInterpreter.__call__)
print wrapped_methods
"TALInterpreter.__call__"
Troubleshooting

If you see a message The Python Agent is not enabled. in the Zope instance log, check your newrelic.ini file and make sure its [newrelic:development] has monitor_mode = true.

It can also mean that the newrelic.ini cannot be found. For example, if you run ${buildout:directory}/bin/instance fg, Newrelic looks in ${buildout:directory} for the .ini file. When started via supervisor, it looks in ${buildout:directory}/bin/

Change history

1.0.7 (2013-07-11)

  • Documentation typos [khink]
  • Documentation checking for pypi release [puittenbroek]
  • Patch cron4plone tick (if present) to make it a backgroundtask [puittenbroek]
  • Improve hook logic to worker properly in ZMI [puittenbroek]

1.0.6 - unreleased

  • Changed naming of transactions, now based on view/templates being used [puittenbroek]
  • Ignore transactions for resource files (js, css, kss(?)) [puittenbroek]

1.0.5 - unreleased

  • First production test version

prior 1.0.5

  • Inital code implemtation and testing

Subscribe to package updates

Last updated Jul 19th, 2013

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.