Skip to main content

A Python package to communicate with a migas server.

Project description

Migas Client

A Python package to communicate with a migas server.

About

migas (mee-gahs) is a Python client to facilitate communication with a migas server.

Usage

To start communicating with a migas server, the client must first be setup.

import migas; migas.setup()

By default, migas-py will communicate with the official hosted migas server. However it can easily be configured to communicate with any hosted migas server.

import migas; migas.setup(endpoint='your-endpoint')

setup() will populate the interal configuration, which is done at the process level.

API

migas includes the following functions to communicate with the telemetry server:

migas.add_breadcrumb() {#addbreadcrumb}

Send a breadcrumb with usage information to the server.

Mandatory
  • project - application name
  • project_version - application version
Optional
  • language (auto-detected)
  • language_version (auto-detected)
  • process:
    • status
    • status_desc
    • error_type
    • error_desc
  • context:
    • user_id (auto-generated)
    • session_id
    • user_type
    • platform (auto-detected)
    • container (auto-detected)
    • is_ci (auto-detected)
add_breadcrumb example
>>> add_breadcrumb('nipreps/migas-py', '0.0.1', status='R', status_desc='Finished long step')
{'success': True}

migas.check_project() {#checkproject}

Check a project version against later developments.

Mandatory
  • project
  • project_version
check_project example
>>> check_project('nipreps/migas-py', '0.0.1')
{'success': True, 'flagged': False, 'latest': '0.4.0', 'message': ''}

migas.get_usage() {#getusage}

Check number of uses a project has received from a start date, and optionally an end date. If no end date is specified, the current datetime is used.

get_usage example
>>> get_usage('nipreps/migas-py', '2022-07-01')
{'hits': 7, 'message': '', 'unique': False, 'success': True}

migas.track_exit() {#trackexit}

Register an exit function to send a final ping upon termination of the Python interpretter. Useful when monitoring a process that may preemptively error. The inputs are equivalent to add_breadcrumb()

User Control

migas can controlled by the following environmental variables:

Envvar Description Value Default
MIGAS_OPTOUT Disable telemetry collection Any None
MIGAS_TIMEOUT Seconds to wait for server response Number >= 0 5
MIGAS_LOG_LEVEL Logger level Logging levels WARNING

Configuration

The internal configuration stores the following telemetry information:

  • language and language version
  • operating system
  • run within a container
  • run from continuous integration

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

migas-0.4.0.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

migas-0.4.0-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file migas-0.4.0.tar.gz.

File metadata

  • Download URL: migas-0.4.0.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for migas-0.4.0.tar.gz
Algorithm Hash digest
SHA256 069481021e86fb9a84b9977f2f5adb9c77c5220787065859b9510cf80e7095f5
MD5 1c3ecd0214cd8b804a540cdeccaf8e49
BLAKE2b-256 acd15e44248498037363374c620b1aa394e5dd616e24558b3a36e811903e52ce

See more details on using hashes here.

File details

Details for the file migas-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: migas-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 27.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for migas-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22cefe4f65b4eed0850bb166c9c958701e3c2105476d6ca853b262553d0c150c
MD5 a0d29a2f63e9ace6280a9b818d881132
BLAKE2b-256 9d6a43827cf9d1e70c0c3d916b8d139f2ff07501a8adadd8585e432af0bb7db4

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