Skip to main content

Epsagon Instrumentation for Python

Project description

Epsagon Instrumentation for Python

Build Status Pyversions PypiVersions

This package provides an instrumentation to Python code running on functions for collection of distributed tracing and performance monitoring.

Installation

From your project directory:

$ pip install epsagon

More details about lambda deployments are available in the AWS documentation.

Basic Usage

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

Django Application

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',
]

Custom labels

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 Error

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

Copyright

Provided under the MIT license. See LICENSE for details.

Copyright 2019, Epsagon.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

epsagon-1.8.1.tar.gz (36.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

epsagon-1.8.1-py3-none-any.whl (58.1 kB view details)

Uploaded Python 3

File details

Details for the file epsagon-1.8.1.tar.gz.

File metadata

  • Download URL: epsagon-1.8.1.tar.gz
  • Upload date:
  • Size: 36.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3

File hashes

Hashes for epsagon-1.8.1.tar.gz
Algorithm Hash digest
SHA256 51b93daa4d5f07e190fa7f0001973ee93d6a81e5cacbb982226e90757ebab3bf
MD5 18c44b02b3c9edd6f16b1a46d748cf4c
BLAKE2b-256 491a75b7e79ccbfa9a6c257d4754bcb84a31174a07ce0dcdaca1574c21db075e

See more details on using hashes here.

File details

Details for the file epsagon-1.8.1-py3-none-any.whl.

File metadata

  • Download URL: epsagon-1.8.1-py3-none-any.whl
  • Upload date:
  • Size: 58.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3

File hashes

Hashes for epsagon-1.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4248051d3abe8a38b4a3e5d74f2473ad082c7e6de597491412853327703d15e4
MD5 6b5eed106b1520b4e18bfe2f00636fa0
BLAKE2b-256 5660a3b68912313d3722b4ec2cd139886e12381af92789ac5b40b7bab74997de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page