No project description provided
Project description
pyslo
Calculate service level objective measurements from metrics stored in common backends in accordance with the logic set out in the SRE Workbook
Getting Started
Installation process
pip install pyslo
Build and Test
pytest
Current Support
Providers
At this time, the Stackdriver backend is supported. Future plans include Prometheus and Azure Monitoring
Metric Types
Stackdriver
- Boolean
Logic
The library pulls raw timeseries data from the metric provider and performs aggregations in memory. This is in order to standardize the computation across providers.
Boolean Metrics
sli = good_events/valid_events
where
- good events = (sum of metric entries == True)
- valic_events = (sum of metric entries)
Examples
Google Cloud StackDriver
This example uses a metric provided by GCP for the Composer service.
from google.cloud import monitoring_v3
from pyslo.metric_client import StackdriverMetricClient
from pyslo.sli import Sli
PROJECT = <>
metric_client = StackdriverMetricClient(project=PROJECT)
metric_client.metric_type = 'composer.googleapis.com/environment/healthy'
metric_client.value_type = monitoring_v3.enums.MetricDescriptor.ValueType.BOOL
sli = Sli(metric_client)
sli.window_length = 30 # days
sli.slo = 0.99
sli.get_metric_data()
# Calculate sli/slo doing no group bys.
sli.calculate()
sli.error_budget()
print(sli.slo_data)
# Group by some metric labels
sli.group_by_labels = ['environment_name', 'project_id']
sli.calculate()
sli.error_budget()
print(sli.slo_data)
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
pyslo-0.0.5.tar.gz
(7.9 kB
view hashes)
Built Distribution
pyslo-0.0.5-py3.7.egg
(20.5 kB
view hashes)