Hostasphere Profiler API
Project description
hand-e.fr
Hostasphere - Profiler API
Description
The Profiling API allows you to measure execution time, memory usage, and other metrics related to OpenHosta for Python functions. The collected data is sent to your Hostasphere monitoring interface.
Installation
Install the required dependencies with pip :
pip install hostasphere-profiler==v1.0-rc1
Usage
To profile a function, use the decorator @profiler.track()
:
from profiler.core import Profiler
profiler = Profiler(
address='localhost:50051', # required, is the address of the datasource, default is 'localhost:50051'
token='hsp_0d6d562910026e3ba0b511dd2c99a47d374f810055003c149eb5fbcdad693319', # required
refresh_interval=0.1, # optional, double representing the interval in seconds between each refresh of recorded metrics, default is 0.1
session_tag="dev-1", # optional, string representing the session tag, default is None, esaier to identify the session in the monitoring interface
)
@profiler.track()
def my_func():
# Function logic
pass
Add markers
Yo can add markers to your profiling session to help you identify specific parts of your code.
profiler.get_session().add_annotation('Calculating CPU usage', '#008000')
annotation: str color: str # optional, default is '#000000'
You can find many examples in the examples folder.
In future versions
- Catch exceptions and send them to the monitoring interface
- Add more metrics
- Add the possibility to send custom metrics
- Add the possibility to send logs
- Add the possibility to send traces
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file hostasphere_profiler-1.0rc1.tar.gz
.
File metadata
- Download URL: hostasphere_profiler-1.0rc1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f3c06bb89b63364e57c6cf460274cf18360fe38b5efb0f7965b47cb983a1131 |
|
MD5 | a58f3c2b4cacf1761d6fab48c1635dcf |
|
BLAKE2b-256 | 290f115bf8ded5ff4d23335b34f94f213a107b6871a9cf95f121120f3bc5663e |
File details
Details for the file hostasphere_profiler-1.0rc1-py3-none-any.whl
.
File metadata
- Download URL: hostasphere_profiler-1.0rc1-py3-none-any.whl
- Upload date:
- Size: 2.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fa1dc3e54d4eb8071caa1616e47ef086e4f1213ea51344662938a3adb4085e4 |
|
MD5 | d2353c3071f374c53702ef2144e46e50 |
|
BLAKE2b-256 | 6912e7721fc5c13473404e2783921451c9e0aac8f1204ddfe3a744cff699ace1 |