Skip to content

Commit

Permalink
monitoring: add emptyView
Browse files Browse the repository at this point in the history
  • Loading branch information
justinsb committed Jun 29, 2024
1 parent 4f47814 commit 2a5379c
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 5 deletions.
7 changes: 4 additions & 3 deletions apis/monitoring/v1beta1/monitoringdashboard_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,11 +703,9 @@ type Scorecard struct {
// Will cause the scorecard to show a spark chart.
SparkChartView *Scorecard_SparkChartView `json:"sparkChartView,omitempty"`

/*NOTYET
// Will cause the `Scorecard` to show only the value, with no indicator to
// its value relative to its thresholds.
BlankView *Empty `json:"blankView,omitempty"`
*/
BlankView *BlankView `json:"blankView,omitempty"`

// The thresholds used to determine the state of the scorecard given the
// time series' current value. For an actual value x, the scorecard is in a
Expand Down Expand Up @@ -750,6 +748,9 @@ type Scorecard struct {
Thresholds []Threshold `json:"thresholds,omitempty"`
}

type BlankView struct {
}

// +kcc:proto=google.monitoring.dashboard.v1.Scorecard.GaugeView
type Scorecard_GaugeView struct {
// The lower bound for this gauge chart. The value of the chart should
Expand Down
21 changes: 21 additions & 0 deletions apis/monitoring/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,11 @@ spec:
scorecard:
description: A scorecard summarizing time series data.
properties:
blankView:
description: Will cause the `Scorecard` to show
only the value, with no indicator to its value
relative to its thresholds.
type: object
gaugeView:
description: Will cause the scorecard to show
a gauge chart.
Expand Down Expand Up @@ -3844,6 +3849,11 @@ spec:
scorecard:
description: A scorecard summarizing time series data.
properties:
blankView:
description: Will cause the `Scorecard` to show only
the value, with no indicator to its value relative
to its thresholds.
type: object
gaugeView:
description: Will cause the scorecard to show a gauge
chart.
Expand Down Expand Up @@ -6654,6 +6664,11 @@ spec:
scorecard:
description: A scorecard summarizing time series data.
properties:
blankView:
description: Will cause the `Scorecard` to show
only the value, with no indicator to its value
relative to its thresholds.
type: object
gaugeView:
description: Will cause the scorecard to show a
gauge chart.
Expand Down Expand Up @@ -9605,6 +9620,11 @@ spec:
scorecard:
description: A scorecard summarizing time series data.
properties:
blankView:
description: Will cause the `Scorecard` to show
only the value, with no indicator to its value
relative to its thresholds.
type: object
gaugeView:
description: Will cause the scorecard to show
a gauge chart.
Expand Down
1 change: 1 addition & 0 deletions docs/releasenotes/release-1.120.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ output fields from GCP APIs are in `status.observedState.*`
* Added `singleViewGroup` widgets.
* Added `timeSeriesTable` widgets.

* Added `blankView` to `scorecard` widgets.
* Added `dataSets.targetAxis` and `y2Axis` fields to `xyChart` widgets.
* Added `id` field to all widgets.
* Added `prometheusQuery` and `outputFullDuration` to timeSeriesQuery.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ func Scorecard_FromProto(mapCtx *MapContext, in *pb.Scorecard) *krm.Scorecard {
out.TimeSeriesQuery = TimeSeriesQuery_FromProto(mapCtx, in.GetTimeSeriesQuery())
out.GaugeView = Scorecard_GaugeView_FromProto(mapCtx, in.GetGaugeView())
out.SparkChartView = Scorecard_SparkChartView_FromProto(mapCtx, in.GetSparkChartView())
// MISSING: BlankView
out.BlankView = BlankView_FromProto(mapCtx, in.GetBlankView())
out.Thresholds = Slice_FromProto(mapCtx, in.Thresholds, Threshold_FromProto)
return out
}
Expand All @@ -425,7 +425,9 @@ func Scorecard_ToProto(mapCtx *MapContext, in *krm.Scorecard) *pb.Scorecard {
if oneof := Scorecard_SparkChartView_ToProto(mapCtx, in.SparkChartView); oneof != nil {
out.DataView = &pb.Scorecard_SparkChartView_{SparkChartView: oneof}
}
// MISSING: BlankView
if oneof := BlankView_ToProto(mapCtx, in.BlankView); oneof != nil {
out.DataView = &pb.Scorecard_BlankView{BlankView: oneof}
}
out.Thresholds = Slice_ToProto(mapCtx, in.Thresholds, Threshold_ToProto)
return out
}
Expand Down
15 changes: 15 additions & 0 deletions pkg/controller/direct/monitoring/dashboard_mappings.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,18 @@ func DashboardFilter_StringValue_ToProto(mapCtx *MapContext, in *string) *pb.Das
out.StringValue = *in
return out
}

func BlankView_FromProto(mapCtx *MapContext, in *emptypb.Empty) *krm.BlankView {
if in == nil {
return nil
}
out := &krm.BlankView{}
return out
}
func BlankView_ToProto(mapCtx *MapContext, in *krm.BlankView) *emptypb.Empty {
if in == nil {
return nil
}
out := &emptypb.Empty{}
return out
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ spec:
collapsed: true
title: CollapsibleGroup Widget
- scorecard:
blankView: {}
timeSeriesQuery:
outputFullDuration: true
prometheusQuery: sum(mysql_global_status_uptime{${Cluster},${Location},${Namespace}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ spec:
collapsed: true
title: CollapsibleGroup Widget
- scorecard:
blankView: {}
timeSeriesQuery:
outputFullDuration: true
prometheusQuery: sum(mysql_global_status_uptime{${Cluster},${Location},${Namespace}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ x-goog-request-params: parent=projects%2F${projectId}
},
{
"scorecard": {
"blankView": {},
"timeSeriesQuery": {
"outputFullDuration": true,
"prometheusQuery": "sum(mysql_global_status_uptime{${Cluster},${Location},${Namespace}} / 60)"
Expand Down Expand Up @@ -546,6 +547,7 @@ X-Xss-Protection: 0
},
{
"scorecard": {
"blankView": {},
"timeSeriesQuery": {
"outputFullDuration": true,
"prometheusQuery": "sum(mysql_global_status_uptime{${Cluster},${Location},${Namespace}} / 60)"
Expand Down Expand Up @@ -799,6 +801,7 @@ X-Xss-Protection: 0
},
{
"scorecard": {
"blankView": {},
"timeSeriesQuery": {
"outputFullDuration": true,
"prometheusQuery": "sum(mysql_global_status_uptime{${Cluster},${Location},${Namespace}} / 60)"
Expand Down Expand Up @@ -1040,6 +1043,7 @@ x-goog-request-params: dashboard.name=projects%2F${projectId}%2Fdashboards%2Fmon
},
{
"scorecard": {
"blankView": {},
"timeSeriesQuery": {
"outputFullDuration": true,
"prometheusQuery": "sum(mysql_global_status_uptime{${Cluster},${Location},${Namespace}} / 60)"
Expand Down Expand Up @@ -1285,6 +1289,7 @@ X-Xss-Protection: 0
},
{
"scorecard": {
"blankView": {},
"timeSeriesQuery": {
"outputFullDuration": true,
"prometheusQuery": "sum(mysql_global_status_uptime{${Cluster},${Location},${Namespace}} / 60)"
Expand Down Expand Up @@ -1538,6 +1543,7 @@ X-Xss-Protection: 0
},
{
"scorecard": {
"blankView": {},
"timeSeriesQuery": {
"outputFullDuration": true,
"prometheusQuery": "sum(mysql_global_status_uptime{${Cluster},${Location},${Namespace}} / 60)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ spec:
collapsed: true
- title: "Scorecard Widget"
scorecard:
blankView: {}
timeSeriesQuery:
outputFullDuration: true
prometheusQuery: "sum(mysql_global_status_uptime{${Cluster},${Location},${Namespace}} / 60)"
Expand Down

0 comments on commit 2a5379c

Please sign in to comment.