Skip to main content

Blackfire Python SDK

Project description

Blackfire Python SDK is a Python library that manages the Blackfire Python Profiler and handles communication with Blackfire.io servers.

Read the official Blackfire documentation for more information.

Installation

Please follow the official Blackfire Installation Guide.

Usage

These examples and more can be found on the official Blackfire Python SDK documentation.

Manual profiling

Following is an example of manual profiling:

from blackfire import probe

probe.initialize(client_id='xxxxx', client_token='xxxxx')
probe.enable()
foo()
bar()
baz()
probe.end() # this will send all collected data Blackfire.io servers

You can view your profiles here on your dashboard.

Aggregation of Traces

We can call enable()/disable() multiple times until we finally call end().

from blackfire import probe

probe.initialize()
probe.enable()
foo()
probe.disable()
probe.enable()
bar()
probe.disable()
with probe.run():
    baz()

Profiling Python scripts via CLI

Save below as foo.py:

def foo():
    print('foo called!')

foo()

Then run following:

blackfire run python foo.py

Above command will run your script till end and uploads the resulting profile to Blackfire. You profile will be available on your dashboard.

Profiling Django via Middleware

Read the Django Integration documentation on the Blackfire website.

  1. Install the Blackfire Browser Extension.

  2. Add Blackfire middleware in your Django settings.py as following:

    MIDDLEWARE = [
        ...
        ...
        'blackfire.middleware.DjangoMiddleware',
    ]
  3. Follow these steps to profile via Browser.

Resources

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

blackfire-1.5.0-cp38-cp38-win_amd64.whl (55.2 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

blackfire-1.5.0-cp38-cp38-win32.whl (51.9 kB view hashes)

Uploaded CPython 3.8 Windows x86

blackfire-1.5.0-cp38-cp38-manylinux2010_x86_64.whl (125.2 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

blackfire-1.5.0-cp38-cp38-manylinux1_x86_64.whl (125.1 kB view hashes)

Uploaded CPython 3.8

blackfire-1.5.0-cp38-cp38-macosx_10_14_x86_64.whl (51.2 kB view hashes)

Uploaded CPython 3.8 macOS 10.14+ x86-64

blackfire-1.5.0-cp37-cp37m-win_amd64.whl (55.0 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

blackfire-1.5.0-cp37-cp37m-win32.whl (51.6 kB view hashes)

Uploaded CPython 3.7m Windows x86

blackfire-1.5.0-cp37-cp37m-manylinux2010_x86_64.whl (127.6 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

blackfire-1.5.0-cp37-cp37m-manylinux1_x86_64.whl (127.6 kB view hashes)

Uploaded CPython 3.7m

blackfire-1.5.0-cp37-cp37m-macosx_10_14_x86_64.whl (51.2 kB view hashes)

Uploaded CPython 3.7m macOS 10.14+ x86-64

blackfire-1.5.0-cp36-cp36m-win_amd64.whl (55.0 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

blackfire-1.5.0-cp36-cp36m-win32.whl (51.6 kB view hashes)

Uploaded CPython 3.6m Windows x86

blackfire-1.5.0-cp36-cp36m-manylinux2010_x86_64.whl (120.7 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

blackfire-1.5.0-cp36-cp36m-manylinux1_x86_64.whl (120.7 kB view hashes)

Uploaded CPython 3.6m

blackfire-1.5.0-cp36-cp36m-macosx_10_14_x86_64.whl (51.2 kB view hashes)

Uploaded CPython 3.6m macOS 10.14+ x86-64

blackfire-1.5.0-cp35-cp35m-win_amd64.whl (55.0 kB view hashes)

Uploaded CPython 3.5m Windows x86-64

blackfire-1.5.0-cp35-cp35m-win32.whl (51.6 kB view hashes)

Uploaded CPython 3.5m Windows x86

blackfire-1.5.0-cp35-cp35m-manylinux2010_x86_64.whl (119.8 kB view hashes)

Uploaded CPython 3.5m manylinux: glibc 2.12+ x86-64

blackfire-1.5.0-cp35-cp35m-manylinux1_x86_64.whl (119.8 kB view hashes)

Uploaded CPython 3.5m

blackfire-1.5.0-cp35-cp35m-macosx_10_14_x86_64.whl (51.2 kB view hashes)

Uploaded CPython 3.5m macOS 10.14+ x86-64

blackfire-1.5.0-cp34-cp34m-win32.whl (47.6 kB view hashes)

Uploaded CPython 3.4m Windows x86

blackfire-1.5.0-cp34-cp34m-macosx_10_14_x86_64.whl (50.0 kB view hashes)

Uploaded CPython 3.4m macOS 10.14+ x86-64

blackfire-1.5.0-cp33-cp33m-win32.whl (49.5 kB view hashes)

Uploaded CPython 3.3m Windows x86

blackfire-1.5.0-cp33-cp33m-macosx_10_14_x86_64.whl (51.9 kB view hashes)

Uploaded CPython 3.3m macOS 10.14+ x86-64

blackfire-1.5.0-cp27-cp27mu-manylinux2010_x86_64.whl (109.1 kB view hashes)

Uploaded CPython 2.7mu manylinux: glibc 2.12+ x86-64

blackfire-1.5.0-cp27-cp27mu-manylinux1_x86_64.whl (109.1 kB view hashes)

Uploaded CPython 2.7mu

blackfire-1.5.0-cp27-cp27m-win_amd64.whl (49.4 kB view hashes)

Uploaded CPython 2.7m Windows x86-64

blackfire-1.5.0-cp27-cp27m-win32.whl (47.6 kB view hashes)

Uploaded CPython 2.7m Windows x86

blackfire-1.5.0-cp27-cp27m-manylinux2010_x86_64.whl (109.1 kB view hashes)

Uploaded CPython 2.7m manylinux: glibc 2.12+ x86-64

blackfire-1.5.0-cp27-cp27m-manylinux1_x86_64.whl (109.1 kB view hashes)

Uploaded CPython 2.7m

blackfire-1.5.0-cp27-cp27m-macosx_10_14_x86_64.whl (49.8 kB view hashes)

Uploaded CPython 2.7m macOS 10.14+ x86-64

Supported by

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