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.

Download files

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

Files for blackfire, version 1.3.3
Filename, size File type Python version Upload date Hashes
Filename, size blackfire-1.3.3-cp27-cp27m-macosx_10_11_x86_64.whl (34.1 kB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size blackfire-1.3.3-cp27-cp27m-manylinux1_x86_64.whl (87.4 kB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size blackfire-1.3.3-cp27-cp27m-manylinux2010_x86_64.whl (87.4 kB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size blackfire-1.3.3-cp27-cp27mu-manylinux1_x86_64.whl (87.4 kB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size blackfire-1.3.3-cp27-cp27mu-manylinux2010_x86_64.whl (87.4 kB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size blackfire-1.3.3-cp27-cp27m-win32.whl (32.3 kB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size blackfire-1.3.3-cp27-cp27m-win_amd64.whl (34.0 kB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size blackfire-1.3.3-cp33-cp33m-macosx_10_11_x86_64.whl (36.4 kB) File type Wheel Python version cp33 Upload date Hashes View
Filename, size blackfire-1.3.3-cp33-cp33m-win32.whl (34.3 kB) File type Wheel Python version cp33 Upload date Hashes View
Filename, size blackfire-1.3.3-cp34-cp34m-macosx_10_11_x86_64.whl (34.5 kB) File type Wheel Python version cp34 Upload date Hashes View
Filename, size blackfire-1.3.3-cp34-cp34m-manylinux1_x86_64.whl (92.6 kB) File type Wheel Python version cp34 Upload date Hashes View
Filename, size blackfire-1.3.3-cp34-cp34m-manylinux2010_x86_64.whl (92.6 kB) File type Wheel Python version cp34 Upload date Hashes View
Filename, size blackfire-1.3.3-cp34-cp34m-win32.whl (32.4 kB) File type Wheel Python version cp34 Upload date Hashes View
Filename, size blackfire-1.3.3-cp35-cp35m-macosx_10_11_x86_64.whl (34.6 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size blackfire-1.3.3-cp35-cp35m-manylinux1_x86_64.whl (91.9 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size blackfire-1.3.3-cp35-cp35m-manylinux2010_x86_64.whl (91.9 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size blackfire-1.3.3-cp35-cp35m-win32.whl (35.7 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size blackfire-1.3.3-cp35-cp35m-win_amd64.whl (38.1 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size blackfire-1.3.3-cp36-cp36m-macosx_10_11_x86_64.whl (34.6 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size blackfire-1.3.3-cp36-cp36m-manylinux1_x86_64.whl (92.6 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size blackfire-1.3.3-cp36-cp36m-manylinux2010_x86_64.whl (92.6 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size blackfire-1.3.3-cp36-cp36m-win32.whl (35.7 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size blackfire-1.3.3-cp36-cp36m-win_amd64.whl (38.1 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size blackfire-1.3.3-cp37-cp37m-macosx_10_11_x86_64.whl (34.6 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size blackfire-1.3.3-cp37-cp37m-manylinux1_x86_64.whl (95.7 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size blackfire-1.3.3-cp37-cp37m-manylinux2010_x86_64.whl (95.7 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size blackfire-1.3.3-cp37-cp37m-win32.whl (35.8 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size blackfire-1.3.3-cp37-cp37m-win_amd64.whl (38.1 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size blackfire-1.3.3-cp38-cp38-manylinux1_x86_64.whl (96.3 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size blackfire-1.3.3-cp38-cp38-manylinux2010_x86_64.whl (96.3 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size blackfire-1.3.3-cp38-cp38-win32.whl (36.0 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size blackfire-1.3.3-cp38-cp38-win_amd64.whl (38.3 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size blackfire-1.3.3-py3.2-macosx-10.11-x86_64.egg (56.5 kB) File type Egg Python version 3.2 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page