Coder Social home page Coder Social logo

gotcha / collective.newrelic Goto Github PK

View Code? Open in Web Editor NEW

This project forked from collective/collective.newrelic

0.0 2.0 0.0 132 KB

This package offers instrumentation for NewRelic ( http://www.newrelic.com ) in Plone ( http://www.plone.org ).

License: Other

Python 100.00%

collective.newrelic's Introduction

============ 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 Real-User-Monitoring: it inserts small snippets of javascript at the top and bottom of the rendered pages.

============ 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 [email protected]: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 etire egg or 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_functions)

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_functions)    

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__"

============ References

http://www.newrelic.com

http://newrelic.com/docs/python/python-agent-installation

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.