Skip to content

Commit

Permalink
Change ServiceLevelObjectiveHistory Uptime to SliValue (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-sato authored Mar 11, 2020
1 parent 46be6e0 commit f7dc02f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions service_level_objectives.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ type ServiceLevelObjectiveHistoryMetricSeries struct {

// ServiceLevelObjectiveHistoryMonitorSeries defines the SLO history data response for `monitor` type SLOs
type ServiceLevelObjectiveHistoryMonitorSeries struct {
Uptime float32 `json:"uptime"`
SliValue float32 `json:"sli_value"`
SpanPrecision json.Number `json:"span_precision"`
Name string `json:"name"`
Precision map[string]json.Number `json:"precision"`
Expand All @@ -536,7 +536,7 @@ type ServiceLevelObjectiveHistoryMonitorSeries struct {
// ServiceLevelObjectiveHistoryOverall defines the overall SLO history data response
// for `monitor` type SLOs there is an additional `History` property that rolls up the overall state correctly.
type ServiceLevelObjectiveHistoryOverall struct {
Uptime float32 `json:"uptime"`
SliValue float32 `json:"sli_value"`
SpanPrecision json.Number `json:"span_precision"`
Name string `json:"name"`
Precision map[string]json.Number `json:"precision"`
Expand Down
6 changes: 3 additions & 3 deletions service_level_objectives_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ func TestServiceLevelObjectiveIntegration(t *testing.T) {

assert.NoError(t2, err)
assert.Nil(t2, resp.Error)
assert.Equal(t2, float32(100), resp.Data.Overall.Uptime)
assert.Equal(t2, float32(100), resp.Data.Overall.SliValue)
assert.Equal(t2, json.Number("3698988"), resp.Data.Metrics.Numerator.Sum)
assert.Equal(t2, json.Number("3698988"), resp.Data.Metrics.Denominator.Sum)
})
Expand All @@ -350,9 +350,9 @@ func TestServiceLevelObjectiveIntegration(t *testing.T) {
)
assert.NoError(t2, err)
assert.Nil(t2, resp.Error)
assert.Equal(t2, float32(6.765872955322266), resp.Data.Overall.Uptime)
assert.Equal(t2, float32(6.765872955322266), resp.Data.Overall.SliValue)
assert.Len(t2, resp.Data.Groups, 1)
assert.Equal(t2, float32(6.765872955322266), resp.Data.Groups[0].Uptime)
assert.Equal(t2, float32(6.765872955322266), resp.Data.Groups[0].SliValue)
assert.Equal(t2, "some:tag", resp.Data.Groups[0].Name)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
}
},
"overall": {
"uptime": 100,
"sli_value": 100,
"span_precision": 0,
"precision": {
"7d": 0,
Expand All @@ -88,4 +88,4 @@
"from_ts": 1571162100
},
"error": null
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
},
"overall": {
"uptime": 6.765872955322266,
"sli_value": 6.765872955322266,
"span_precision": 2,
"name": "test uptime",
"precision": {
Expand Down Expand Up @@ -587,7 +587,7 @@
"from_ts": 1571162100,
"groups": [
{
"uptime": 6.765872955322266,
"sli_value": 6.765872955322266,
"span_precision": 2,
"name": "some:tag",
"precision": {
Expand Down Expand Up @@ -1164,4 +1164,4 @@
]
},
"error": null
}
}

0 comments on commit f7dc02f

Please sign in to comment.