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

Commit

Permalink
feat!: Generate SLO pass and warning criteria from Data Explorer thre…
Browse files Browse the repository at this point in the history
…sholds (#846)

* Add threshold colors

Signed-off-by: Arthur Pitman <[email protected]>

* Add initial types for dashboard thresholds

Signed-off-by: Arthur Pitman <[email protected]>

* Add threshold parsing logic

Signed-off-by: Arthur Pitman <[email protected]>

* Fix tests with conflicting pass criteria

Signed-off-by: Arthur Pitman <[email protected]>

* Activate Data Explorer tile thresholds

Signed-off-by: Arthur Pitman <[email protected]>

* Produce error for any unit other than auto

Signed-off-by: Arthur Pitman <[email protected]>

* Generate better error messages

Signed-off-by: Arthur Pitman <[email protected]>

* Refactoring and remove redundant tests

Signed-off-by: Arthur Pitman <[email protected]>

* Initial documentation for feature

Signed-off-by: Arthur Pitman <[email protected]>

Signed-off-by: Arthur Pitman <[email protected]>
  • Loading branch information
arthurpitman authored Aug 12, 2022
1 parent ca2680d commit 68f95ee
Show file tree
Hide file tree
Showing 28 changed files with 1,755 additions and 19 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 40 additions & 1 deletion documentation/slis-via-dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,47 @@ The following dashboard tile types are supported:

### Data explorer tiles

Data explorer tiles must only include a single query (i.e., one metric) and include up to one *filter by* and up to one *split by* clause. Metric selectors provided via the code tab are currently not supported.
Data explorer tiles must only include a single query (i.e., one metric) and include up to one *filter by* and up to one *split by* clause. Furthermore, the unit of the query must be set to `auto` (the default setting).

Metric selectors provided via the code tab are currently not supported.

To make it easy to define SLOs using Data Explorer tiles, pass and warning criteria may be specified by adding visual thresholds directly to the tile rather than using pass and warn criteria in the tile's title. If thresholds and pass and warn criteria have been specified, the thresholds will be ignored.

Pass-warn-fail and fail-warn-pass configurations are supported. In both cases, three thresholds must be added using strictly monotonically increasing values and colors from the pre-defined color palette:

![Threshold colors in Data Explorer color palette](images/data-explorer-color-palette.png "Threshold colors in Data Explorer color palette")

**Example: pass-warn-fail thresholds applied to the `builtin:service.response.time` metric**

![Data Explorer thresholds - builtin:service.response.time](images/data-explorer-service-response-time-thresholds.png "Data Explorer thresholds - builtin:service.response.time")

This configuration produces the following SLO criteria:

```{yaml}
pass:
- criteria:
- ">=0"
- "<650000"
warning:
- criteria:
- ">=0"
- "<70000"
```

**Example: fail-warn-pass thresholds applied to the `builtin:host.disk.avail` metric**

![Data Explorer thresholds - builtin:host.disk.avail](images/data-explorer-disk-avail-thresholds.png "Data Explorer thresholds - builtin:host.disk.avail")

This configuration produces the following SLO criteria:

```{yaml}
pass:
- criteria:
- ">=549755813888"
warning:
- criteria:
- ">=274877906944"
```

### Custom chart tiles

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/keptn/go-utils v0.16.1-0.20220628141633-eb5fb9ba43e0
github.com/sirupsen/logrus v1.9.0
github.com/stretchr/testify v1.8.0
golang.org/x/exp v0.0.0-20220713135740-79cabaa25d75
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.24.3
k8s.io/apimachinery v0.24.3
Expand All @@ -30,7 +31,6 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/imdario/mergo v0.3.13 // indirect
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
Expand Down Expand Up @@ -369,6 +368,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20220713135740-79cabaa25d75 h1:x03zeu7B2B11ySp+daztnwM5oBJ/8wGUSqrwcw9L0RA=
golang.org/x/exp v0.0.0-20220713135740-79cabaa25d75/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
Expand Down
24 changes: 24 additions & 0 deletions internal/dynatrace/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,30 @@ type Tile struct {
AssignedEntities []string `json:"assignedEntities,omitempty"`
ExcludeMaintenanceWindows bool `json:"excludeMaintenanceWindows,omitempty"`
FilterConfig *FilterConfig `json:"filterConfig,omitempty"`
VisualConfig *VisualConfig `json:"visualConfig,omitempty"`
}

// VisualConfig is the visual configuration for a dashboard tile.
type VisualConfig struct {
Thresholds []Threshold `json:"thresholds,omitempty"`
Rules []VisualConfigRule `json:"rules,omitempty"`
}

// VisualConfigRule is a rule for the visual configuration.
type VisualConfigRule struct {
UnitTransform string `json:"unitTransform,omitempty"`
}

// Threshold is a threshold configuration for a Data Explorer tile.
type Threshold struct {
Visible bool `json:"visible"`
Rules []ThresholdRule `json:"rules,omitempty"`
}

// ThresholdRule is a rule for a threshold.
type ThresholdRule struct {
Value *float64 `json:"value,omitempty"`
Color string `json:"color"`
}

type Bounds struct {
Expand Down
Loading

0 comments on commit 68f95ee

Please sign in to comment.