Skip to main content
The HyperProbe Python SDK runs as an extremely lightweight in-process agent. It uses Python’s sys.monitoring APIs to capture variables, stack frames, and logs without blocking your application.

Technical Prerequisites

  • Runtime: Python 3.12 and later.
  • Metadata: Access to the active git commit SHA (mandatory for matching local source coordinates to production builds).

Installation

Add the SDK as a dependency using your package manager:

Initialization Walkthrough

Follow these steps to initialize the HyperProbe agent inside your application:
1

Choose an initialization method

Select one of the following initialization methods:
Create a dedicated file named hyperprobe_init.py in your project source root:
hyperprobe_init.py
2

Import it in your entrypoint

In your main application file, import hyperprobe_init as early as possible before starting your application:
main.py
Environment Variables Loading Order: If hyperprobe_init.py reads variables loaded by a library such as python-dotenv, load those variables before importing hyperprobe_init.
3

Configure your Dockerfile

To enable Docker-based deployments, define a GIT_COMMIT build argument inside your Dockerfile with a default value of unknown:
Dockerfile
4

Run local Docker builds

For building and testing Docker containers locally, inject your active git commit:
5

Inject correct SHA in CI/CD (The PR Merge Trap)

To protect source alignment, HyperProbe refuses to start if commit_sha resolves to unknown. Pass the real commit SHA to GIT_COMMIT during deployment.Always use your CI/CD platform’s native commit SHA variable:
Beware of the PR Merge Commit Trap: By default, GitHub Actions checks out a virtual merge commit for a pull_request trigger instead of the commit from your branch.If you use git rev-parse HEAD or ${{ github.sha }} in a pull request workflow, source mapping can fail. Use ${{ github.event.pull_request.head.sha || github.sha }} for pull request builds.

Configuration & Environment Variables Reference

You can configure the agent by passing properties inside your HyperProbe.start() options object, or by using environment variables. The following example includes the available programmatic options and their corresponding environment variables:
hyperprobe_init.py

Safety Shields

Because dynamic monitoring could affect application performance during heavy execution spikes, the Python Agent includes active Safety Shields:
  • Yellow Threshold: Logs a warning when execution lag or cumulative pause time reaches 50% of its limit.
  • Red Threshold: Suspends tracing when execution lag exceeds 50 ms or cumulative pause time exceeds 15 ms.
  • Auto-Recovery: Resumes instrumentation after the cooldown period when application performance stabilizes.