Skip to main content

Palanteer instrumentation library

Project description

Look into Palanteer and get an omniscient view of your program

Palanteer is a set of lean and efficient tools to improve the quality of software for Python programs (and C++).

Simple code instrumentation, mostly automatic in Python, delivers powerful features:

  • Collection of meaningful atomic events on timings, memory, locks wait and usage, context switches, data values..
  • Visual and interactive observation of records: hierarchical logs, timeline, plot, histogram, flame graph...
  • Remote command call and events observation can be scripted in Python: deep testing has never been simpler

Execution of unmodified Python programs can be analyzed directly with a syntax similar to the one of cProfile:

  • Functions enter/leave
  • Interpreter memory allocations
  • All raised exceptions
  • Garbage collection runs
  • Support of multithread, coroutines, asyncio/gevent

The collected events can either be processed automatically by an online script, or analyzed with the separate viewer (see last section): Palanteer viewer image

Palanteer is an efficient, lean and comprehensive solution for better and enjoyable software development!

Usage

Profiling and monitoring can be done:

  1. With unmodified code: python -m palanteer [options] <your script>

    This syntax is similar to the cProfile usage and no script modification is required.
    By default, it tries to connect to a Palanteer server. With options, offline profiling can be selected.
    Launch python -m palanteer for help or refer to the documentation.

  2. With code instrumentation:

    Please refer to the documentation for details.
    Manual instrumentation can provide additional valuable information compared to just the automatic function profiling, like data, locks, ...

The manual instrumentation may also include remotely callable commands (Command Line Interface, aka CLI), useful for configuration and testing.

Here is a working example:

#! /usr/bin/env python3
import sys
import random
from palanteer import *

globalMinValue, globalMaxValue =  0, 10

# Handler (=implementation) of the example CLI, which sets the range
def setBoundsCliHandler(minValue, maxValue):              # 2 parameters (both integer) as declared
    global globalMinValue, globalMaxValue
    if minValue>maxValue:                                 # Case where the CLI execution fails (non null status). The text answer contains some information about it
        return 1, "Minimum value (%d) shall be lower than the maximum value (%d)" % (minValue, maxValue)

    # Modify the state of the program
    globalMinValue, globalMaxValue = minValue, maxValue
    # CLI execution was successful (null status)
    return 0, ""


def main(argv):
    global globalMinValue, globalMaxValue

    plInitAndStart("example")                             # Start the instrumentation
    plDeclareThread("Main")                               # Declare the current thread as "Main", so that it can be identified more easily in the script
    plRegisterCli(setBoundsCliHandler, "config:setRange", "min=int max=int", "Sets the value bounds of the random generator")  # Declare the CLI
    plFreezePoint()                                       # Add a freeze point here to be able to configure the program at a controlled moment

    plBegin("Generate some random values")
    for i in range(100000):
        value = int(globalMinValue + random.random()*(globalMaxValue+1-globalMinValue))
        plData("random data", value)                      # Here are the "useful" values
    plEnd("")                                             # Shortcut for plEnd("Generate some random values")

    plStopAndUninit()                                     # Stop and uninitialize the instrumentation

# Bootstrap
if __name__ == "__main__":
    main(sys.argv)

Installation of the instrumentation module

Latest official release directly from the PyPI storage (from sources on Linux, binary on Windows)

pip install palanteer

Directly from GitHub sources (top of tree, may be unstable)

pip install "git+https://github.com/dfeneyrou/palanteer#egg=palanteer&subdirectory=python"

From locally retrieved sources

This method ensures that the viewer and scripting module are consistent with the intrumentation libraries.

Get the sources:

git clone https://github.com/dfeneyrou/palanteer
cd palanteer
mkdir build
cd build

Build on Linux:

cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc) install

Build on Windows:
(vcvarsall.bat or equivalent shall be called beforehand, so that the MSVC compiler is accessible)

cmake .. -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles"
nmake install

Important!

To be useful, this module requires at least a "server side":

  • the graphical viewer
    • for visual analysis (online or offline) of the collected events
  • the Python scripting module palanteer_scripting
    • for automated remote usage of the collected events: KPI extraction, tests, monitoring...

NOTE 1: Installing from local sources provide all components: instrumentation module, scripting module, graphical viewer, test examples and documentation.

NOTE 2: It is strongly recommended to have matching versions between the server and the instrumentation sides

Project details


Download files

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

Source Distribution

palanteer-0.5.tar.gz (76.1 kB view details)

Uploaded Source

Built Distributions

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

palanteer-0.5-cp310-cp310-win_amd64.whl (63.9 kB view details)

Uploaded CPython 3.10Windows x86-64

palanteer-0.5-cp39-cp39-win_amd64.whl (63.9 kB view details)

Uploaded CPython 3.9Windows x86-64

palanteer-0.5-cp38-cp38-win_amd64.whl (63.9 kB view details)

Uploaded CPython 3.8Windows x86-64

palanteer-0.5-cp37-cp37m-win_amd64.whl (63.8 kB view details)

Uploaded CPython 3.7mWindows x86-64

File details

Details for the file palanteer-0.5.tar.gz.

File metadata

  • Download URL: palanteer-0.5.tar.gz
  • Upload date:
  • Size: 76.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.2

File hashes

Hashes for palanteer-0.5.tar.gz
Algorithm Hash digest
SHA256 9d990b394e3e2850c69ae372a32dad7470d6b55b4a7d0b200be8808b70f12e67
MD5 a5a22c9a3bf7d3234e67b37e37098707
BLAKE2b-256 2960e1e46dbcb7212c80feafa15e11068e890ca1650f7448ffbf76e4d94b82f2

See more details on using hashes here.

File details

Details for the file palanteer-0.5-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: palanteer-0.5-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 63.9 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.2

File hashes

Hashes for palanteer-0.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ffe12b3913c9567986da50888c61e3b3f6128c24f26348dec1bc4178bab3a594
MD5 17a28ecc57fa388705edc0c10a600a59
BLAKE2b-256 89f7e94fb5ea22558e7a4953ce3de076f3c90a80705edb101ee533f9685a7fcf

See more details on using hashes here.

File details

Details for the file palanteer-0.5-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: palanteer-0.5-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 63.9 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.2

File hashes

Hashes for palanteer-0.5-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 7687cea16cd1e990bd1b31a8bda2a6eadc06f926f93fa12441876d15aa8376d6
MD5 10cd68b93265a28ff0bb40e1e190a48b
BLAKE2b-256 d540826ca7b8ddf0212929743070223fcff613cc3833031fb117c4274a1a9633

See more details on using hashes here.

File details

Details for the file palanteer-0.5-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: palanteer-0.5-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 63.9 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.2

File hashes

Hashes for palanteer-0.5-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 722cd9abec79cf941c3cb13cd65e1d13a9e3a0d8a2cee2e7ae812650a5291f74
MD5 59e9f7175180a1be1acd2e9f0dc88c16
BLAKE2b-256 abf97881a62bb53ffc944e163ddb2ad63a47608cbcaf07a5c3bb008f4f6a4a8e

See more details on using hashes here.

File details

Details for the file palanteer-0.5-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: palanteer-0.5-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 63.8 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.2

File hashes

Hashes for palanteer-0.5-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 cbbd5e4201932f91ee8d4ef7a1e944a1918dc879fac9ce77e2a69e4919b08ce2
MD5 5bdf475764ba543554f23a839c41918b
BLAKE2b-256 a3471358ace180328136708ca274e5660557d7c288ee1088a0f235fea0bd648c

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