This package provides an instrumentation to Python code running on functions for collection of distributed tracing and performance monitoring.
From your project directory:
$ pip install epsagon
More details about lambda deployments are available in the AWS documentation.
Simply use our decorator to report metrics:
import epsagon
epsagon.init(
token='my-secret-token',
app_name='my-app-name',
metadata_only=False, # Optional, send more trace data
)
@epsagon.lambda_wrapper
def handler(event, context):
pass
Add the following code to the settings.py
file:
import epsagon
epsagon.init(
token='my-secret-token',
app_name='my-app-name',
metadata_only=False, # Optional, send more trace data
)
Add Epsagon middleware to the application's middleware list (located in settings.py
)
MIDDLEWARE = [
'....',
'epsagon.wrappers.django.DjangoMiddleware',
]
You can add custom labels to your traces. Filters can later be used for filtering traces that contains specific labels:
@epsagon.lambda_wrapper
def handler(event, context):
epsagon.label('label', 'something_to_filter_afterwards')
epsagon.label('number_of_records_parsed_successfully', 42)
pass
Set a custom error, maybe without even failing the function:
@epsagon.lambda_wrapper
def handler(event, context):
if 'my_param' not in event:
epsagon.error(ValueError('event missing my_param'))
pass
Provided under the MIT license. See LICENSE for details.
Copyright 2019, Epsagon.