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-rc4

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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: hostasphere_profiler-1.0rc4.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.0rc4.tar.gz
Algorithm Hash digest
SHA256 9136062deae9d3c6ea862a719ca1b336bf50f64046eb7f3802325f0f7b4c196d
MD5 2bd0a1b002ca1583e8107c658d4a8a42
BLAKE2b-256 984f9d9a38b2baecc012774e060e44dc3595befae9d8f72174f6f317ab5b4743

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hostasphere_profiler-1.0rc4-py3-none-any.whl
Algorithm Hash digest
SHA256 bd56293fd2c6a968d441e9374e18aad3eb1cfbb6cb049090048c984a5efc5b34
MD5 b8b485c03a1c28c15ab0cd226360ca8d
BLAKE2b-256 5a1c77e416c02fd44bfa102f1298d9298d03ff03f9ba68077cdc126d61925784

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