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

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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: hostasphere_profiler-1.0rc2.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.0rc2.tar.gz
Algorithm Hash digest
SHA256 bd7334745c43716bb6a6db3b69bb126cb9487787ce4924c6063cc26e15df3888
MD5 99c76d53391446c7f2db68e983267a07
BLAKE2b-256 19c94f94db9b60b48394671ee12348066cac9f97516a8a849f674efaaaf5d3de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hostasphere_profiler-1.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 919943caebe89dcc2faedd0815ab8050af229dccfc68bec3c43e3b972b491645
MD5 1ee05f92865d6184d574ffc659284a55
BLAKE2b-256 e7fe169e89aa052d2901059695444e78ada30ef230db9196906a11c5207c675b

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