A tool for generating compliance reports based on Telemeter data.
Project description
telemeter-reporter
Python tool for generating SLA compliance reports based on Telemeter data.
For the original prototype script, see the notebook
directory.
Installation
Install with pip
(Python 3 only)
pip3 install telemeter-reporter
Usage
Configuration
Configuration is provided via a YAML file (and in certain cases, environmental variables). The command line tool checks three locations (in order) for a config file:
TELEMETER_REPORTER_CONFIG
environment variable- argument to the
--config
or-c
flag ~/.telemeter_reporter.yml
A sample config file is provided (reporter_confg.yml.tmpl
). An explanation of each key is below. All keys are required
unless otherwise noted.
css
: provide a Cascading Style Sheet here to be injected into HTML-formatted reports.api.telemeter.url
: URL to any service providing a Prometheus-compatible APIapi.telemeter.token
: Log-in token for the Telemeter API (i.e. OAuth) (can be left out ifTELEMETER_TOKEN
env-var is set)api.uhc.url
: URL for the UHC HTTP APIapi.uhc.public_key
: Public key for verifying the authenticity of the provided JWT (can be left out to disable token verification, but this is not recommended. Red Hat's public key is provided in the sample config file)api.uhc.token
: "Offline access" JWT token for UHC API (can be left out ifUHC_TOKEN
env-var is set)clusters
: provide a list of UHC queries as strings here. Each the cluster IDs returned by each query will be reported on (can be overridden with the--uhc-query
flag)global_vars
: provide a list of strings/ints/floats here to make them available as global variables to each rule. For example, providing- foo: "bar"
here will replace any instance of${foo}
in each rule query withbar
. At a minimum, you should provide aduration
variable (in days) here (can be overridden with the--override
flag)rules
: provide a list of SLI rules to evaluate (see below)rules.name
: a human-readable name for the rulerules.goal
: the target-value for the query result. Usually a percentage represented as a float between 0 and 1.0rules.query
: a valid PromQL query that returns the current value of the SLI (which will be compared to the goal)
Command line tool
$ telemeter-reporter -h
usage: telemeter-reporter [-h] [-c PATH] [-f FMT] [-u QUERY] [-t TITLE] [-b]
[-a] [-m] [-p] [-l LEVEL] [-o VARS]
output
Tool for generating reports on SLA/SLO compliance using Telemeter-LTS data
positional arguments:
output Destination path for the generated report (- = stdout)
optional arguments:
-h, --help show this help message and exit
-c PATH, --config PATH
Path to YAML file containing configuration data.
Default: ~/.telemeter_reporter.yml
-f FMT, --format FMT Format for the report. Can be provided multiple times
(see --auto-ext). Options: ['simple', 'plain', 'html',
'csv', 'grid', 'fancy_grid', 'github', 'jira',
'latex']. Default: simple
-u QUERY, --uhc-query QUERY
Report on all clusters returned by this query to the
UHC API
-t TITLE, --title TITLE
Optional title for HTML reports
-b, --no-browser Don't open the resulting report in a web browser (if
HTML report is selected)
-a, --auto-ext Automatically append a file extension onto the
provided output path. Enabled by default when --format
is used multiple times. Has no effect when output =
stdout.
-m, --minify Minify HTML output
-p, --parents Same behavior as mkdir's --parents option. Creates
parent directories in the output path if necessary.
-l LEVEL, --log LEVEL
Set the verbosity/logging level. Options: ['critical',
'error', 'warning', 'info', 'debug']
-o VARS, --override VARS
Override global variables set in the configuration
file. Provide a valid Python dict string, e.g.
"{'duration': 28}"
Note: the -u
parameter overrides any clusters
list provided in a config file.
Examples
Simple 28-day report
$ telemeter-reporter -f simple -o "{'duration':28}"
Cluster CtrlPlane CtrlPlane CtrlPlane CtrlPlane CtrlPlane CtrlPlane
General General API API etcd etcd
Goal Perf. Goal Perf. Goal Perf.
-------------- ----------- ----------- ----------- ----------- ----------- -----------
test-cluster-1 99.500% 100.00% 99.900% 99.999% 99.900% 95.982%
test-cluster-2 99.500% 100.00% 99.900% 99.999% 99.900% 95.992%
Output to GitHub-Flavored Markdown file
$ telemeter-reporter -f github output.md
output.md
Contents:
Cluster | CtrlPlane General Goal | CtrlPlane General Perf. | CtrlPlane API Goal | CtrlPlane API Perf. | CtrlPlane etcd Goal | CtrlPlane etcd Perf. | CtrlPlane Latency Goal | CtrlPlane Latency Perf. | Registry General Goal | Registry General Perf. | Compute General Goal | Compute General Perf. | Compute Resiliency Goal | Compute Resiliency Perf. | Support Monitoring Goal | Support Monitoring Perf. |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
osd-v4stg-aws | 99.500% | 100.00% | 99.900% | 99.999% | 99.900% | 95.982% | 99.500% | 100.00% | 99.000% | 95.982% | 99.500% | 100.00% | 99.000% | 100.00% | 99.990% | 100.00% |
osd-v4prod-aws | 99.500% | 100.00% | 99.900% | 99.999% | 99.900% | 95.992% | 99.500% | 100.00% | 99.000% | 95.942% | 99.500% | 98.800% | 99.000% | 98.353% | 99.990% | 100.00% |
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
Built Distribution
Hashes for telemeter_reporter-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e13ed9b3412f887f33903ba1fea09b0936854e5fea2b0d17b02c7a4af570a6e |
|
MD5 | 99f66808ddcc876b6958c5e8cb2c8735 |
|
BLAKE2b-256 | 617cba77355dea1dd6b29b084c56c29818a7de1c1c70d3e6b0adda99f2e16181 |