Skip to main content

Hostasphere Profiler API

Project description

hostasphere 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-rc3

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


Download files

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

Source Distribution

hostasphere_profiler-1.0rc3.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

hostasphere_profiler-1.0rc3-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file hostasphere_profiler-1.0rc3.tar.gz.

File metadata

  • Download URL: hostasphere_profiler-1.0rc3.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for hostasphere_profiler-1.0rc3.tar.gz
Algorithm Hash digest
SHA256 a1442ee9ab26c382e118f43bb93cbd050e8a949efb5c813cfcd32ee9a3d820ed
MD5 8f85bd393ca43a1d71b812fb013536bd
BLAKE2b-256 2e3148732f145f1ca75ba775e3d6888dcd2c36da4cf0928a4fc8d095a1c1ab10

See more details on using hashes here.

File details

Details for the file hostasphere_profiler-1.0rc3-py3-none-any.whl.

File metadata

File hashes

Hashes for hostasphere_profiler-1.0rc3-py3-none-any.whl
Algorithm Hash digest
SHA256 43ea742a4a7116006535e8af3744a16a587b46388f728e7a94b74d17e5ccac8a
MD5 88c57bbab7cf2d32f6ac323e47e746b1
BLAKE2b-256 a0d5c25b8442bb8c96f7d487e30ac969c30057ef8c26d941134dfc68d087d963

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page