Skip to content

Commit

Permalink
feat: setdashboard ram_latency
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoReboul committed Jan 13, 2021
1 parent 725c94d commit ade9311
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 7 deletions.
47 changes: 47 additions & 0 deletions utilities/mon/const_widgetrame2elatency.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// 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 widgetRAMe2eLatency = `
{
"title": "microservice_name end to end latency",
"xyChart": {
"chartOptions": {
"mode": "COLOR"
},
"dataSets": [
{
"minAlignmentPeriod": "60s",
"plotType": "HEATMAP",
"timeSeriesQuery": {
"timeSeriesFilter": {
"aggregation": {
"crossSeriesReducer": "REDUCE_SUM",
"perSeriesAligner": "ALIGN_DELTA"
},
"filter": "metric.type=\"logging.googleapis.com/user/ram_latency_e2e\" resource.type=\"cloud_function\" metric.label.\"microservice_name\"=\"microservice_name\"",
"secondaryAggregation": {}
}
}
}
],
"timeshiftDuration": "0s",
"yAxis": {
"label": "y1Axis",
"scale": "LINEAR"
}
}
}
`
47 changes: 47 additions & 0 deletions utilities/mon/const_widgetramlatency.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// 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 widgetRAMLatency = `
{
"title": "microservice_name latency",
"xyChart": {
"chartOptions": {
"mode": "COLOR"
},
"dataSets": [
{
"minAlignmentPeriod": "60s",
"plotType": "HEATMAP",
"timeSeriesQuery": {
"timeSeriesFilter": {
"aggregation": {
"crossSeriesReducer": "REDUCE_SUM",
"perSeriesAligner": "ALIGN_DELTA"
},
"filter": "metric.type=\"logging.googleapis.com/user/ram_latency\" resource.type=\"cloud_function\" metric.label.\"microservice_name\"=\"microservice_name\"",
"secondaryAggregation": {}
}
}
}
],
"timeshiftDuration": "0s",
"yAxis": {
"label": "y1Axis",
"scale": "LINEAR"
}
}
}
`
47 changes: 47 additions & 0 deletions utilities/mon/const_widgetramtriggerage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// 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 widgetRAMTriggerAge = `
{
"title": "microservice_name trigger age",
"xyChart": {
"chartOptions": {
"mode": "COLOR"
},
"dataSets": [
{
"minAlignmentPeriod": "60s",
"plotType": "HEATMAP",
"timeSeriesQuery": {
"timeSeriesFilter": {
"aggregation": {
"crossSeriesReducer": "REDUCE_SUM",
"perSeriesAligner": "ALIGN_DELTA"
},
"filter": "metric.type=\"logging.googleapis.com/user/ram_trigger_age\" resource.type=\"cloud_function\" metric.label.\"microservice_name\"=\"microservice_name\"",
"secondaryAggregation": {}
}
}
}
],
"timeshiftDuration": "0s",
"yAxis": {
"label": "y1Axis",
"scale": "LINEAR"
}
}
}
`
6 changes: 6 additions & 0 deletions utilities/mon/func_getgcfwidget.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ func GetGCFWidget(microserviceName string, widgetType string) (widget monitoring
widgetTypeJSON = widgetGCFExecutionTime
case "widgetGCFMemoryUsage":
widgetTypeJSON = widgetGCFMemoryUsage
case "widgetRAMe2eLatency":
widgetTypeJSON = widgetRAMe2eLatency
case "widgetRAMLatency":
widgetTypeJSON = widgetRAMLatency
case "widgetRAMTriggerAge":
widgetTypeJSON = widgetRAMTriggerAge
default:
return widget, fmt.Errorf("Unsupported widgetType")
}
Expand Down
40 changes: 33 additions & 7 deletions utilities/ramcli/meth_deployment_configuresetdashboards.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,42 @@ func (deployment *Deployment) configureSetDashboards() (err error) {
os.Mkdir(instancesFolderPath, 0755)
}

var dashboards = map[string][]string{
"RAM core microservices": []string{"dumpinventory", "splitdump", "monitor", "stream2bq", "publish2fs", "upload2gcs"},
"RAM groups microservices": []string{"convertlog2feed", "listgroups", "getgroupsettings", "listgroupmembers"},
// var dashboards = map[string][]string{
// "RAM core microservices": []string{"dumpinventory", "splitdump", "monitor", "stream2bq", "publish2fs", "upload2gcs"},
// "RAM groups microservices": []string{"convertlog2feed", "listgroups", "getgroupsettings", "listgroupmembers"},
// }
// setDashboardsInstance.MON.Columns = 4
// setDashboardsInstance.MON.WidgetTypeList = []string{"widgetGCFActiveInstances", "widgetGCFExecutionCount", "widgetGCFExecutionTime", "widgetGCFMemoryUsage"}

type dboard struct {
columns int64
microServiceNameList []string
widgetTypeList []string
}
setDashboardsInstance.MON.Columns = 4
setDashboardsInstance.MON.WidgetTypeList = []string{"widgetGCFActiveInstances", "widgetGCFExecutionCount", "widgetGCFExecutionTime", "widgetGCFMemoryUsage"}
type dboards map[string]dboard

var dashboard dboard
var dashboards dboards
dashboards = make(dboards)

dashboard.columns = 4
dashboard.widgetTypeList = []string{"widgetGCFActiveInstances", "widgetGCFExecutionCount", "widgetGCFExecutionTime", "widgetGCFMemoryUsage"}
dashboard.microServiceNameList = []string{"dumpinventory", "splitdump", "monitor", "stream2bq", "publish2fs", "upload2gcs"}
dashboards["RAM core microservices"] = dashboard

dashboard.microServiceNameList = []string{"convertlog2feed", "listgroups", "getgroupsettings", "listgroupmembers"}
dashboards["RAM groups microservices"] = dashboard

dashboard.columns = 3
dashboard.widgetTypeList = []string{"widgetRAMe2eLatency", "widgetRAMLatency", "widgetRAMTriggerAge"}
dashboard.microServiceNameList = []string{"stream2bq", "monitor", "upload2gcs", "publish2fs", "splitdump", "dumpinventory", "listgroupmembers", "getgroupsettings", "listgroups", "convertlog2feed"}
dashboards["RAM latency"] = dashboard

for displayName, microServiceNameList := range dashboards {
for displayName, dashboard := range dashboards {
setDashboardsInstance.MON.DisplayName = displayName
setDashboardsInstance.MON.MicroServiceNameList = microServiceNameList
setDashboardsInstance.MON.Columns = dashboard.columns
setDashboardsInstance.MON.WidgetTypeList = dashboard.widgetTypeList
setDashboardsInstance.MON.MicroServiceNameList = dashboard.microServiceNameList
instanceFolderPath := fmt.Sprintf("%s/%s_%s",
instancesFolderPath,
serviceName,
Expand Down

0 comments on commit ade9311

Please sign in to comment.