def default_iopipe_override(): return IOpipe( "test-suite", "https://metrics-api.iopipe.com", True, plugins=[TracePlugin(auto_measure=False)], )
def iopipe_with_sync_http(): return IOpipe("test-suite", "https://metrics-api.iopipe.com", True, sync_http=True)
import os import sys import time from iopipe import IOpipe from iopipe.contrib.trace import TracePlugin iopipe = IOpipe(os.getenv('IOPIPE_TOKEN')) trace_plugin = TracePlugin() iopipe_with_tracing = IOpipe(os.getenv('IOPIPE_TOKEN'), plugins=[trace_plugin]) @iopipe def caught_error(event, context): try: raise Exception('Caught exception') except Exception as e: context.iopipe.error(e) @iopipe def coldstart(event, context): sys.exit(1) @iopipe def custom_metrics(event, context): context.iopipe.log('time', time.time())
def default_iopipe(): return IOpipe("test-suite", "https://metrics-api.iopipe.com", True)
import random import sys import time try: from urllib.request import urlopen except ImportError: from urllib2 import urlopen from iopipe import IOpipe, IOpipeCore from iopipe.contrib.eventinfo import EventInfoPlugin from iopipe.contrib.logger import LoggerPlugin from iopipe.contrib.profiler import ProfilerPlugin from iopipe.contrib.trace import TracePlugin iopipe = IOpipe(debug=True) eventinfo_plugin = EventInfoPlugin() iopipe_with_eventinfo = IOpipeCore(debug=True, plugins=[eventinfo_plugin]) logger_plugin = LoggerPlugin() iopipe_with_logging = IOpipeCore(debug=True, plugins=[logger_plugin]) logger_plugin_tmp = LoggerPlugin(use_tmp=True) iopipe_with_logging_tmp = IOpipeCore(debug=True, plugins=[logger_plugin_tmp]) profiler_plugin = ProfilerPlugin(enabled=True) iopipe_with_profiling = IOpipeCore(debug=True, plugins=[profiler_plugin]) iopipe_with_sync_http = IOpipe(debug=True, sync_http=True)
def iopipe(): return IOpipe('test-suite', 'https://metrics-api.iopipe.com', True)
def iopipe_with_profiler(): plugin = ProfilerPlugin(enabled=True) return IOpipe(token='test-suite', url='https://metrics-api.iopipe.com', debug=True, plugins=[plugin])
import json import os from iopipe import IOpipe iopipe = IOpipe() @iopipe def handler(event, context): body = {'message': 'Your function executed successfully!', 'input': event} response = {'statusCode': 200, 'body': json.dumps(body)} return response
def iopipe_with_plugin(): plugin = TracePlugin() return IOpipe(token='test-suite', url='https://metrics-api.iopipe.com', debug=True, plugins=[plugin])
def iopipe_with_eventinfo(): plugin = EventInfoPlugin() return IOpipe(token='test-suite', url='https://metrics-api.iopipe.com', debug=True, plugins=[plugin])
import os import sys import time try: from urllib.request import urlopen except ImportError: from urllib2 import urlopen from iopipe import IOpipe from iopipe.contrib.eventinfo import EventInfoPlugin from iopipe.contrib.logging import LoggingPlugin from iopipe.contrib.profiler import ProfilerPlugin from iopipe.contrib.trace import TracePlugin iopipe = IOpipe(debug=True) eventinfo_plugin = EventInfoPlugin() iopipe_with_eventinfo = IOpipe(debug=True, plugins=[eventinfo_plugin]) logging_plugin = LoggingPlugin() iopipe_with_logging = IOpipe(debug=True, plugins=[logging_plugin]) profiler_plugin = ProfilerPlugin(enabled=True) iopipe_with_profiling = IOpipe(debug=True, plugins=[profiler_plugin]) trace_plugin = TracePlugin() iopipe_with_tracing = IOpipe(debug=True, plugins=[trace_plugin]) @iopipe_with_eventinfo def api_gateway(event, context):
def iopipe_with_trace_no_auto_measure(): plugin = TracePlugin(auto_measure=False) return IOpipe(token='test-suite', url='https://metrics-api.iopipe.com', debug=True, plugins=[plugin])
def iopipe_with_sync_http(): return IOpipe('test-suite', 'https://metrics-api.iopipe.com', True, sync_http=True)