From 6591037d1dddb4b39e0a2881f989f51b27a1dc17 Mon Sep 17 00:00:00 2001 From: BrunoReboul Date: Fri, 15 Jan 2021 09:19:54 +0100 Subject: [PATCH] feat: pubsub widget --- .../mon/const_widgetsuboldestunackedmsg.go | 46 +++++++++++++++++++ utilities/mon/func_getgcfwidget.go | 2 + .../meth_deployment_configuresetdashboards.go | 2 +- 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 utilities/mon/const_widgetsuboldestunackedmsg.go diff --git a/utilities/mon/const_widgetsuboldestunackedmsg.go b/utilities/mon/const_widgetsuboldestunackedmsg.go new file mode 100644 index 0000000..35d2d67 --- /dev/null +++ b/utilities/mon/const_widgetsuboldestunackedmsg.go @@ -0,0 +1,46 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the 'License'); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an 'AS IS' BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package mon + +const widgetSubOldestUnackedMsg = ` +{ + "title": "mservice_name pubsub oldest unacked msg", + "xyChart": { + "chartOptions": { + "mode": "COLOR" + }, + "dataSets": [ + { + "minAlignmentPeriod": "60s", + "plotType": "LINE", + "timeSeriesQuery": { + "timeSeriesFilter": { + "aggregation": { + "perSeriesAligner": "ALIGN_MEAN" + }, + "filter": "metric.type=\"pubsub.googleapis.com/subscription/oldest_unacked_message_age\" resource.type=\"pubsub_subscription\" resource.label.\"subscription_id\"=monitoring.regex.full_match(\".*mservice_name.*\")", + "secondaryAggregation": {} + } + } + } + ], + "timeshiftDuration": "0s", + "yAxis": { + "label": "y1Axis", + "scale": "LINEAR" + } + } +} +` diff --git a/utilities/mon/func_getgcfwidget.go b/utilities/mon/func_getgcfwidget.go index 96a33f5..d5e4128 100644 --- a/utilities/mon/func_getgcfwidget.go +++ b/utilities/mon/func_getgcfwidget.go @@ -40,6 +40,8 @@ func GetGCFWidget(microserviceName string, widgetType string) (widget monitoring widgetTypeJSON = widgetRAMLatency case "widgetRAMTriggerAge": widgetTypeJSON = widgetRAMTriggerAge + case "widgetSubOldestUnackedMsg": + widgetTypeJSON = widgetSubOldestUnackedMsg default: return widget, fmt.Errorf("Unsupported widgetType") } diff --git a/utilities/ramcli/meth_deployment_configuresetdashboards.go b/utilities/ramcli/meth_deployment_configuresetdashboards.go index 7ee21c3..7fe1c2f 100644 --- a/utilities/ramcli/meth_deployment_configuresetdashboards.go +++ b/utilities/ramcli/meth_deployment_configuresetdashboards.go @@ -76,7 +76,7 @@ func (deployment *Deployment) configureSetDashboards() (err error) { // dashboards["RAM latency"] = dashboard dashboard.columns = 3 - dashboard.widgetTypeList = []string{"widgetRAMe2eLatency", "widgetRAMLatency", "widgetRAMTriggerAge", "widgetGCFActiveInstances", "widgetGCFExecutionCount", "widgetGCFExecutionTime", "widgetGCFMemoryUsage"} + dashboard.widgetTypeList = []string{"widgetRAMe2eLatency", "widgetRAMLatency", "widgetRAMTriggerAge", "widgetSubOldestUnackedMsg", "widgetGCFActiveInstances", "widgetGCFExecutionCount", "widgetGCFExecutionTime", "widgetGCFMemoryUsage"} for _, microServiceName := range []string{"stream2bq", "monitor", "upload2gcs", "publish2fs", "splitdump", "dumpinventory", "listgroupmembers", "getgroupsettings", "listgroups", "convertlog2feed"} { dashboard.microServiceNameList = []string{microServiceName} dashboards[fmt.Sprintf("RAM %s", microServiceName)] = dashboard