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.6.tar.gz (79.3 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.6-cp310-cp310-win_amd64.whl (63.2 kB view details)

Uploaded CPython 3.10Windows x86-64

palanteer-0.6-cp39-cp39-win_amd64.whl (63.2 kB view details)

Uploaded CPython 3.9Windows x86-64

palanteer-0.6-cp38-cp38-win_amd64.whl (63.2 kB view details)

Uploaded CPython 3.8Windows x86-64

palanteer-0.6-cp37-cp37m-win_amd64.whl (63.2 kB view details)

Uploaded CPython 3.7mWindows x86-64

File details

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

File metadata

  • Download URL: palanteer-0.6.tar.gz
  • Upload date:
  • Size: 79.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.0.1 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for palanteer-0.6.tar.gz
Algorithm Hash digest
SHA256 c7ef08068a1aa6b03e9ffe88c2b55984af13f5e98c1988f3f78ca4fcb0e04718
MD5 9809a6009792e3e86279b66d128ea63d
BLAKE2b-256 8079f03d5b80c4df1ee37c6312f4d34bc137b788cad7f2dc74187505b2eb5b1d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: palanteer-0.6-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 63.2 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.0.1 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for palanteer-0.6-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e458b7ee6ce9bdf29c2bdfbf3453d5c37001f46be85c16a13a97f993281a997c
MD5 f1845b8a2e6fc607a17cccaada965d7d
BLAKE2b-256 7aac5185af628d36cbdc86a9e14368b09e98db53566c29fd01023f699eccfcdc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: palanteer-0.6-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 63.2 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.0.1 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for palanteer-0.6-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e7bbad718b7e7cd43f18a2d8b3f485f63aad01ad975fcbb584795fa786260fee
MD5 4347e0f922e38f1c5178c866f9a29f75
BLAKE2b-256 28028050d67a95f1aba55672fbc1b04b61423b9ba43a96c88f7faaacb306a2a6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: palanteer-0.6-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 63.2 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.0.1 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for palanteer-0.6-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 896c3117689f1776d2911e145b45d017c5b4fb52bcdc8305f74a4ca3e035eb41
MD5 e8bb77a00fc5dc7346571cfaece3b9f9
BLAKE2b-256 96296ace48d8c6daa48bd30225948875e41e564edeb7069dd5fc60fe0e3a58ed

See more details on using hashes here.

File details

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

File metadata

  • Download URL: palanteer-0.6-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 63.2 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.0.1 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for palanteer-0.6-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 f35f0195c5c78cab0818ebb68096a719f9a42b9fb232949cef77fb28caa06f68
MD5 81ceba96d413cc3b9f60f4bc17236344
BLAKE2b-256 b6f1810b3dfb68bd97dc9c711df023b486b5166b32c0a1d841d16b3f0d700097

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