Skip to main content

A utility for logging telemetry data from LHCb packages to MONIT

Project description

lb-telemetry

A utility for logging telemetry data about LHCb packages to MONIT. Usage data graphs specific to each package can be viewed on the MONIT Grafana.

The package is not user-callable. It is intended to be imported and called by other LHCb packages such as PIDCalib2.

Setup

Installing from PyPI

The package is available on PyPI. It can be installed on any computer via pip by running (preferably in a virtual environment):

pip install lb-telemetry

Usage

Adding to a package

from lb_telemetry import Logger

# Time execution (optional)
start_time = time.perf_counter()
do_some_task()
exec_time = time.perf_counter() - start_time

telemetry = {
    "exec_time": exec_time,
    "version": VERSION,
    "some_field": "field_value",
    "some_tag": "tag_value",
}

Logger().log_to_monit(
    "NameOfThisPackage",  # Or other readable identifier
    telemetry,
    tags=["version", "some_tag"],  # `exec_time` and `some_field` interpreted as fields
)

Running the CLI

The default value for --table is 'CLI'.

lb-telemetry send '{"test_field": "test_value"}' --include-host-info

Tags can be specified by:

lb-telemetry send '{"field1": 0, "tag1": 5, "tag2": 2}' --table some_table --tags tag1 tag2

Viewing the telemetry

Logged telemetry is usually visible in under a minute and can be accessed via this Grafana dashboard. Request permission to edit the dashboard from an LHCb Grafana org admin if necessary. Then create a new row on the dashboard for your package and add the desired graphs.

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

lb-telemetry-0.5.0.tar.gz (26.5 kB view hashes)

Uploaded source

Built Distribution

lb_telemetry-0.5.0-py3-none-any.whl (18.2 kB view hashes)

Uploaded py3

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