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

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.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: hostasphere_profiler-1.0.tar.gz
  • Upload date:
  • Size: 10.3 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.0.tar.gz
Algorithm Hash digest
SHA256 9df643f143b7b917c1cf9008827d164f09df64e37c6aef655b28bac99710540c
MD5 3216e6e79b5172fb2ccb4701ad5f787f
BLAKE2b-256 217a818cb687e3c2d6af8be67e31b78ec532178d75b1bc54e4c5bd9094b78011

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hostasphere_profiler-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7445c6da9288f89458984ca12ffffd75a42dd842b70819dbef1b6fce26101f58
MD5 4f2f61115da4fec5868d7b717dd513f5
BLAKE2b-256 6f7ff03200022d3184aa05d040ca69484c2d98a541f78b5e4e9e8c38cf669c88

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