This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import newrelic.api.transaction | |
import newrelic.api.function_trace | |
import newrelic.api.in_function | |
import newrelic.api.out_function | |
import newrelic.api.pre_function | |
import newrelic.api.name_transaction | |
from newrelic.api.object_wrapper import callable_name | |
from newrelic.api.web_transaction import WSGIApplicationWrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
asld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import newrelic.api.transaction | |
import newrelic.api.function_trace | |
import newrelic.api.in_function | |
import newrelic.api.out_function | |
import newrelic.api.pre_function | |
import newrelic.api.name_transaction | |
from newrelic.api.object_wrapper import callable_name | |
from newrelic.api.web_transaction import WSGIApplicationWrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
import newrelic.agent | |
newrelic.agent.initialize('newrelic.ini') | |
@newrelic.agent.wsgi_application() | |
def hello_world(environ, start_response): | |
path = environ.get('PATH_INFO') | |
if path.startswith('/slow'): | |
for _ in range(9): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def profile_func(filename=None): | |
def proffunc(f): | |
def profiled_func(*args, **kwargs): | |
import cProfile | |
import logging | |
logging.info('Profiling function %s' % (f.__name__)) | |
try: | |
profiler = cProfile.Profile() | |
retval = profiler.runcall(f, *args, **kwargs) | |
profiler.dump_stats(filename or '%s_func.profile' % (f.__name__)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
def convert(inp): | |
""" | |
* Get the input from user. | |
* Parse the input to extract numbers | |
** Split by comma | |
*** Each item in the list will then be split by '-' | |
**** Populate the number between a-b using range(a,b) | |
>>> convert("") | |
[] |
NewerOlder