This folder is an SLO library to facilitate writing new SLOs by starting from already written SLO configurations.
All samples are classified within folders named after their respective backend or exporter class.
Each sample references environment variables that must be set prior to running it.
The following is listing all environment variables found in the SLO configs, per backend:
You can either set those variables for the backends you want to try, or set all of those in an .env file and then source it. Note that the actual GCP resources you're pointing to need to exist.
| Environment variable | Description |
|---|---|
WORKSPACE_PROJECT_ID |
Cloud Monitoring host project ID |
LOG_METRIC_NAME |
Cloud Logging log-based metric name |
GAE_PROJECT_ID |
Google App Engine application project ID |
GAE_MODULE_ID |
Google App Engine application module ID |
PUBSUB_PROJECT_ID |
Pub/Sub project ID |
PUBSUB_TOPIC_NAME |
Pub/Sub topic name |
| Environment variable | Description |
|---|---|
WORKSPACE_PROJECT_ID |
Cloud Monitoring host project ID |
LOG_METRIC_NAME |
Cloud Logging log-based metric name |
GAE_PROJECT_ID |
Google App Engine application project ID |
GAE_MODULE_ID |
Google App Engine application module ID |
PUBSUB_PROJECT_ID |
Pub/Sub project ID |
PUBSUB_TOPIC_NAME |
Pub/Sub topic name |
| Environment variable | Description |
|---|---|
WORKSPACE_PROJECT_ID |
Cloud Monitoring host project ID |
LOG_METRIC_NAME |
Cloud Logging log-based metric name |
GAE_PROJECT_ID |
Google App Engine application project ID |
GAE_MODULE_ID |
Google App Engine application module ID |
PUBSUB_PROJECT_ID |
Pub/Sub project ID |
PUBSUB_TOPIC_NAME |
Pub/Sub topic name |
GKE_PROJECT_ID |
GKE project ID |
GKE_LOCATION |
GKE location |
GKE_CLUSTER_NAME |
GKE cluster name |
GKE_SERVICE_NAMESPACE |
GKE service namespace |
GKE_SERVICE_NAME |
GKE service name |
| Environment variable | Description |
|---|---|
DATADOG_API_KEY |
Datadog API key |
DATADOG_APP_KEY |
Datadog APP key |
| Environment variable | Description |
|---|---|
DYNATRACE_API_URL |
Dynatrace API URL |
DYNATRACE_API_TOKEN |
Dynatrace API token |
| Environment variable | Description |
|---|---|
ELASTICSEARCH_URL |
ElasticSearch instance URL |
| Environment variable | Description |
|---|---|
PROMETHEUS_URL |
Prometheus instance URL |
PROMETHEUS_PUSHGATEWAY_URL |
Prometheus Pushgateway instance URL |
To run one sample:
slo-generator -f samples/cloud_monitoring/<filename>.yamlTo run all the samples for a backend:
slo-generator -f samples/<backend> -b samples/<error_budget_policy>where:
<backend>is the backend name (lowercase)<error_budget_policy>is the path to the error budget policy YAML file.
Note: if you want to enable the exporters as well, you can add the --export flag.
slo-generator -f samples/cloud_monitoring -b error_budget_policy.yamlslo-generator -f samples/cloud_monitoring_mql -b error_budget_policy.yamlslo-generator -f samples/cloud_service_monitoring -b error_budget_policy_ssm.yamlNote: the Error Budget Policy is different for this backend, because it only supports steps where window is a multiple of 24 hours.
slo-generator -f samples/datadog -b error_budget_policy.yamlslo-generator -f samples/dynatrace -b error_budget_policy.yamlslo-generator -f samples/elasticsearch -b error_budget_policy.yamlslo-generator -f samples/prometheus -b error_budget_policy.yamlcd samples/
slo-generator -f custom -b error_budget_policy.yaml -e