A Python package to communicate with a migas server.
migas (mee-gahs) is a Python client to facilitate communication with a migas server.
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 internal configuration, which is done at the process level.
migas includes the following functions to communicate with the telemetry server:
Send a breadcrumb with usage information to the server.
project- application nameproject_version- application version
language(auto-detected)language_version(auto-detected)- process:
statusstatus_descerror_typeerror_desc
- context:
user_id(auto-generated)session_iduser_typeplatform(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')
>>>Check a project version against later developments.
projectproject_version
check_project example
>>> check_project('nipreps/migas-py', '0.0.1')
{'success': True, 'flagged': False, 'latest': '0.4.0', 'message': ''}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}Register an exit function to send a final ping upon termination of the Python interpreter.
Useful when monitoring a process that may preemptively error.
The inputs are equivalent to add_breadcrumb()
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 |
The internal configuration stores the following telemetry information:
- language and language version
- operating system
- run within a container
- run from continuous integration