Telemetry package aimed for PyROS
Project description
Telemetry
PyROS aimed telemetry client. This library gives definition of telemetry concepts:
- stream (logger, stream definition): TelemetryLogger, TelemetryStreamDefinition...
- client: TelemetryClient
- storage: TelemetryStorage,
and implementaions.
Stream
Stream represents concept of well formed data (fixed len byte record) logged by source app, service or program; that contains data of interest. Stream can be defined using subclass of TelemetryStreamDefinition:
-
MQTTLocalPipeTelemetryLogger provides all-in-one client to start logging your data to local server over local unix pipe (it is expected server to be already running locally). It uses MQTT to negotiate creation of stream from given definition.
-
In telemetry-server package check SocketTelemetryServer class which allows you to get instance of TelemetryLogger to start logging to locally running TCP server.
Example:
logger = MQTTLocalPipeTelemetryLogger('test-stream', host="172.24.1.185", port=1883)
logger.add_byte('some-status')
logger.add_double('x-coordinate')
logger.add_double('y-coordinate')
logger.init()
# ...
logger.log(1, 55, 0.0, 0.0) # first argument is timestamp
logger.log(1.23, 0, 2.1, 0.0)
logger.log(1.90, 0, 2.2, 1.0)
Client
Client provides way of accessing telemetry data. For instance:
client = MQTTTelemetryClient(host=host, port=port, topic=topic)
test_stream = None
test_stream_data = None
def receive_stream_def(received_stream):
global test_stream
test_stream = received_stream
def receive_test_stream_data(received_records):
global test_stream_data
test_stream_data = received_records
client.getStreamDefinition('test-stream', process_stream_def)
while test_stream is None:
time.sleep(0.01)
# second argument is start timestamp, third end timestamp and last callback method to deliver data
client.retrieve(test_stream, 0, time.time(), receive_test_stream_data)
Client functions operate with callbacks. Methods would request data but result is delivered asynchronously.
Storage
Storage is mostly used internally by client and server implementations
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyros-telemetry-1.0.0.tar.gz
.
File metadata
- Download URL: pyros-telemetry-1.0.0.tar.gz
- Upload date:
- Size: 17.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.5.0.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4401a80c6c4f2024386ac80840e28c16de1e9cd39ba34d1e7b46014f465e66f |
|
MD5 | a1aecb38bf6c20faa33f1a82816c628c |
|
BLAKE2b-256 | a6a4a548bdc716a5f058e53c7c34d16d37b53aba7d322045d982cd4965d3616e |
File details
Details for the file pyros_telemetry-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: pyros_telemetry-1.0.0-py3-none-any.whl
- Upload date:
- Size: 23.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.5.0.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d0ac363829d98f437430e7c2feda3515eeb6c8e2dc919b1c31ea1b58c33ccd2 |
|
MD5 | a102494fd8df81448fdde1f291f92a76 |
|
BLAKE2b-256 | e1965c3bcadcfd791964692b4befae814971d4c49d57fcbf7fd114177a87f2f5 |