Skip to content
This repository has been archived by the owner on Nov 2, 2024. It is now read-only.

Commit

Permalink
chore(test): add SLO and dashboard basic tests
Browse files Browse the repository at this point in the history
Add test for dashboard configuration.
Add test for SLO configuration including availability and latency SLOs.
  • Loading branch information
minherz committed Jun 19, 2023
1 parent 9ef379c commit 8105f48
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 8 deletions.
16 changes: 15 additions & 1 deletion configurations/test/dashboards.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,18 @@

app-id: "test"
version: "0.0.1"
dashboards: []
dashboards:
- name: test-dashboard-1
display-name: "Test Dashboard 1"
widgets:
- title: "CPU Usage"
x-axis-label: "Time"
y-axis-label: "%"
datasets:
- time-series:
filter:
query: "metric.type=\"compute.googleapis.com/instance/cpu/usage_time\" resource.type=\"gce_instance\""
alignment: ALIGN_PERCENTILE_99
unit-override: "cpu"

min-alignment-period: "60s"
18 changes: 17 additions & 1 deletion configurations/test/slos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,20 @@

app-id: "test"
version: "0.0.1"
slos: []
slos:
- name: test-service-slo-1
display-name: "Test availability SLO for basic service"
goal: 0.5
period: WEEK
service: "gae:test-service"
sli:
availability: true

- name: test-service-slo-2
display-name: "Test latency SLO for basic service"
goal: 0.5
period: WEEK
service: "gae:test-service"
sli:
latency:
threshold: 10s
24 changes: 18 additions & 6 deletions provisioning/schemas/configuration/slos.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
},
"sli": {
"description": "The definition of good service, used to measure and calculate the quality of the Service's performance with respect to a single aspect of service quality",
"oneOf": [
"anyOf": [
{
"$ref": "#/$defs/basicSLI"
},
Expand All @@ -94,6 +94,9 @@
{
"type": "object",
"description": "Good service is defined to be the count of requests made to this service that return successfully",
"required": [
"availability"
],
"properties": {
"availability": {
"const": true
Expand All @@ -104,13 +107,22 @@
"type": "object",
"description": "Good service is defined to be the count of requests made to this service that are fast enough with respect to `latency.threshold`",
"required": [
"threshold"
"latency"
],
"properties": {
"threshold": {
"type": "string",
"description": "A duration string, e.g. 10s. Good service is defined to be the count of requests made to this service that return in no more than threshold.",
"pattern": "^[0-9]+s$"
"latency": {
"type": "object",
"description": "Good service is defined to be the count of requests made to this service that are fast enough with respect to `latency.threshold`",
"required": [
"threshold"
],
"properties": {
"threshold": {
"type": "string",
"description": "A duration string, e.g. 10s. Good service is defined to be the count of requests made to this service that return in no more than threshold.",
"pattern": "^[0-9]+s$"
}
}
}
}
}
Expand Down

0 comments on commit 8105f48

Please sign in to comment.