Skip to main content

Mona's Unix Domain Socket client code

This repository contains all Mona python client for UDS code. The main package is under the dir "client", and is published to PyPi as "mona-uds-client".

The Mona UDS client requires a Mona Agent deployed locally in order to run. Other packages contain required information about how to install the Mona Agent in different environments and are published separately.

With any issues please email itai@monalabs.io.

Example use:

Example code can be found in client/mona_uds_client_test.py.

In a nutshell, after installing the PyPi package: $ pip install mona_uds_client

This is the common use:

from mona_uds_client.mona_uds_client import MonaUdsClient, MonaSingleMessage

# Use User ID as supplied by Mona team here.
client = MonaUdsClient("test_user")

# Use relevant context ID as defined in Mona configuration.
context_class = "MY_CONTEXT"

# Export a batch of two messages to Mona.
message1 = {"x": 1, "s": "some_str", "l": ["a"], "o": {"k": ["v1", "v2"]}}
message2 = {"x": 2, "s": "another_str", "l": ["b"], "o": {"k": ["v3", "v4"]}}

# Actual export
client.export(
    [
        MonaSingleMessage(
            contextId="context_id1",
            message=message1,
            arcClass=context_class,
        ),  # No export timestamp means use current time
        MonaSingleMessage(
            contextId="context_id2",
            message=message2,
            arcClass=context_class,
            exportTimestamp=1234567890
        ),
    ]
)

Deployment

The UDS client uses a local folder to communicate with Mona UDS agent. As a result, when deployed on a container, the following mounts are required to be added to the container's YAML:

In spec.template.spec:

volumes:
- name: uds-mona-socket
  hostPath:
    path: /var/run/mona-agent/

In spec.template.spec.container:

volumeMounts:
- mountPath: /uds/mona
  name: uds-mona-socket

Uploading new version to PyPI

The main reference to follow to do that is on: https://packaging.python.org/tutorials/packaging-projects/

Prerequisites:

  1. Register on PyPI with your mona email: https://pypi.org/
  2. Ask itai@monalabs.io or nemo@monalabs.io to add you as collaborator
  3. If not installed, install twine: $ python3 -m pip install --user --upgrade twine
  4. If not installed, install build tools: $ python3 -m pip install --user --upgrade setuptools wheel

Actual upload:

  1. Change version number under setup.py
  2. If a new dependency is required, add it under setup.py under "install_requires"
  3. Build new version:
$ python3 setup.py sdist bdist_wheel
  1. Upload new version (can change '*' to actual version):
$ python -m twine upload dist/*

Release files for mona-uds-client 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mona-uds-client 0.0.8
File Size Uploaded
mona_uds_client-0.0.8.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mona-uds-client 0.0.8
File Interpreter ABI Platform
mona_uds_client-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 16.5 kB

Release files / mona_uds_client-0.0.8.tar.gz

Download URL mona_uds_client-0.0.8.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
052939bc2b7022355396cd086247e470c1b85e6e618826a7c0f7b97059d370a9
BLAKE2b-256 checksum
How to use checksums
025075ab036da2c92d54e52bc0f9a3119fb08a3e0d11aaccf49d946b7561b3ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.3

Release files / mona_uds_client-0.0.8-py3-none-any.whl

Download URL mona_uds_client-0.0.8-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87645e8cdc242338fd12f6ed26f0ad74177552b94572ba50afefffdf40535d91
BLAKE2b-256 checksum
How to use checksums
7a05886155bab5514e46e5c56acbbd5de698c7693bf75a6d920f03f982f54c70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page