From ae00176bf7273b4cad99e08e06bb0318d7bef929 Mon Sep 17 00:00:00 2001 From: yduartep Date: Fri, 30 Aug 2024 10:59:39 +0200 Subject: [PATCH 01/13] define new gcp load balancer dashboard in csp-mixin --- csp-mixin/config.libsonnet | 1 + csp-mixin/dashboards.libsonnet | 22 +++++++++ csp-mixin/main.libsonnet | 1 + csp-mixin/panels.libsonnet | 16 +++++++ csp-mixin/rows.libsonnet | 19 ++++++++ csp-mixin/signals/loadbalancer.libsonnet | 61 ++++++++++++++++++++++++ 6 files changed, 120 insertions(+) create mode 100644 csp-mixin/signals/loadbalancer.libsonnet diff --git a/csp-mixin/config.libsonnet b/csp-mixin/config.libsonnet index 8a8481641..4564a20ec 100644 --- a/csp-mixin/config.libsonnet +++ b/csp-mixin/config.libsonnet @@ -9,6 +9,7 @@ blobstore: (import './signals/blobstore.libsonnet')(this), azureelasticpool: (import './signals/azureelasticpool.libsonnet')(this), azuresqldb: (import './signals/azuresqldb.libsonnet')(this), + loadbalancer: (import './signals/loadbalancer.libsonnet')(this), }, blobStorage: { enableAvailability: false, diff --git a/csp-mixin/dashboards.libsonnet b/csp-mixin/dashboards.libsonnet index dc90d5ec3..02a0fb741 100644 --- a/csp-mixin/dashboards.libsonnet +++ b/csp-mixin/dashboards.libsonnet @@ -27,6 +27,28 @@ local commonlib = import 'common-lib/common/main.libsonnet'; ), } + + { + [csplib.config.uid + '-loadbalancer.json']: + local variables = csplib.signals.loadbalancer.getVariablesMultiChoice(); + g.dashboard.new(csplib.config.dashboardNamePrefix + 'Load Balancing') + + g.dashboard.withUid(csplib.config.uid + '-loadbalancer') + + g.dashboard.withTags(csplib.config.dashboardTags) + + g.dashboard.withTimezone(csplib.config.dashboardTimezone) + + g.dashboard.withRefresh(csplib.config.dashboardRefresh) + + g.dashboard.timepicker.withTimeOptions(csplib.config.dashboardPeriod) + + g.dashboard.withVariables([ + if std.asciiLower(v.label) == std.asciiLower(csplib.config.blobStorage.bucketLabel) //v.label == 'Bucket_name' + then v { label: 'Bucket Name' } + else v + for v in variables + ]) + + g.dashboard.withPanels( + g.util.grid.wrapPanels( + csplib.grafana.rows.glb_requests + ) + ), + } + + if csplib.config.uid == 'azure' then { [csplib.config.uid + '-elasticpool.json']: diff --git a/csp-mixin/main.libsonnet b/csp-mixin/main.libsonnet index 9ffd7aece..38e2d634c 100644 --- a/csp-mixin/main.libsonnet +++ b/csp-mixin/main.libsonnet @@ -9,6 +9,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; blobstore: commonlib.signals.unmarshallJsonMulti(this.config.signals.blobstore, type=this.config.metricsSource), azureelasticpool: commonlib.signals.unmarshallJsonMulti(this.config.signals.azureelasticpool, type=this.config.metricsSource), azuresqldb: commonlib.signals.unmarshallJsonMulti(this.config.signals.azuresqldb, type=this.config.metricsSource), + loadbalancer: commonlib.signals.unmarshallJsonMulti(this.config.signals.loadbalancer, type=this.config.metricsSource), }, grafana: { panels: (import './panels.libsonnet').new(this), diff --git a/csp-mixin/panels.libsonnet b/csp-mixin/panels.libsonnet index 553ac40a0..110e9edab 100644 --- a/csp-mixin/panels.libsonnet +++ b/csp-mixin/panels.libsonnet @@ -383,5 +383,21 @@ local commonlib = import 'common-lib/common/main.libsonnet'; ], 'DTU utilization and limits by database' ) + self._asql_tableCommon(), + + glb_reqsec: + this.signals.loadbalancer.requestsByStatus.asTimeSeries() + + commonlib.panels.generic.timeSeries.base.stylize(), + + glb_reqcountry: + this.signals.loadbalancer.requestsByCountry.asTimeSeries() + + commonlib.panels.generic.timeSeries.base.stylize(), + + glb_reqcache: + this.signals.loadbalancer.requestsByCache.asTimeSeries() + + commonlib.panels.generic.timeSeries.base.stylize(), + + glb_reqprotocol: + this.signals.loadbalancer.requestsByProtocol.asTimeSeries() + + commonlib.panels.generic.timeSeries.base.stylize(), }, } diff --git a/csp-mixin/rows.libsonnet b/csp-mixin/rows.libsonnet index 8738c3911..f367f88a2 100644 --- a/csp-mixin/rows.libsonnet +++ b/csp-mixin/rows.libsonnet @@ -116,5 +116,24 @@ local g = import './g.libsonnet'; + g.panel.timeSeries.gridPos.withW(12) + g.panel.timeSeries.gridPos.withH(8), ], + + glb_requests: [ + g.panel.row.new('Load Balancer Requests'), + this.grafana.panels.glb_reqsec + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.glb_reqcountry + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.glb_reqcache + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.glb_reqprotocol + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + ], }, } diff --git a/csp-mixin/signals/loadbalancer.libsonnet b/csp-mixin/signals/loadbalancer.libsonnet new file mode 100644 index 000000000..69cd582f8 --- /dev/null +++ b/csp-mixin/signals/loadbalancer.libsonnet @@ -0,0 +1,61 @@ +local commonlib = import 'common-lib/common/main.libsonnet'; +function(this) + { + local s = self, + filteringSelector: this.filteringSelector, + groupLabels: this.groupLabels, + instanceLabels: this.instanceLabels, + aggLevel: 'instance', + discoveryMetric: { + stackdriver: 'stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count' + }, + signals: { + requestsByStatus: { + name: 'Requests / sec', + description: 'The number of requests per second by status code.', + type: 'raw', + sources: { + stackdriver: { + expr: 'label_replace(sum by (response_code_class) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{%(queriesSelector)s}[$__rate_interval])),"response_code_class","${1}xx","response_code_class","([0-9])00")', + legendCustomTemplate: '{{response_code_class}}', + }, + }, + }, + + requestsByCountry: { + name: 'Requests by Country', + description: 'The number of requests per second by client country.', + type: 'raw', + sources: { + stackdriver: { + expr: 'sum by (backend_target_name, client_country) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{%(queriesSelector)s}[$__rate_interval]))', + legendCustomTemplate: '{{client_country}}', + }, + }, + }, + + requestsByCache: { + name: 'Requests by Cache Results', + description: 'The cache results per second of requests.', + type: 'raw', + sources: { + stackdriver: { + expr: 'sum by (backend_target_name, cache_result) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{%(queriesSelector)s}[$__rate_interval]))', + legendCustomTemplate: '{{cache_result}}', + }, + }, + }, + + requestsByProtocol: { + name: 'Requests by protocol', + description: 'Requests per second by protocol.', + type: 'raw', + sources: { + stackdriver: { + expr: 'sum by (backend_target_name, protocol) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{%(queriesSelector)s}[$__rate_interval]))', + legendCustomTemplate: '{{protocol}}', + }, + }, + }, + }, + } From 7263f6f6122db2ddd9734d357b39dc5417a94c58 Mon Sep 17 00:00:00 2001 From: yduartep Date: Fri, 30 Aug 2024 11:19:52 +0200 Subject: [PATCH 02/13] format libsonnet file --- csp-mixin/signals/loadbalancer.libsonnet | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/csp-mixin/signals/loadbalancer.libsonnet b/csp-mixin/signals/loadbalancer.libsonnet index 69cd582f8..076801623 100644 --- a/csp-mixin/signals/loadbalancer.libsonnet +++ b/csp-mixin/signals/loadbalancer.libsonnet @@ -7,7 +7,7 @@ function(this) instanceLabels: this.instanceLabels, aggLevel: 'instance', discoveryMetric: { - stackdriver: 'stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count' + stackdriver: 'stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count', }, signals: { requestsByStatus: { @@ -15,10 +15,10 @@ function(this) description: 'The number of requests per second by status code.', type: 'raw', sources: { - stackdriver: { - expr: 'label_replace(sum by (response_code_class) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{%(queriesSelector)s}[$__rate_interval])),"response_code_class","${1}xx","response_code_class","([0-9])00")', - legendCustomTemplate: '{{response_code_class}}', - }, + stackdriver: { + expr: 'label_replace(sum by (response_code_class) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{%(queriesSelector)s}[$__rate_interval])),"response_code_class","${1}xx","response_code_class","([0-9])00")', + legendCustomTemplate: '{{response_code_class}}', + }, }, }, @@ -28,8 +28,8 @@ function(this) type: 'raw', sources: { stackdriver: { - expr: 'sum by (backend_target_name, client_country) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{%(queriesSelector)s}[$__rate_interval]))', - legendCustomTemplate: '{{client_country}}', + expr: 'sum by (backend_target_name, client_country) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{%(queriesSelector)s}[$__rate_interval]))', + legendCustomTemplate: '{{client_country}}', }, }, }, From 2bd536d30153c5e1bfcd6cd6dbb125e6f4e70287 Mon Sep 17 00:00:00 2001 From: Ryan Geyer Date: Fri, 30 Aug 2024 16:07:04 -0700 Subject: [PATCH 03/13] Add a GCP only section for dashboards --- csp-mixin/dashboards.libsonnet | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/csp-mixin/dashboards.libsonnet b/csp-mixin/dashboards.libsonnet index 02a0fb741..802c62998 100644 --- a/csp-mixin/dashboards.libsonnet +++ b/csp-mixin/dashboards.libsonnet @@ -27,6 +27,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; ), } + + if csplib.config.uid == 'gcp' then { [csplib.config.uid + '-loadbalancer.json']: local variables = csplib.signals.loadbalancer.getVariablesMultiChoice(); @@ -47,7 +48,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; csplib.grafana.rows.glb_requests ) ), - } + } else {} + if csplib.config.uid == 'azure' then { From fc9d5e3d228d6216017d77c6981139535a5b7c82 Mon Sep 17 00:00:00 2001 From: yduartep Date: Sun, 1 Sep 2024 19:20:19 +0200 Subject: [PATCH 04/13] fix load balancer requests row panels --- csp-mixin/dashboards.libsonnet | 94 ++++++++++++------------ csp-mixin/gcpconfig.libsonnet | 5 ++ csp-mixin/panels.libsonnet | 16 +++- csp-mixin/signals/loadbalancer.libsonnet | 4 +- 4 files changed, 67 insertions(+), 52 deletions(-) diff --git a/csp-mixin/dashboards.libsonnet b/csp-mixin/dashboards.libsonnet index 802c62998..c8f8e3097 100644 --- a/csp-mixin/dashboards.libsonnet +++ b/csp-mixin/dashboards.libsonnet @@ -28,60 +28,62 @@ local commonlib = import 'common-lib/common/main.libsonnet'; } + if csplib.config.uid == 'gcp' then - { - [csplib.config.uid + '-loadbalancer.json']: - local variables = csplib.signals.loadbalancer.getVariablesMultiChoice(); - g.dashboard.new(csplib.config.dashboardNamePrefix + 'Load Balancing') - + g.dashboard.withUid(csplib.config.uid + '-loadbalancer') - + g.dashboard.withTags(csplib.config.dashboardTags) - + g.dashboard.withTimezone(csplib.config.dashboardTimezone) - + g.dashboard.withRefresh(csplib.config.dashboardRefresh) - + g.dashboard.timepicker.withTimeOptions(csplib.config.dashboardPeriod) - + g.dashboard.withVariables([ - if std.asciiLower(v.label) == std.asciiLower(csplib.config.blobStorage.bucketLabel) //v.label == 'Bucket_name' - then v { label: 'Bucket Name' } - else v - for v in variables - ]) - + g.dashboard.withPanels( - g.util.grid.wrapPanels( - csplib.grafana.rows.glb_requests - ) - ), - } else {} - + - if csplib.config.uid == 'azure' then { - [csplib.config.uid + '-elasticpool.json']: - local variables = csplib.signals.azureelasticpool.getVariablesMultiChoice(); - g.dashboard.new(csplib.config.dashboardNamePrefix + 'Elastic pool') - + g.dashboard.withUid(csplib.config.uid + '-elasticpool') + [csplib.config.uid + '-loadbalancer.json']: + local variables = csplib.signals.loadbalancer.getVariablesMultiChoice(); + g.dashboard.new(csplib.config.dashboardNamePrefix + 'Load Balancing') + + g.dashboard.withUid(csplib.config.uid + '-loadbalancer') + g.dashboard.withTags(csplib.config.dashboardTags) + g.dashboard.withTimezone(csplib.config.dashboardTimezone) + g.dashboard.withRefresh(csplib.config.dashboardRefresh) + g.dashboard.timepicker.withTimeOptions(csplib.config.dashboardPeriod) - + g.dashboard.withVariables(variables) + + g.dashboard.withVariables([ + if std.asciiLower(v.label) == std.asciiLower(csplib.config.loadBalancer.backendLabel) + then v { label: 'Backend Target' } + else if std.asciiLower(v.label) == std.asciiLower(csplib.config.loadBalancer.countryLabel) + then v { label: 'Country' } + else v + for v in variables + ]) + g.dashboard.withPanels( g.util.grid.wrapPanels( - csplib.grafana.rows.aep_storage + - csplib.grafana.rows.aep_resources + csplib.grafana.rows.glb_requests ) ), + } else {} + + + if csplib.config.uid == 'azure' then + { + [csplib.config.uid + '-elasticpool.json']: + local variables = csplib.signals.azureelasticpool.getVariablesMultiChoice(); + g.dashboard.new(csplib.config.dashboardNamePrefix + 'Elastic pool') + + g.dashboard.withUid(csplib.config.uid + '-elasticpool') + + g.dashboard.withTags(csplib.config.dashboardTags) + + g.dashboard.withTimezone(csplib.config.dashboardTimezone) + + g.dashboard.withRefresh(csplib.config.dashboardRefresh) + + g.dashboard.timepicker.withTimeOptions(csplib.config.dashboardPeriod) + + g.dashboard.withVariables(variables) + + g.dashboard.withPanels( + g.util.grid.wrapPanels( + csplib.grafana.rows.aep_storage + + csplib.grafana.rows.aep_resources + ) + ), - [csplib.config.uid + '-sqldb.json']: - local variables = csplib.signals.azuresqldb.getVariablesMultiChoice(); - g.dashboard.new(csplib.config.dashboardNamePrefix + 'SQL database') - + g.dashboard.withUid(csplib.config.uid + '-sqldb') - + g.dashboard.withTags(csplib.config.dashboardTags) - + g.dashboard.withTimezone(csplib.config.dashboardTimezone) - + g.dashboard.withRefresh(csplib.config.dashboardRefresh) - + g.dashboard.timepicker.withTimeOptions(csplib.config.dashboardPeriod) - + g.dashboard.withVariables(variables) - + g.dashboard.withPanels( - g.util.grid.wrapPanels( - csplib.grafana.rows.asql_connections + - csplib.grafana.rows.asql_resources - ) - ), - } else {}, + [csplib.config.uid + '-sqldb.json']: + local variables = csplib.signals.azuresqldb.getVariablesMultiChoice(); + g.dashboard.new(csplib.config.dashboardNamePrefix + 'SQL database') + + g.dashboard.withUid(csplib.config.uid + '-sqldb') + + g.dashboard.withTags(csplib.config.dashboardTags) + + g.dashboard.withTimezone(csplib.config.dashboardTimezone) + + g.dashboard.withRefresh(csplib.config.dashboardRefresh) + + g.dashboard.timepicker.withTimeOptions(csplib.config.dashboardPeriod) + + g.dashboard.withVariables(variables) + + g.dashboard.withPanels( + g.util.grid.wrapPanels( + csplib.grafana.rows.asql_connections + + csplib.grafana.rows.asql_resources + ) + ), + } else {}, } diff --git a/csp-mixin/gcpconfig.libsonnet b/csp-mixin/gcpconfig.libsonnet index d204ca974..21ff7dee6 100644 --- a/csp-mixin/gcpconfig.libsonnet +++ b/csp-mixin/gcpconfig.libsonnet @@ -7,6 +7,11 @@ blobStorage+: { bucketLabel: 'bucket_name', }, + loadBalancer+: { + backendLabel: 'backend_target_name', + countryLabel: 'client_country', + }, + // UID Prefix for each dashboard uid: 'gcp', filteringSelector: 'job="integrations/gcp"', diff --git a/csp-mixin/panels.libsonnet b/csp-mixin/panels.libsonnet index 110e9edab..88d063f48 100644 --- a/csp-mixin/panels.libsonnet +++ b/csp-mixin/panels.libsonnet @@ -386,18 +386,26 @@ local commonlib = import 'common-lib/common/main.libsonnet'; glb_reqsec: this.signals.loadbalancer.requestsByStatus.asTimeSeries() - + commonlib.panels.generic.timeSeries.base.stylize(), + + commonlib.panels.generic.timeSeries.base.stylize() + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), glb_reqcountry: this.signals.loadbalancer.requestsByCountry.asTimeSeries() - + commonlib.panels.generic.timeSeries.base.stylize(), + + commonlib.panels.generic.timeSeries.base.stylize() + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), glb_reqcache: this.signals.loadbalancer.requestsByCache.asTimeSeries() - + commonlib.panels.generic.timeSeries.base.stylize(), + + commonlib.panels.generic.timeSeries.base.stylize() + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), glb_reqprotocol: this.signals.loadbalancer.requestsByProtocol.asTimeSeries() - + commonlib.panels.generic.timeSeries.base.stylize(), + + commonlib.panels.generic.timeSeries.base.stylize() + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), }, } diff --git a/csp-mixin/signals/loadbalancer.libsonnet b/csp-mixin/signals/loadbalancer.libsonnet index 076801623..857507ee6 100644 --- a/csp-mixin/signals/loadbalancer.libsonnet +++ b/csp-mixin/signals/loadbalancer.libsonnet @@ -3,8 +3,8 @@ function(this) { local s = self, filteringSelector: this.filteringSelector, - groupLabels: this.groupLabels, - instanceLabels: this.instanceLabels, + groupLabels: ['job', 'project_id', 'client_country'], + instanceLabels: ['backend_target_name'], aggLevel: 'instance', discoveryMetric: { stackdriver: 'stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count', From 9b79cd7cc9b74399c48a8b9ca7907af03cb05fdc Mon Sep 17 00:00:00 2001 From: yduartep Date: Sun, 1 Sep 2024 20:44:16 +0200 Subject: [PATCH 05/13] add latency row to loadbalancer dashboard --- csp-mixin/dashboards.libsonnet | 1 + csp-mixin/panels.libsonnet | 185 +++++++++++++++++++++++ csp-mixin/rows.libsonnet | 15 ++ csp-mixin/signals/loadbalancer.libsonnet | 120 +++++++++++++++ 4 files changed, 321 insertions(+) diff --git a/csp-mixin/dashboards.libsonnet b/csp-mixin/dashboards.libsonnet index c8f8e3097..8e53ec494 100644 --- a/csp-mixin/dashboards.libsonnet +++ b/csp-mixin/dashboards.libsonnet @@ -48,6 +48,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.dashboard.withPanels( g.util.grid.wrapPanels( csplib.grafana.rows.glb_requests + + csplib.grafana.rows.glb_latency ) ), } else {} diff --git a/csp-mixin/panels.libsonnet b/csp-mixin/panels.libsonnet index 88d063f48..abfa88112 100644 --- a/csp-mixin/panels.libsonnet +++ b/csp-mixin/panels.libsonnet @@ -407,5 +407,190 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), + + glb_reslatency: + this.signals.loadbalancer.totalResponseLatency50.asTimeSeries() + + commonlib.panels.generic.timeSeries.base.stylize() + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.standardOptions.withOverrides([]) + + this.signals.loadbalancer.totalResponseLatency90.asPanelMixin() + + g.panel.timeSeries.standardOptions.withOverrides([]) + + this.signals.loadbalancer.totalResponseLatency99.asPanelMixin() + + g.panel.timeSeries.standardOptions.withOverrides([]) + + this.signals.loadbalancer.totalResponseLatencyAverage.asPanelMixin() + + g.panel.timeSeries.standardOptions.withOverrides([ + { + matcher: { + id: 'byName', + options: 'p50', + }, + properties: [ + { + id: 'color', + value: { + mode: 'fixed', + fixedColor: 'green', + }, + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'p90', + }, + properties: [ + { + id: 'color', + value: { + mode: 'fixed', + fixedColor: 'orange', + }, + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'p99', + }, + properties: [ + { + id: 'color', + value: { + mode: 'fixed', + fixedColor: 'red', + }, + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'Average', + }, + properties: [ + { + id: 'color', + value: { + mode: 'fixed', + fixedColor: 'blue', + }, + }, + ], + }, + ]), + + glb_frontendlatency: + this.signals.loadbalancer.frontendLatency50.asTimeSeries() + + commonlib.panels.generic.timeSeries.base.stylize() + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.standardOptions.withOverrides([]) + + this.signals.loadbalancer.frontendLatency90.asPanelMixin() + + g.panel.timeSeries.standardOptions.withOverrides([]) + + this.signals.loadbalancer.frontendLatency99.asPanelMixin() + + g.panel.timeSeries.standardOptions.withOverrides([ + { + matcher: { + id: 'byName', + options: 'p50', + }, + properties: [ + { + id: 'color', + value: { + mode: 'fixed', + fixedColor: 'green', + }, + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'p90', + }, + properties: [ + { + id: 'color', + value: { + mode: 'fixed', + fixedColor: 'orange', + }, + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'p99', + }, + properties: [ + { + id: 'color', + value: { + mode: 'fixed', + fixedColor: 'red', + }, + }, + ], + }, + ]), + + glb_backendlatency: + this.signals.loadbalancer.backendLatency50.asTimeSeries() + + commonlib.panels.generic.timeSeries.base.stylize() + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.standardOptions.withOverrides([]) + + this.signals.loadbalancer.backendLatency90.asPanelMixin() + + g.panel.timeSeries.standardOptions.withOverrides([]) + + this.signals.loadbalancer.backendLatency99.asPanelMixin() + + g.panel.timeSeries.standardOptions.withOverrides([ + { + matcher: { + id: 'byName', + options: 'p50', + }, + properties: [ + { + id: 'color', + value: { + mode: 'fixed', + fixedColor: 'green', + }, + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'p90', + }, + properties: [ + { + id: 'color', + value: { + mode: 'fixed', + fixedColor: 'orange', + }, + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'p99', + }, + properties: [ + { + id: 'color', + value: { + mode: 'fixed', + fixedColor: 'red', + }, + }, + ], + }, + ]), }, } diff --git a/csp-mixin/rows.libsonnet b/csp-mixin/rows.libsonnet index f367f88a2..cb7f6f8af 100644 --- a/csp-mixin/rows.libsonnet +++ b/csp-mixin/rows.libsonnet @@ -135,5 +135,20 @@ local g = import './g.libsonnet'; + g.panel.timeSeries.gridPos.withW(12) + g.panel.timeSeries.gridPos.withH(8), ], + + glb_latency: [ + g.panel.row.new('Latency'), + this.grafana.panels.glb_reslatency + + g.panel.timeSeries.gridPos.withW(24) + + g.panel.timeSeries.gridPos.withH(9), + + this.grafana.panels.glb_frontendlatency + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.glb_backendlatency + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + ], }, } diff --git a/csp-mixin/signals/loadbalancer.libsonnet b/csp-mixin/signals/loadbalancer.libsonnet index 857507ee6..e216e3796 100644 --- a/csp-mixin/signals/loadbalancer.libsonnet +++ b/csp-mixin/signals/loadbalancer.libsonnet @@ -57,5 +57,125 @@ function(this) }, }, }, + + totalResponseLatency50: { + name: 'Total Response Latency', + description: 'The total latency of responses', + type: 'raw', + sources: { + stackdriver: { + expr: 'histogram_quantile(0.50, sum by(le) (stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_total_latencies_bucket{%(queriesSelector)s}))', + legendCustomTemplate: 'p50', + }, + }, + }, + + totalResponseLatency90: { + name: 'Latency 90', + description: 'The total latency of responses', + type: 'raw', + sources: { + stackdriver: { + expr: 'histogram_quantile(0.90, sum by(le) (stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_total_latencies_bucket{%(queriesSelector)s}))', + legendCustomTemplate: 'p90', + }, + }, + }, + + totalResponseLatency99: { + name: 'Latency 99', + description: 'The total latency of responses', + type: 'raw', + sources: { + stackdriver: { + expr: 'histogram_quantile(0.99, sum by(le) (stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_total_latencies_bucket{%(queriesSelector)s}))', + legendCustomTemplate: 'p99', + }, + }, + }, + + totalResponseLatencyAverage: { + name: 'Latency Average', + description: 'The total latency of responses', + type: 'raw', + sources: { + stackdriver: { + expr: 'sum(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_total_latencies_sum{%(queriesSelector)s}) / sum(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_total_latencies_count{%(queriesSelector)s})', + legendCustomTemplate: 'Average', + }, + }, + }, + + frontendLatency50: { + name: 'Frontend RTT Latency', + description: 'The latency of frontend RTT.', + type: 'raw', + sources: { + stackdriver: { + expr: 'histogram_quantile(0.50,sum by (le) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_frontend_tcp_rtt_bucket{%(queriesSelector)s}[$__rate_interval])))', + legendCustomTemplate: 'p50', + }, + }, + }, + + frontendLatency90: { + name: 'Frontend RTT Latency 90', + description: 'The latency of frontend RTT.', + type: 'raw', + sources: { + stackdriver: { + expr: 'histogram_quantile(0.90,sum by (le) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_frontend_tcp_rtt_bucket{%(queriesSelector)s}[$__rate_interval])))', + legendCustomTemplate: 'p90', + }, + }, + }, + + frontendLatency99: { + name: 'Frontend RTT Latency 99', + description: 'The latency of frontend RTT.', + type: 'raw', + sources: { + stackdriver: { + expr: 'histogram_quantile(0.99,sum by (le) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_frontend_tcp_rtt_bucket{%(queriesSelector)s}[$__rate_interval])))', + legendCustomTemplate: 'p99', + }, + }, + }, + + backendLatency50: { + name: 'Backend Response Latency', + description: 'The backend latency of responses.', + type: 'raw', + sources: { + stackdriver: { + expr: 'histogram_quantile(0.50, sum by (le) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_latencies_bucket{%(queriesSelector)s}[$__rate_interval])))', + legendCustomTemplate: 'p50', + }, + }, + }, + + backendLatency90: { + name: 'Backend Response Latency 90', + description: 'The backend latency of responses.', + type: 'raw', + sources: { + stackdriver: { + expr: 'histogram_quantile(0.90, sum by (le) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_latencies_bucket{%(queriesSelector)s}[$__rate_interval])))', + legendCustomTemplate: 'p90', + }, + }, + }, + + backendLatency99: { + name: 'Backend Response Latency 99', + description: 'The backend latency of responses.', + type: 'raw', + sources: { + stackdriver: { + expr: 'histogram_quantile(0.99, sum by (le) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_latencies_bucket{%(queriesSelector)s}[$__rate_interval])))', + legendCustomTemplate: 'p99', + }, + }, + }, }, } From 1b4ed1d99a575db012342e0ab89183f14431a626 Mon Sep 17 00:00:00 2001 From: yduartep Date: Sun, 1 Sep 2024 21:09:58 +0200 Subject: [PATCH 06/13] add traffic metricss row to loadbalancer dashboard --- csp-mixin/dashboards.libsonnet | 1 + csp-mixin/panels.libsonnet | 88 ++++++++++++++++++++++++ csp-mixin/rows.libsonnet | 11 +++ csp-mixin/signals/loadbalancer.libsonnet | 48 +++++++++++++ 4 files changed, 148 insertions(+) diff --git a/csp-mixin/dashboards.libsonnet b/csp-mixin/dashboards.libsonnet index 8e53ec494..d65dfd1e7 100644 --- a/csp-mixin/dashboards.libsonnet +++ b/csp-mixin/dashboards.libsonnet @@ -49,6 +49,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.util.grid.wrapPanels( csplib.grafana.rows.glb_requests + csplib.grafana.rows.glb_latency + + csplib.grafana.rows.glb_traffic_metrics ) ), } else {} diff --git a/csp-mixin/panels.libsonnet b/csp-mixin/panels.libsonnet index abfa88112..e57725672 100644 --- a/csp-mixin/panels.libsonnet +++ b/csp-mixin/panels.libsonnet @@ -592,5 +592,93 @@ local commonlib = import 'common-lib/common/main.libsonnet'; ], }, ]), + + glb_req_bytes_count: + this.signals.loadbalancer.totalReqSent.asTimeSeries() + + commonlib.panels.generic.timeSeries.base.stylize() + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withAxisLabel('out(-) | in(+)') + + g.panel.timeSeries.standardOptions.withOverrides([]) + + this.signals.loadbalancer.totalReqReceived.asPanelMixin() + + g.panel.timeSeries.standardOptions.withOverrides([ + { + matcher: { + id: 'byName', + options: 'Sent', + }, + properties: [ + { + id: 'color', + value: { + mode: 'fixed', + fixedColor: 'blue', + }, + }, + { + id: 'custom.transform', + value: 'negative-Y', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'Received', + }, + properties: [ + { + id: 'color', + value: { + mode: 'fixed', + fixedColor: 'green', + }, + }, + ], + }, + ]), + + glb_backend_req_bytes_count: + this.signals.loadbalancer.backendTotalReqSent.asTimeSeries() + + commonlib.panels.generic.timeSeries.base.stylize() + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withAxisLabel('out(-) | in(+)') + + g.panel.timeSeries.standardOptions.withOverrides([]) + + this.signals.loadbalancer.backendTotalReqReceived.asPanelMixin() + + g.panel.timeSeries.standardOptions.withOverrides([ + { + matcher: { + id: 'byName', + options: 'Sent', + }, + properties: [ + { + id: 'color', + value: { + mode: 'fixed', + fixedColor: 'blue', + }, + }, + { + id: 'custom.transform', + value: 'negative-Y', + }, + ], + }, + { + matcher: { + id: 'byName', + options: 'Received', + }, + properties: [ + { + id: 'color', + value: { + mode: 'fixed', + fixedColor: 'green', + }, + }, + ], + }, + ]), }, } diff --git a/csp-mixin/rows.libsonnet b/csp-mixin/rows.libsonnet index cb7f6f8af..156c0e9aa 100644 --- a/csp-mixin/rows.libsonnet +++ b/csp-mixin/rows.libsonnet @@ -150,5 +150,16 @@ local g = import './g.libsonnet'; + g.panel.timeSeries.gridPos.withW(12) + g.panel.timeSeries.gridPos.withH(8), ], + + glb_traffic_metrics: [ + g.panel.row.new('Traffic Metrics'), + this.grafana.panels.glb_req_bytes_count + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.glb_backend_req_bytes_count + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + ], }, } diff --git a/csp-mixin/signals/loadbalancer.libsonnet b/csp-mixin/signals/loadbalancer.libsonnet index e216e3796..b230da928 100644 --- a/csp-mixin/signals/loadbalancer.libsonnet +++ b/csp-mixin/signals/loadbalancer.libsonnet @@ -177,5 +177,53 @@ function(this) }, }, }, + + totalReqSent: { + name: 'Total Requests sent/received', + description: 'Number of bytes sent from/received by the load balancer.', + type: 'raw', + sources: { + stackdriver: { + expr: 'sum(rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_bytes_count{%(queriesSelector)s}[$__rate_interval]))', + legendCustomTemplate: 'Sent', + }, + }, + }, + + totalReqReceived: { + name: 'Total Requests received', + description: 'Number of bytes sent from/received by the load balancer.', + type: 'raw', + sources: { + stackdriver: { + expr: 'sum(rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_response_bytes_count{%(queriesSelector)s}[$__rate_interval]))', + legendCustomTemplate: 'Received', + }, + }, + }, + + backendTotalReqSent: { + name: 'Backend Total Requests sent/received', + description: 'The number of bytes per second in requests sent from the load balancer to backends and in responses received from the load balancer to the backends.', + type: 'raw', + sources: { + stackdriver: { + expr: 'sum(rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_request_bytes_count{%(queriesSelector)s}[$__rate_interval]))', + legendCustomTemplate: 'Sent', + }, + }, + }, + + backendTotalReqReceived: { + name: 'Backend Total Requests received', + description: 'The number of bytes per second in requests sent from the load balancer to backends and in responses received from the load balancer to the backends.', + type: 'raw', + sources: { + stackdriver: { + expr: 'sum(rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_response_bytes_count{%(queriesSelector)s}[$__rate_interval]))', + legendCustomTemplate: 'Received', + }, + }, + }, }, } From 780e6cdd6f43fa2182f34117c5bdf696a3e514d7 Mon Sep 17 00:00:00 2001 From: yduartep Date: Mon, 2 Sep 2024 11:02:28 +0200 Subject: [PATCH 07/13] fix queries with different filters --- csp-mixin/panels.libsonnet | 21 +++++++++++++++++++++ csp-mixin/rows.libsonnet | 4 ++++ csp-mixin/signals/loadbalancer.libsonnet | 16 ++++++++++++++-- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/csp-mixin/panels.libsonnet b/csp-mixin/panels.libsonnet index e57725672..d36e7f90b 100644 --- a/csp-mixin/panels.libsonnet +++ b/csp-mixin/panels.libsonnet @@ -408,6 +408,27 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), + glb_errorrate: + this.signals.loadbalancer.errorRate.asTimeSeries() + + commonlib.panels.generic.timeSeries.base.stylize() + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') + + g.panel.timeSeries.standardOptions.withUnit('percentunit') + + g.panel.timeSeries.standardOptions.withOverrides([ + { + matcher: { + id: 'byName', + options: 'Error Rate visualization', + }, + properties: [ + { + id: 'noValue', + value: '0', + }, + ], + }, + ]), + glb_reslatency: this.signals.loadbalancer.totalResponseLatency50.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() diff --git a/csp-mixin/rows.libsonnet b/csp-mixin/rows.libsonnet index 156c0e9aa..1d4741038 100644 --- a/csp-mixin/rows.libsonnet +++ b/csp-mixin/rows.libsonnet @@ -134,6 +134,10 @@ local g = import './g.libsonnet'; this.grafana.panels.glb_reqprotocol + g.panel.timeSeries.gridPos.withW(12) + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.glb_errorrate + + g.panel.timeSeries.gridPos.withW(24) + + g.panel.timeSeries.gridPos.withH(9), ], glb_latency: [ diff --git a/csp-mixin/signals/loadbalancer.libsonnet b/csp-mixin/signals/loadbalancer.libsonnet index b230da928..0bcf3c011 100644 --- a/csp-mixin/signals/loadbalancer.libsonnet +++ b/csp-mixin/signals/loadbalancer.libsonnet @@ -58,6 +58,18 @@ function(this) }, }, + errorRate: { + name: 'Error rate visualization', + description: 'Error rate visualization', + type: 'raw', + sources: { + stackdriver: { + expr: 'sum(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{job="integrations/gcp",job=~"$job",project_id=~"$project_id",client_country=~"$client_country",backend_target_name=~"$backend_target_name", response_code_class!="200", response_code_class!="0"}) / sum(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{%(queriesSelector)s})', + legendCustomTemplate: 'Error Rate visualization', + }, + }, + }, + totalResponseLatency50: { name: 'Total Response Latency', description: 'The total latency of responses', @@ -208,7 +220,7 @@ function(this) type: 'raw', sources: { stackdriver: { - expr: 'sum(rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_request_bytes_count{%(queriesSelector)s}[$__rate_interval]))', + expr: 'sum(rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_request_bytes_count{job="integrations/gcp",job=~"$job",project_id=~"$project_id",backend_target_name=~"$backend_target_name"}[$__rate_interval]))', legendCustomTemplate: 'Sent', }, }, @@ -220,7 +232,7 @@ function(this) type: 'raw', sources: { stackdriver: { - expr: 'sum(rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_response_bytes_count{%(queriesSelector)s}[$__rate_interval]))', + expr: 'sum(rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_response_bytes_count{job="integrations/gcp",job=~"$job",project_id=~"$project_id",backend_target_name=~"$backend_target_name"}[$__rate_interval]))', legendCustomTemplate: 'Received', }, }, From 735aee5268d50621af4eca7a666e7a961e6ded41 Mon Sep 17 00:00:00 2001 From: yduartep Date: Thu, 5 Sep 2024 13:52:15 +0200 Subject: [PATCH 08/13] add azure load balancer dashboard --- csp-mixin/config.libsonnet | 3 +- csp-mixin/dashboards.libsonnet | 23 ++- csp-mixin/gcpconfig.libsonnet | 2 +- csp-mixin/main.libsonnet | 3 +- csp-mixin/panels.libsonnet | 120 ++++++++++++--- csp-mixin/rows.libsonnet | 51 ++++++ csp-mixin/signals/azureloadbalancer.libsonnet | 145 ++++++++++++++++++ ...er.libsonnet => gcploadbalancer.libsonnet} | 0 8 files changed, 322 insertions(+), 25 deletions(-) create mode 100644 csp-mixin/signals/azureloadbalancer.libsonnet rename csp-mixin/signals/{loadbalancer.libsonnet => gcploadbalancer.libsonnet} (100%) diff --git a/csp-mixin/config.libsonnet b/csp-mixin/config.libsonnet index 4564a20ec..a29842925 100644 --- a/csp-mixin/config.libsonnet +++ b/csp-mixin/config.libsonnet @@ -9,7 +9,8 @@ blobstore: (import './signals/blobstore.libsonnet')(this), azureelasticpool: (import './signals/azureelasticpool.libsonnet')(this), azuresqldb: (import './signals/azuresqldb.libsonnet')(this), - loadbalancer: (import './signals/loadbalancer.libsonnet')(this), + gcploadbalancer: (import './signals/gcploadbalancer.libsonnet')(this), + azureloadbalancer: (import './signals/azureloadbalancer.libsonnet')(this), }, blobStorage: { enableAvailability: false, diff --git a/csp-mixin/dashboards.libsonnet b/csp-mixin/dashboards.libsonnet index d65dfd1e7..17957c136 100644 --- a/csp-mixin/dashboards.libsonnet +++ b/csp-mixin/dashboards.libsonnet @@ -30,7 +30,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; if csplib.config.uid == 'gcp' then { [csplib.config.uid + '-loadbalancer.json']: - local variables = csplib.signals.loadbalancer.getVariablesMultiChoice(); + local variables = csplib.signals.gcploadbalancer.getVariablesMultiChoice(); g.dashboard.new(csplib.config.dashboardNamePrefix + 'Load Balancing') + g.dashboard.withUid(csplib.config.uid + '-loadbalancer') + g.dashboard.withTags(csplib.config.dashboardTags) @@ -38,9 +38,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.dashboard.withRefresh(csplib.config.dashboardRefresh) + g.dashboard.timepicker.withTimeOptions(csplib.config.dashboardPeriod) + g.dashboard.withVariables([ - if std.asciiLower(v.label) == std.asciiLower(csplib.config.loadBalancer.backendLabel) + if std.asciiLower(v.label) == std.asciiLower(csplib.config.gcploadBalancer.backendLabel) then v { label: 'Backend Target' } - else if std.asciiLower(v.label) == std.asciiLower(csplib.config.loadBalancer.countryLabel) + else if std.asciiLower(v.label) == std.asciiLower(csplib.config.gcploadBalancer.countryLabel) then v { label: 'Country' } else v for v in variables @@ -87,5 +87,22 @@ local commonlib = import 'common-lib/common/main.libsonnet'; csplib.grafana.rows.asql_resources ) ), + + [csplib.config.uid + '-loadbalancer.json']: + local variables = csplib.signals.azureloadbalancer.getVariablesMultiChoice(); + g.dashboard.new(csplib.config.dashboardNamePrefix + 'Load Balancing') + + g.dashboard.withUid(csplib.config.uid + '-loadbalancer') + + g.dashboard.withTags(csplib.config.dashboardTags) + + g.dashboard.withTimezone(csplib.config.dashboardTimezone) + + g.dashboard.withRefresh(csplib.config.dashboardRefresh) + + g.dashboard.timepicker.withTimeOptions(csplib.config.dashboardPeriod) + + g.dashboard.withVariables(variables) + + g.dashboard.withPanels( + g.util.grid.wrapPanels( + csplib.grafana.rows.alb_summary + + csplib.grafana.rows.alb_details + + csplib.grafana.rows.alb_loadbalancers + ) + ), } else {}, } diff --git a/csp-mixin/gcpconfig.libsonnet b/csp-mixin/gcpconfig.libsonnet index 21ff7dee6..63a51f4cb 100644 --- a/csp-mixin/gcpconfig.libsonnet +++ b/csp-mixin/gcpconfig.libsonnet @@ -7,7 +7,7 @@ blobStorage+: { bucketLabel: 'bucket_name', }, - loadBalancer+: { + gcploadBalancer+: { backendLabel: 'backend_target_name', countryLabel: 'client_country', }, diff --git a/csp-mixin/main.libsonnet b/csp-mixin/main.libsonnet index 38e2d634c..5ee993684 100644 --- a/csp-mixin/main.libsonnet +++ b/csp-mixin/main.libsonnet @@ -9,7 +9,8 @@ local commonlib = import 'common-lib/common/main.libsonnet'; blobstore: commonlib.signals.unmarshallJsonMulti(this.config.signals.blobstore, type=this.config.metricsSource), azureelasticpool: commonlib.signals.unmarshallJsonMulti(this.config.signals.azureelasticpool, type=this.config.metricsSource), azuresqldb: commonlib.signals.unmarshallJsonMulti(this.config.signals.azuresqldb, type=this.config.metricsSource), - loadbalancer: commonlib.signals.unmarshallJsonMulti(this.config.signals.loadbalancer, type=this.config.metricsSource), + gcploadbalancer: commonlib.signals.unmarshallJsonMulti(this.config.signals.gcploadbalancer, type=this.config.metricsSource), + azureloadbalancer: commonlib.signals.unmarshallJsonMulti(this.config.signals.azureloadbalancer, type=this.config.metricsSource), }, grafana: { panels: (import './panels.libsonnet').new(this), diff --git a/csp-mixin/panels.libsonnet b/csp-mixin/panels.libsonnet index d36e7f90b..279d64ef5 100644 --- a/csp-mixin/panels.libsonnet +++ b/csp-mixin/panels.libsonnet @@ -384,32 +384,33 @@ local commonlib = import 'common-lib/common/main.libsonnet'; 'DTU utilization and limits by database' ) + self._asql_tableCommon(), + // GCP Load Balancer glb_reqsec: - this.signals.loadbalancer.requestsByStatus.asTimeSeries() + this.signals.gcploadbalancer.requestsByStatus.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), glb_reqcountry: - this.signals.loadbalancer.requestsByCountry.asTimeSeries() + this.signals.gcploadbalancer.requestsByCountry.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), glb_reqcache: - this.signals.loadbalancer.requestsByCache.asTimeSeries() + this.signals.gcploadbalancer.requestsByCache.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), glb_reqprotocol: - this.signals.loadbalancer.requestsByProtocol.asTimeSeries() + this.signals.gcploadbalancer.requestsByProtocol.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), glb_errorrate: - this.signals.loadbalancer.errorRate.asTimeSeries() + this.signals.gcploadbalancer.errorRate.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') @@ -430,15 +431,15 @@ local commonlib = import 'common-lib/common/main.libsonnet'; ]), glb_reslatency: - this.signals.loadbalancer.totalResponseLatency50.asTimeSeries() + this.signals.gcploadbalancer.totalResponseLatency50.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.standardOptions.withOverrides([]) - + this.signals.loadbalancer.totalResponseLatency90.asPanelMixin() + + this.signals.gcploadbalancer.totalResponseLatency90.asPanelMixin() + g.panel.timeSeries.standardOptions.withOverrides([]) - + this.signals.loadbalancer.totalResponseLatency99.asPanelMixin() + + this.signals.gcploadbalancer.totalResponseLatency99.asPanelMixin() + g.panel.timeSeries.standardOptions.withOverrides([]) - + this.signals.loadbalancer.totalResponseLatencyAverage.asPanelMixin() + + this.signals.gcploadbalancer.totalResponseLatencyAverage.asPanelMixin() + g.panel.timeSeries.standardOptions.withOverrides([ { matcher: { @@ -503,13 +504,13 @@ local commonlib = import 'common-lib/common/main.libsonnet'; ]), glb_frontendlatency: - this.signals.loadbalancer.frontendLatency50.asTimeSeries() + this.signals.gcploadbalancer.frontendLatency50.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.standardOptions.withOverrides([]) - + this.signals.loadbalancer.frontendLatency90.asPanelMixin() + + this.signals.gcploadbalancer.frontendLatency90.asPanelMixin() + g.panel.timeSeries.standardOptions.withOverrides([]) - + this.signals.loadbalancer.frontendLatency99.asPanelMixin() + + this.signals.gcploadbalancer.frontendLatency99.asPanelMixin() + g.panel.timeSeries.standardOptions.withOverrides([ { matcher: { @@ -559,13 +560,13 @@ local commonlib = import 'common-lib/common/main.libsonnet'; ]), glb_backendlatency: - this.signals.loadbalancer.backendLatency50.asTimeSeries() + this.signals.gcploadbalancer.backendLatency50.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.standardOptions.withOverrides([]) - + this.signals.loadbalancer.backendLatency90.asPanelMixin() + + this.signals.gcploadbalancer.backendLatency90.asPanelMixin() + g.panel.timeSeries.standardOptions.withOverrides([]) - + this.signals.loadbalancer.backendLatency99.asPanelMixin() + + this.signals.gcploadbalancer.backendLatency99.asPanelMixin() + g.panel.timeSeries.standardOptions.withOverrides([ { matcher: { @@ -615,12 +616,12 @@ local commonlib = import 'common-lib/common/main.libsonnet'; ]), glb_req_bytes_count: - this.signals.loadbalancer.totalReqSent.asTimeSeries() + this.signals.gcploadbalancer.totalReqSent.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withAxisLabel('out(-) | in(+)') + g.panel.timeSeries.standardOptions.withOverrides([]) - + this.signals.loadbalancer.totalReqReceived.asPanelMixin() + + this.signals.gcploadbalancer.totalReqReceived.asPanelMixin() + g.panel.timeSeries.standardOptions.withOverrides([ { matcher: { @@ -659,12 +660,12 @@ local commonlib = import 'common-lib/common/main.libsonnet'; ]), glb_backend_req_bytes_count: - this.signals.loadbalancer.backendTotalReqSent.asTimeSeries() + this.signals.gcploadbalancer.backendTotalReqSent.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withAxisLabel('out(-) | in(+)') + g.panel.timeSeries.standardOptions.withOverrides([]) - + this.signals.loadbalancer.backendTotalReqReceived.asPanelMixin() + + this.signals.gcploadbalancer.backendTotalReqReceived.asPanelMixin() + g.panel.timeSeries.standardOptions.withOverrides([ { matcher: { @@ -701,5 +702,86 @@ local commonlib = import 'common-lib/common/main.libsonnet'; ], }, ]), + + // Azure Load Balancer + + alb_sync_packets: + this.signals.azureloadbalancer.summarySyncPackets.asStat() + + commonlib.panels.generic.stat.base.stylize() + + g.panel.stat.options.withColorMode('background_solid') + + g.panel.stat.standardOptions.color.withMode('thresholds') + + g.panel.stat.standardOptions.withUnit('short'), + + alb_total_packets: + this.signals.azureloadbalancer.summaryTotalPackets.asStat() + + commonlib.panels.generic.stat.base.stylize() + + g.panel.stat.options.withColorMode('background_solid') + + g.panel.stat.standardOptions.color.withMode('thresholds') + + g.panel.stat.standardOptions.withUnit('short'), + + alb_total_bytes: + this.signals.azureloadbalancer.summaryTotalBytes.asStat() + + commonlib.panels.generic.stat.base.stylize() + + g.panel.stat.options.withColorMode('background_solid') + + g.panel.stat.standardOptions.color.withMode('thresholds') + + g.panel.stat.standardOptions.withUnit('decbytes') + + g.panel.stat.standardOptions.withOverrides([]), + + alb_snat_connections: + this.signals.azureloadbalancer.summarySnatConn.asStat() + + commonlib.panels.generic.stat.base.stylize() + + g.panel.stat.options.withColorMode('background_solid') + + g.panel.stat.standardOptions.color.withMode('thresholds') + + g.panel.stat.standardOptions.withUnit('short'), + + alb_details_sync_packets: + this.signals.azureloadbalancer.detailsSyncPackets.asTimeSeries() + + commonlib.panels.generic.timeSeries.base.stylize() + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), + + alb_details_total_packets: + this.signals.azureloadbalancer.detailsTotalPackets.asTimeSeries() + + commonlib.panels.generic.timeSeries.base.stylize() + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), + + alb_details_total_bytes: + this.signals.azureloadbalancer.detailsTotalBytes.asTimeSeries() + + commonlib.panels.generic.timeSeries.base.stylize() + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), + + alb_details_snat_connections: + this.signals.azureloadbalancer.detailsSnatConn.asTimeSeries() + + commonlib.panels.generic.timeSeries.base.stylize() + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), + + alb_snatports: + this.signals.azureloadbalancer.snatPorts.asTimeSeries() + + commonlib.panels.generic.timeSeries.base.stylize() + + this.signals.azureloadbalancer.allocatedSnatPorts.asPanelMixin() + + g.panel.timeSeries.options.tooltip.withMode('multi'), + + alb_used_snatports: + this.signals.azureloadbalancer.usedSnatPorts.asGauge() + + this.signals.azureloadbalancer.allocatedSnatPorts.asPanelMixin() + + g.panel.gauge.standardOptions.color.withMode('thresholds') + + g.panel.gauge.standardOptions.withOverrides([]) + + g.panel.gauge.queryOptions.withTransformations([ + { + id: 'configFromData', + options: { + configRefId: 'Allocated SNAT Ports', + mappings: [ + { + fieldName: 'Allocated', + handlerKey: 'max', + }, + ], + }, + }, + ]), }, } diff --git a/csp-mixin/rows.libsonnet b/csp-mixin/rows.libsonnet index 1d4741038..63510860d 100644 --- a/csp-mixin/rows.libsonnet +++ b/csp-mixin/rows.libsonnet @@ -117,6 +117,7 @@ local g = import './g.libsonnet'; + g.panel.timeSeries.gridPos.withH(8), ], + // GCP Load Balancer glb_requests: [ g.panel.row.new('Load Balancer Requests'), this.grafana.panels.glb_reqsec @@ -165,5 +166,55 @@ local g = import './g.libsonnet'; + g.panel.timeSeries.gridPos.withW(12) + g.panel.timeSeries.gridPos.withH(8), ], + + // Azure Load balancer + + alb_summary: [ + g.panel.row.new('Summary'), + this.grafana.panels.alb_sync_packets + + g.panel.timeSeries.gridPos.withW(6) + + g.panel.timeSeries.gridPos.withH(2), + + this.grafana.panels.alb_total_packets + + g.panel.timeSeries.gridPos.withW(6) + + g.panel.timeSeries.gridPos.withH(2), + + this.grafana.panels.alb_total_bytes + + g.panel.timeSeries.gridPos.withW(6) + + g.panel.timeSeries.gridPos.withH(2), + + this.grafana.panels.alb_snat_connections + + g.panel.timeSeries.gridPos.withW(6) + + g.panel.timeSeries.gridPos.withH(2), + ], + alb_details: [ + g.panel.row.new('Details'), + this.grafana.panels.alb_details_sync_packets + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.alb_details_total_packets + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.alb_details_total_bytes + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.alb_details_snat_connections + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + ], + + alb_loadbalancers: [ + g.panel.row.new('Load Balancers'), + this.grafana.panels.alb_snatports + + g.panel.timeSeries.gridPos.withW(12) + + g.panel.timeSeries.gridPos.withH(8), + + this.grafana.panels.alb_used_snatports + + g.panel.gauge.gridPos.withW(12) + + g.panel.gauge.gridPos.withH(8), + ], }, } diff --git a/csp-mixin/signals/azureloadbalancer.libsonnet b/csp-mixin/signals/azureloadbalancer.libsonnet new file mode 100644 index 000000000..4f4be0b07 --- /dev/null +++ b/csp-mixin/signals/azureloadbalancer.libsonnet @@ -0,0 +1,145 @@ +local commonlib = import 'common-lib/common/main.libsonnet'; +function(this) + { + local s = self, + filteringSelector: this.filteringSelector, + groupLabels: this.groupLabels, + instanceLabels: this.instanceLabels, + aggLevel: 'none', + discoveryMetric: { + azuremonitor: 'azure_microsoft_network_loadbalancers_bytecount_total_bytes', + }, + signals: { + summarySyncPackets: { + name: 'Total Sync Packets', + description: 'Total number of SYN Packets transmitted', + type: 'raw', + unit: 'short', + sources: { + azuremonitor: { + expr: 'sum(sum_over_time(azure_microsoft_network_loadbalancers_syncount_total_count[$__range]))', + legendCustomTemplate: '', + }, + }, + }, + + summaryTotalPackets: { + name: 'Total Packets', + description: 'Total number of Packets transmitted', + type: 'raw', + unit: 'short', + sources: { + azuremonitor: { + expr: 'sum(sum_over_time(azure_microsoft_network_loadbalancers_packetcount_total_count[$__range]))', + legendCustomTemplate: '', + }, + }, + }, + summaryTotalBytes: { + name: 'Total Bytes', + description: 'Total number of Bytes transmitted', + type: 'raw', + unit: 'short', + sources: { + azuremonitor: { + expr: 'sum(sum_over_time(azure_microsoft_network_loadbalancers_bytecount_total_bytes[$__range]))', + legendCustomTemplate: '', + }, + }, + }, + summarySnatConn: { + name: 'Total SNAT Connections', + description: 'Total number of new SNAT connections created', + type: 'raw', + unit: 'short', + sources: { + azuremonitor: { + expr: 'sum(sum_over_time(azure_microsoft_network_loadbalancers_snatconnectioncount_total_count[$__range]))', + legendCustomTemplate: '', + }, + }, + }, + + detailsSyncPackets: { + name: 'Total Sync Packets by Resource Group', + description: 'Total number of SYN Packets transmitted by resource group', + type: 'raw', + sources: { + azuremonitor: { + expr: 'sum by (resourceGroup) (azure_microsoft_network_loadbalancers_syncount_total_count{%(queriesSelector)s})', + legendCustomTemplate: '{{resourceGroup}}', + }, + }, + }, + + detailsTotalPackets: { + name: 'Packet Count by Resource Group', + description: 'Total number of Packets transmitted by resource group', + type: 'raw', + sources: { + azuremonitor: { + expr: 'sum by (resourceGroup) (azure_microsoft_network_loadbalancers_packetcount_total_count{%(queriesSelector)s})', + legendCustomTemplate: '{{resourceGroup}}', + }, + }, + }, + detailsTotalBytes: { + name: 'Total Bytes by Resource Group', + description: 'Total number of Bytes transmitted by resource group', + type: 'raw', + sources: { + azuremonitor: { + expr: 'sum by (resourceGroup) (azure_microsoft_network_loadbalancers_bytecount_total_bytes{%(queriesSelector)s})', + legendCustomTemplate: '{{resourceGroup}}', + }, + }, + }, + detailsSnatConn: { + name: 'SNAT Connections by Resource Group', + description: 'Total number of new SNAT connections created by resource group', + type: 'raw', + sources: { + azuremonitor: { + expr: 'sum by (resourceGroup) (azure_microsoft_network_loadbalancers_snatconnectioncount_total_count{%(queriesSelector)s})', + legendCustomTemplate: '{{resourceGroup}}', + }, + }, + }, + + snatPorts: { + name: 'SNAT Ports', + description: 'Total number of SNAT ports used and allocated', + type: 'raw', + sources: { + azuremonitor: { + expr: 'sum(azure_microsoft_network_loadbalancers_usedsnatports_average_count{%(queriesSelector)s})', + legendCustomTemplate: 'Used', + }, + }, + }, + + usedSnatPorts: { + name: 'Used SNAT Ports', + description: 'Total number of SNAT ports used', + type: 'raw', + sources: { + azuremonitor: { + expr: 'sum(azure_microsoft_network_loadbalancers_usedsnatports_average_count{%(queriesSelector)s})', + legendCustomTemplate: 'Used', + }, + }, + }, + + allocatedSnatPorts: { + name: 'Allocated SNAT Ports', + description: 'Total number of SNAT ports allocated', + type: 'raw', + sources: { + azuremonitor: { + expr: 'sum(azure_microsoft_network_loadbalancers_allocatedsnatports_average_count{%(queriesSelector)s})', + legendCustomTemplate: 'Allocated', + }, + }, + }, + }, + } diff --git a/csp-mixin/signals/loadbalancer.libsonnet b/csp-mixin/signals/gcploadbalancer.libsonnet similarity index 100% rename from csp-mixin/signals/loadbalancer.libsonnet rename to csp-mixin/signals/gcploadbalancer.libsonnet From 376b18036d4fb437b07aa76c2f34cd8811452215 Mon Sep 17 00:00:00 2001 From: yduartep Date: Thu, 5 Sep 2024 14:28:00 +0200 Subject: [PATCH 09/13] update dashboard tags for gcp and azure to match existing dashboard tags --- csp-mixin/azureconfig.libsonnet | 2 +- csp-mixin/gcpconfig.libsonnet | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/csp-mixin/azureconfig.libsonnet b/csp-mixin/azureconfig.libsonnet index 76f0d244d..1b2997034 100644 --- a/csp-mixin/azureconfig.libsonnet +++ b/csp-mixin/azureconfig.libsonnet @@ -1,7 +1,7 @@ { _config+:: { local this = self, - dashboardTags: ['azure'], + dashboardTags: ['azure-cloud-provider'], dashboardNamePrefix: 'Azure ', blobStorage+: { enableAvailability: true, diff --git a/csp-mixin/gcpconfig.libsonnet b/csp-mixin/gcpconfig.libsonnet index 63a51f4cb..fac342add 100644 --- a/csp-mixin/gcpconfig.libsonnet +++ b/csp-mixin/gcpconfig.libsonnet @@ -2,7 +2,7 @@ _config+:: { local this = self, dashboardPeriod: 'now-1h', - dashboardTags: ['gcp'], + dashboardTags: ['gcp-cloud-provider'], dashboardNamePrefix: 'GCP ', blobStorage+: { bucketLabel: 'bucket_name', From 4b00a49c8e6bf2bdb176ead0cad3435f46c71120 Mon Sep 17 00:00:00 2001 From: yduartep Date: Thu, 5 Sep 2024 18:10:09 +0200 Subject: [PATCH 10/13] update dashboard units --- csp-mixin/panels.libsonnet | 84 ++++++++++++++++----- csp-mixin/signals/gcploadbalancer.libsonnet | 24 +++--- 2 files changed, 79 insertions(+), 29 deletions(-) diff --git a/csp-mixin/panels.libsonnet b/csp-mixin/panels.libsonnet index 279d64ef5..2cd7f23f9 100644 --- a/csp-mixin/panels.libsonnet +++ b/csp-mixin/panels.libsonnet @@ -389,32 +389,45 @@ local commonlib = import 'common-lib/common/main.libsonnet'; this.signals.gcploadbalancer.requestsByStatus.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) - + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') + + g.panel.timeSeries.standardOptions.withUnit('reqps') + + g.panel.timeSeries.standardOptions.withOverrides([]) + + g.panel.timeSeries.standardOptions.withNoValue('0'), glb_reqcountry: this.signals.gcploadbalancer.requestsByCountry.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) - + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') + + g.panel.timeSeries.standardOptions.withUnit('short') + + g.panel.timeSeries.standardOptions.withOverrides([]) + + g.panel.timeSeries.standardOptions.withNoValue('0'), glb_reqcache: this.signals.gcploadbalancer.requestsByCache.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) - + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') + + g.panel.timeSeries.standardOptions.withUnit('short') + + g.panel.timeSeries.standardOptions.withOverrides([]) + + g.panel.timeSeries.standardOptions.withNoValue('0'), glb_reqprotocol: this.signals.gcploadbalancer.requestsByProtocol.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) - + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') + + g.panel.timeSeries.standardOptions.withUnit('short') + + g.panel.timeSeries.standardOptions.withOverrides([]) + + g.panel.timeSeries.standardOptions.withNoValue('0'), glb_errorrate: this.signals.gcploadbalancer.errorRate.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') - + g.panel.timeSeries.standardOptions.withUnit('percentunit') + + g.panel.timeSeries.options.legend.withShowLegend(false) + + g.panel.timeSeries.standardOptions.withUnit('percent') + g.panel.timeSeries.standardOptions.withOverrides([ { matcher: { @@ -426,6 +439,13 @@ local commonlib = import 'common-lib/common/main.libsonnet'; id: 'noValue', value: '0', }, + { + id: 'color', + value: { + mode: 'fixed', + fixedColor: 'red', + }, + }, ], }, ]), @@ -434,12 +454,15 @@ local commonlib = import 'common-lib/common/main.libsonnet'; this.signals.gcploadbalancer.totalResponseLatency50.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') + g.panel.timeSeries.standardOptions.withOverrides([]) + this.signals.gcploadbalancer.totalResponseLatency90.asPanelMixin() + g.panel.timeSeries.standardOptions.withOverrides([]) + this.signals.gcploadbalancer.totalResponseLatency99.asPanelMixin() + g.panel.timeSeries.standardOptions.withOverrides([]) + this.signals.gcploadbalancer.totalResponseLatencyAverage.asPanelMixin() + + g.panel.timeSeries.standardOptions.withUnit('ms') + + g.panel.timeSeries.standardOptions.withNoValue('0') + g.panel.timeSeries.standardOptions.withOverrides([ { matcher: { @@ -507,10 +530,13 @@ local commonlib = import 'common-lib/common/main.libsonnet'; this.signals.gcploadbalancer.frontendLatency50.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') + g.panel.timeSeries.standardOptions.withOverrides([]) + this.signals.gcploadbalancer.frontendLatency90.asPanelMixin() + g.panel.timeSeries.standardOptions.withOverrides([]) + this.signals.gcploadbalancer.frontendLatency99.asPanelMixin() + + g.panel.timeSeries.standardOptions.withUnit('ms') + + g.panel.timeSeries.standardOptions.withNoValue('0') + g.panel.timeSeries.standardOptions.withOverrides([ { matcher: { @@ -562,11 +588,14 @@ local commonlib = import 'common-lib/common/main.libsonnet'; glb_backendlatency: this.signals.gcploadbalancer.backendLatency50.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.standardOptions.withOverrides([]) + this.signals.gcploadbalancer.backendLatency90.asPanelMixin() + g.panel.timeSeries.standardOptions.withOverrides([]) + this.signals.gcploadbalancer.backendLatency99.asPanelMixin() + + g.panel.timeSeries.standardOptions.withUnit('ms') + + g.panel.timeSeries.standardOptions.withNoValue('0') + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.standardOptions.withOverrides([ { matcher: { @@ -618,10 +647,12 @@ local commonlib = import 'common-lib/common/main.libsonnet'; glb_req_bytes_count: this.signals.gcploadbalancer.totalReqSent.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) - + g.panel.timeSeries.fieldConfig.defaults.custom.withAxisLabel('out(-) | in(+)') + g.panel.timeSeries.standardOptions.withOverrides([]) + this.signals.gcploadbalancer.totalReqReceived.asPanelMixin() + + g.panel.timeSeries.standardOptions.withUnit('short') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') + + g.panel.timeSeries.fieldConfig.defaults.custom.withAxisLabel('out(-) | in(+)') + g.panel.timeSeries.standardOptions.withOverrides([ { matcher: { @@ -662,10 +693,12 @@ local commonlib = import 'common-lib/common/main.libsonnet'; glb_backend_req_bytes_count: this.signals.gcploadbalancer.backendTotalReqSent.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) - + g.panel.timeSeries.fieldConfig.defaults.custom.withAxisLabel('out(-) | in(+)') + g.panel.timeSeries.standardOptions.withOverrides([]) + this.signals.gcploadbalancer.backendTotalReqReceived.asPanelMixin() + + g.panel.timeSeries.standardOptions.withUnit('short') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') + + g.panel.timeSeries.fieldConfig.defaults.custom.withAxisLabel('out(-) | in(+)') + g.panel.timeSeries.standardOptions.withOverrides([ { matcher: { @@ -710,14 +743,16 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + commonlib.panels.generic.stat.base.stylize() + g.panel.stat.options.withColorMode('background_solid') + g.panel.stat.standardOptions.color.withMode('thresholds') - + g.panel.stat.standardOptions.withUnit('short'), + + g.panel.stat.standardOptions.withUnit('short') + + g.panel.stat.standardOptions.withNoValue('0'), alb_total_packets: this.signals.azureloadbalancer.summaryTotalPackets.asStat() + commonlib.panels.generic.stat.base.stylize() + g.panel.stat.options.withColorMode('background_solid') + g.panel.stat.standardOptions.color.withMode('thresholds') - + g.panel.stat.standardOptions.withUnit('short'), + + g.panel.stat.standardOptions.withUnit('short') + + g.panel.stat.standardOptions.withNoValue('0'), alb_total_bytes: this.signals.azureloadbalancer.summaryTotalBytes.asStat() @@ -725,6 +760,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.panel.stat.options.withColorMode('background_solid') + g.panel.stat.standardOptions.color.withMode('thresholds') + g.panel.stat.standardOptions.withUnit('decbytes') + + g.panel.stat.standardOptions.withNoValue('0') + g.panel.stat.standardOptions.withOverrides([]), alb_snat_connections: @@ -732,43 +768,57 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + commonlib.panels.generic.stat.base.stylize() + g.panel.stat.options.withColorMode('background_solid') + g.panel.stat.standardOptions.color.withMode('thresholds') + + g.panel.stat.standardOptions.withNoValue('0') + g.panel.stat.standardOptions.withUnit('short'), alb_details_sync_packets: this.signals.azureloadbalancer.detailsSyncPackets.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) - + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') + + g.panel.timeSeries.standardOptions.withUnit('short') + + g.panel.timeSeries.standardOptions.withNoValue('0'), alb_details_total_packets: this.signals.azureloadbalancer.detailsTotalPackets.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) - + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') + + g.panel.timeSeries.standardOptions.withUnit('short') + + g.panel.timeSeries.standardOptions.withNoValue('0'), alb_details_total_bytes: this.signals.azureloadbalancer.detailsTotalBytes.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) - + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') + + g.panel.timeSeries.standardOptions.withUnit('decbytes') + + g.panel.timeSeries.standardOptions.withNoValue('0'), alb_details_snat_connections: this.signals.azureloadbalancer.detailsSnatConn.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) - + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none'), + + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') + + g.panel.timeSeries.standardOptions.withUnit('short') + + g.panel.timeSeries.standardOptions.withNoValue('0'), alb_snatports: this.signals.azureloadbalancer.snatPorts.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + + g.panel.timeSeries.standardOptions.withOverrides([]) + this.signals.azureloadbalancer.allocatedSnatPorts.asPanelMixin() - + g.panel.timeSeries.options.tooltip.withMode('multi'), + + g.panel.timeSeries.options.tooltip.withMode('multi') + + g.panel.timeSeries.standardOptions.withUnit('short') + + g.panel.timeSeries.standardOptions.withNoValue('0'), alb_used_snatports: this.signals.azureloadbalancer.usedSnatPorts.asGauge() + this.signals.azureloadbalancer.allocatedSnatPorts.asPanelMixin() + g.panel.gauge.standardOptions.color.withMode('thresholds') + g.panel.gauge.standardOptions.withOverrides([]) + + g.panel.timeSeries.standardOptions.withUnit('short') + + g.panel.timeSeries.standardOptions.withNoValue('0') + g.panel.gauge.queryOptions.withTransformations([ { id: 'configFromData', diff --git a/csp-mixin/signals/gcploadbalancer.libsonnet b/csp-mixin/signals/gcploadbalancer.libsonnet index 0bcf3c011..b89db09b8 100644 --- a/csp-mixin/signals/gcploadbalancer.libsonnet +++ b/csp-mixin/signals/gcploadbalancer.libsonnet @@ -48,7 +48,7 @@ function(this) requestsByProtocol: { name: 'Requests by protocol', - description: 'Requests per second by protocol.', + description: 'The number of requests per second by protocol.', type: 'raw', sources: { stackdriver: { @@ -60,11 +60,11 @@ function(this) errorRate: { name: 'Error rate visualization', - description: 'Error rate visualization', + description: 'Percentage of requests failing', type: 'raw', sources: { stackdriver: { - expr: 'sum(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{job="integrations/gcp",job=~"$job",project_id=~"$project_id",client_country=~"$client_country",backend_target_name=~"$backend_target_name", response_code_class!="200", response_code_class!="0"}) / sum(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{%(queriesSelector)s})', + expr: '100 * sum(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{job="integrations/gcp",job=~"$job",project_id=~"$project_id",client_country=~"$client_country",backend_target_name=~"$backend_target_name", response_code_class!="200", response_code_class!="0"}) / sum(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{%(queriesSelector)s})', legendCustomTemplate: 'Error Rate visualization', }, }, @@ -76,7 +76,7 @@ function(this) type: 'raw', sources: { stackdriver: { - expr: 'histogram_quantile(0.50, sum by(le) (stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_total_latencies_bucket{%(queriesSelector)s}))', + expr: 'histogram_quantile(0.50, sum by(le) (stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_total_latencies_bucket{%(queriesSelector)s}) > 0)', legendCustomTemplate: 'p50', }, }, @@ -88,7 +88,7 @@ function(this) type: 'raw', sources: { stackdriver: { - expr: 'histogram_quantile(0.90, sum by(le) (stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_total_latencies_bucket{%(queriesSelector)s}))', + expr: 'histogram_quantile(0.90, sum by(le) (stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_total_latencies_bucket{%(queriesSelector)s}) > 0)', legendCustomTemplate: 'p90', }, }, @@ -100,7 +100,7 @@ function(this) type: 'raw', sources: { stackdriver: { - expr: 'histogram_quantile(0.99, sum by(le) (stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_total_latencies_bucket{%(queriesSelector)s}))', + expr: 'histogram_quantile(0.99, sum by(le) (stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_total_latencies_bucket{%(queriesSelector)s}) > 0)', legendCustomTemplate: 'p99', }, }, @@ -124,7 +124,7 @@ function(this) type: 'raw', sources: { stackdriver: { - expr: 'histogram_quantile(0.50,sum by (le) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_frontend_tcp_rtt_bucket{%(queriesSelector)s}[$__rate_interval])))', + expr: 'histogram_quantile(0.50,sum by (le) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_frontend_tcp_rtt_bucket{%(queriesSelector)s}[$__rate_interval])) > 0)', legendCustomTemplate: 'p50', }, }, @@ -136,7 +136,7 @@ function(this) type: 'raw', sources: { stackdriver: { - expr: 'histogram_quantile(0.90,sum by (le) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_frontend_tcp_rtt_bucket{%(queriesSelector)s}[$__rate_interval])))', + expr: 'histogram_quantile(0.90,sum by (le) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_frontend_tcp_rtt_bucket{%(queriesSelector)s}[$__rate_interval])) > 0)', legendCustomTemplate: 'p90', }, }, @@ -148,7 +148,7 @@ function(this) type: 'raw', sources: { stackdriver: { - expr: 'histogram_quantile(0.99,sum by (le) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_frontend_tcp_rtt_bucket{%(queriesSelector)s}[$__rate_interval])))', + expr: 'histogram_quantile(0.99,sum by (le) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_frontend_tcp_rtt_bucket{%(queriesSelector)s}[$__rate_interval])) > 0)', legendCustomTemplate: 'p99', }, }, @@ -160,7 +160,7 @@ function(this) type: 'raw', sources: { stackdriver: { - expr: 'histogram_quantile(0.50, sum by (le) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_latencies_bucket{%(queriesSelector)s}[$__rate_interval])))', + expr: 'histogram_quantile(0.50, sum by (le) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_latencies_bucket{%(queriesSelector)s}[$__rate_interval])) > 0)', legendCustomTemplate: 'p50', }, }, @@ -172,7 +172,7 @@ function(this) type: 'raw', sources: { stackdriver: { - expr: 'histogram_quantile(0.90, sum by (le) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_latencies_bucket{%(queriesSelector)s}[$__rate_interval])))', + expr: 'histogram_quantile(0.90, sum by (le) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_latencies_bucket{%(queriesSelector)s}[$__rate_interval])) > 0)', legendCustomTemplate: 'p90', }, }, @@ -184,7 +184,7 @@ function(this) type: 'raw', sources: { stackdriver: { - expr: 'histogram_quantile(0.99, sum by (le) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_latencies_bucket{%(queriesSelector)s}[$__rate_interval])))', + expr: 'histogram_quantile(0.99, sum by (le) (rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_latencies_bucket{%(queriesSelector)s}[$__rate_interval])) > 0)', legendCustomTemplate: 'p99', }, }, From 7a7de19454ca788a6331550c02f274941f610462 Mon Sep 17 00:00:00 2001 From: yduartep Date: Thu, 5 Sep 2024 18:24:27 +0200 Subject: [PATCH 11/13] define signals based on the config file definition --- csp-mixin/main.libsonnet | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/csp-mixin/main.libsonnet b/csp-mixin/main.libsonnet index 5ee993684..cd41c141b 100644 --- a/csp-mixin/main.libsonnet +++ b/csp-mixin/main.libsonnet @@ -6,11 +6,8 @@ local commonlib = import 'common-lib/common/main.libsonnet'; config: config, signals: { - blobstore: commonlib.signals.unmarshallJsonMulti(this.config.signals.blobstore, type=this.config.metricsSource), - azureelasticpool: commonlib.signals.unmarshallJsonMulti(this.config.signals.azureelasticpool, type=this.config.metricsSource), - azuresqldb: commonlib.signals.unmarshallJsonMulti(this.config.signals.azuresqldb, type=this.config.metricsSource), - gcploadbalancer: commonlib.signals.unmarshallJsonMulti(this.config.signals.gcploadbalancer, type=this.config.metricsSource), - azureloadbalancer: commonlib.signals.unmarshallJsonMulti(this.config.signals.azureloadbalancer, type=this.config.metricsSource), + [sig]: commonlib.signals.unmarshallJsonMulti(this.config.signals[sig], type=this.config.metricsSource) + for sig in std.objectFields(this.config.signals) }, grafana: { panels: (import './panels.libsonnet').new(this), From 911fb2ba3081f65724bd830cf791e9f82a89555a Mon Sep 17 00:00:00 2001 From: yduartep Date: Fri, 6 Sep 2024 10:57:29 +0200 Subject: [PATCH 12/13] fix manual filter definitions in gcp dashboard --- csp-mixin/config.libsonnet | 1 + csp-mixin/panels.libsonnet | 4 +- csp-mixin/signals/gcploadbalancer.libsonnet | 26 +------------ .../signals/gcpoadbalancerBackend.libsonnet | 37 +++++++++++++++++++ 4 files changed, 41 insertions(+), 27 deletions(-) create mode 100644 csp-mixin/signals/gcpoadbalancerBackend.libsonnet diff --git a/csp-mixin/config.libsonnet b/csp-mixin/config.libsonnet index a29842925..8c749d204 100644 --- a/csp-mixin/config.libsonnet +++ b/csp-mixin/config.libsonnet @@ -10,6 +10,7 @@ azureelasticpool: (import './signals/azureelasticpool.libsonnet')(this), azuresqldb: (import './signals/azuresqldb.libsonnet')(this), gcploadbalancer: (import './signals/gcploadbalancer.libsonnet')(this), + gcpoadbalancerBackend: (import './signals/gcpoadbalancerBackend.libsonnet')(this), azureloadbalancer: (import './signals/azureloadbalancer.libsonnet')(this), }, blobStorage: { diff --git a/csp-mixin/panels.libsonnet b/csp-mixin/panels.libsonnet index 2cd7f23f9..c1e1342d1 100644 --- a/csp-mixin/panels.libsonnet +++ b/csp-mixin/panels.libsonnet @@ -691,10 +691,10 @@ local commonlib = import 'common-lib/common/main.libsonnet'; ]), glb_backend_req_bytes_count: - this.signals.gcploadbalancer.backendTotalReqSent.asTimeSeries() + this.signals.gcpoadbalancerBackend.backendTotalReqSent.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() + g.panel.timeSeries.standardOptions.withOverrides([]) - + this.signals.gcploadbalancer.backendTotalReqReceived.asPanelMixin() + + this.signals.gcpoadbalancerBackend.backendTotalReqReceived.asPanelMixin() + g.panel.timeSeries.standardOptions.withUnit('short') + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') diff --git a/csp-mixin/signals/gcploadbalancer.libsonnet b/csp-mixin/signals/gcploadbalancer.libsonnet index b89db09b8..b837e8c7c 100644 --- a/csp-mixin/signals/gcploadbalancer.libsonnet +++ b/csp-mixin/signals/gcploadbalancer.libsonnet @@ -64,7 +64,7 @@ function(this) type: 'raw', sources: { stackdriver: { - expr: '100 * sum(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{job="integrations/gcp",job=~"$job",project_id=~"$project_id",client_country=~"$client_country",backend_target_name=~"$backend_target_name", response_code_class!="200", response_code_class!="0"}) / sum(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{%(queriesSelector)s})', + expr: '100 * sum(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{%(queriesSelector)s, response_code_class!="200", response_code_class!="0"}) / sum(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{%(queriesSelector)s})', legendCustomTemplate: 'Error Rate visualization', }, }, @@ -213,29 +213,5 @@ function(this) }, }, }, - - backendTotalReqSent: { - name: 'Backend Total Requests sent/received', - description: 'The number of bytes per second in requests sent from the load balancer to backends and in responses received from the load balancer to the backends.', - type: 'raw', - sources: { - stackdriver: { - expr: 'sum(rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_request_bytes_count{job="integrations/gcp",job=~"$job",project_id=~"$project_id",backend_target_name=~"$backend_target_name"}[$__rate_interval]))', - legendCustomTemplate: 'Sent', - }, - }, - }, - - backendTotalReqReceived: { - name: 'Backend Total Requests received', - description: 'The number of bytes per second in requests sent from the load balancer to backends and in responses received from the load balancer to the backends.', - type: 'raw', - sources: { - stackdriver: { - expr: 'sum(rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_response_bytes_count{job="integrations/gcp",job=~"$job",project_id=~"$project_id",backend_target_name=~"$backend_target_name"}[$__rate_interval]))', - legendCustomTemplate: 'Received', - }, - }, - }, }, } diff --git a/csp-mixin/signals/gcpoadbalancerBackend.libsonnet b/csp-mixin/signals/gcpoadbalancerBackend.libsonnet new file mode 100644 index 000000000..a51f1893f --- /dev/null +++ b/csp-mixin/signals/gcpoadbalancerBackend.libsonnet @@ -0,0 +1,37 @@ +local commonlib = import 'common-lib/common/main.libsonnet'; +function(this) + { + local s = self, + filteringSelector: this.filteringSelector, + groupLabels: ['job', 'project_id'], + instanceLabels: ['backend_target_name'], + aggLevel: 'instance', + discoveryMetric: { + stackdriver: 'stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count', + }, + signals: { + backendTotalReqSent: { + name: 'Backend Total Requests sent/received', + description: 'The number of bytes per second in requests sent from the load balancer to backends and in responses received from the load balancer to the backends.', + type: 'raw', + sources: { + stackdriver: { + expr: 'sum(rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_request_bytes_count{%(queriesSelector)s}[$__rate_interval]))', + legendCustomTemplate: 'Sent', + }, + }, + }, + + backendTotalReqReceived: { + name: 'Backend Total Requests received', + description: 'The number of bytes per second in requests sent from the load balancer to backends and in responses received from the load balancer to the backends.', + type: 'raw', + sources: { + stackdriver: { + expr: 'sum(rate(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_backend_response_bytes_count{%(queriesSelector)s}[$__rate_interval]))', + legendCustomTemplate: 'Received', + }, + }, + }, + }, + } From f9c8771331e948d64fb62563219010361a232686 Mon Sep 17 00:00:00 2001 From: yduartep Date: Sun, 8 Sep 2024 12:57:15 +0200 Subject: [PATCH 13/13] update titles and tooltips --- csp-mixin/panels.libsonnet | 31 +++++++----- csp-mixin/rows.libsonnet | 6 +-- csp-mixin/signals/azureloadbalancer.libsonnet | 30 ++++++------ csp-mixin/signals/gcploadbalancer.libsonnet | 48 +++++++++---------- .../signals/gcpoadbalancerBackend.libsonnet | 6 +-- 5 files changed, 65 insertions(+), 56 deletions(-) diff --git a/csp-mixin/panels.libsonnet b/csp-mixin/panels.libsonnet index c1e1342d1..09c59e866 100644 --- a/csp-mixin/panels.libsonnet +++ b/csp-mixin/panels.libsonnet @@ -427,7 +427,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') + g.panel.timeSeries.options.legend.withShowLegend(false) - + g.panel.timeSeries.standardOptions.withUnit('percent') + + g.panel.timeSeries.standardOptions.withUnit('percentunit') + + g.panel.timeSeries.standardOptions.withMin(0) + + g.panel.timeSeries.standardOptions.withMax(1) + g.panel.timeSeries.standardOptions.withOverrides([ { matcher: { @@ -744,7 +746,8 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.panel.stat.options.withColorMode('background_solid') + g.panel.stat.standardOptions.color.withMode('thresholds') + g.panel.stat.standardOptions.withUnit('short') - + g.panel.stat.standardOptions.withNoValue('0'), + + g.panel.stat.standardOptions.withNoValue('0') + + g.panel.stat.standardOptions.withOverrides([]), alb_total_packets: this.signals.azureloadbalancer.summaryTotalPackets.asStat() @@ -752,7 +755,8 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.panel.stat.options.withColorMode('background_solid') + g.panel.stat.standardOptions.color.withMode('thresholds') + g.panel.stat.standardOptions.withUnit('short') - + g.panel.stat.standardOptions.withNoValue('0'), + + g.panel.stat.standardOptions.withNoValue('0') + + g.panel.stat.standardOptions.withOverrides([]), alb_total_bytes: this.signals.azureloadbalancer.summaryTotalBytes.asStat() @@ -769,7 +773,8 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.panel.stat.options.withColorMode('background_solid') + g.panel.stat.standardOptions.color.withMode('thresholds') + g.panel.stat.standardOptions.withNoValue('0') - + g.panel.stat.standardOptions.withUnit('short'), + + g.panel.stat.standardOptions.withUnit('short') + + g.panel.stat.standardOptions.withOverrides([]), alb_details_sync_packets: this.signals.azureloadbalancer.detailsSyncPackets.asTimeSeries() @@ -777,7 +782,8 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') + g.panel.timeSeries.standardOptions.withUnit('short') - + g.panel.timeSeries.standardOptions.withNoValue('0'), + + g.panel.timeSeries.standardOptions.withNoValue('0') + + g.panel.timeSeries.standardOptions.withOverrides([]), alb_details_total_packets: this.signals.azureloadbalancer.detailsTotalPackets.asTimeSeries() @@ -785,7 +791,8 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') + g.panel.timeSeries.standardOptions.withUnit('short') - + g.panel.timeSeries.standardOptions.withNoValue('0'), + + g.panel.timeSeries.standardOptions.withNoValue('0') + + g.panel.timeSeries.standardOptions.withOverrides([]), alb_details_total_bytes: this.signals.azureloadbalancer.detailsTotalBytes.asTimeSeries() @@ -793,7 +800,8 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') + g.panel.timeSeries.standardOptions.withUnit('decbytes') - + g.panel.timeSeries.standardOptions.withNoValue('0'), + + g.panel.timeSeries.standardOptions.withNoValue('0') + + g.panel.timeSeries.standardOptions.withOverrides([]), alb_details_snat_connections: this.signals.azureloadbalancer.detailsSnatConn.asTimeSeries() @@ -801,24 +809,25 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withGradientMode('none') + g.panel.timeSeries.standardOptions.withUnit('short') - + g.panel.timeSeries.standardOptions.withNoValue('0'), + + g.panel.timeSeries.standardOptions.withNoValue('0') + + g.panel.timeSeries.standardOptions.withOverrides([]), alb_snatports: this.signals.azureloadbalancer.snatPorts.asTimeSeries() + commonlib.panels.generic.timeSeries.base.stylize() - + g.panel.timeSeries.standardOptions.withOverrides([]) + this.signals.azureloadbalancer.allocatedSnatPorts.asPanelMixin() + g.panel.timeSeries.options.tooltip.withMode('multi') + g.panel.timeSeries.standardOptions.withUnit('short') - + g.panel.timeSeries.standardOptions.withNoValue('0'), + + g.panel.timeSeries.standardOptions.withNoValue('0') + + g.panel.timeSeries.standardOptions.withOverrides([]), alb_used_snatports: this.signals.azureloadbalancer.usedSnatPorts.asGauge() + this.signals.azureloadbalancer.allocatedSnatPorts.asPanelMixin() + g.panel.gauge.standardOptions.color.withMode('thresholds') - + g.panel.gauge.standardOptions.withOverrides([]) + g.panel.timeSeries.standardOptions.withUnit('short') + g.panel.timeSeries.standardOptions.withNoValue('0') + + g.panel.timeSeries.standardOptions.withOverrides([]) + g.panel.gauge.queryOptions.withTransformations([ { id: 'configFromData', diff --git a/csp-mixin/rows.libsonnet b/csp-mixin/rows.libsonnet index 63510860d..98e6266bd 100644 --- a/csp-mixin/rows.libsonnet +++ b/csp-mixin/rows.libsonnet @@ -119,7 +119,7 @@ local g = import './g.libsonnet'; // GCP Load Balancer glb_requests: [ - g.panel.row.new('Load Balancer Requests'), + g.panel.row.new('Load balancer requests'), this.grafana.panels.glb_reqsec + g.panel.timeSeries.gridPos.withW(12) + g.panel.timeSeries.gridPos.withH(8), @@ -157,7 +157,7 @@ local g = import './g.libsonnet'; ], glb_traffic_metrics: [ - g.panel.row.new('Traffic Metrics'), + g.panel.row.new('Traffic'), this.grafana.panels.glb_req_bytes_count + g.panel.timeSeries.gridPos.withW(12) + g.panel.timeSeries.gridPos.withH(8), @@ -207,7 +207,7 @@ local g = import './g.libsonnet'; ], alb_loadbalancers: [ - g.panel.row.new('Load Balancers'), + g.panel.row.new('SNAT Ports'), this.grafana.panels.alb_snatports + g.panel.timeSeries.gridPos.withW(12) + g.panel.timeSeries.gridPos.withH(8), diff --git a/csp-mixin/signals/azureloadbalancer.libsonnet b/csp-mixin/signals/azureloadbalancer.libsonnet index 4f4be0b07..a83b65502 100644 --- a/csp-mixin/signals/azureloadbalancer.libsonnet +++ b/csp-mixin/signals/azureloadbalancer.libsonnet @@ -11,7 +11,7 @@ function(this) }, signals: { summarySyncPackets: { - name: 'Total Sync Packets', + name: 'Sync Packets', description: 'Total number of SYN Packets transmitted', type: 'raw', unit: 'short', @@ -24,7 +24,7 @@ function(this) }, summaryTotalPackets: { - name: 'Total Packets', + name: 'Packets', description: 'Total number of Packets transmitted', type: 'raw', unit: 'short', @@ -36,7 +36,7 @@ function(this) }, }, summaryTotalBytes: { - name: 'Total Bytes', + name: 'Bytes', description: 'Total number of Bytes transmitted', type: 'raw', unit: 'short', @@ -48,7 +48,7 @@ function(this) }, }, summarySnatConn: { - name: 'Total SNAT Connections', + name: 'SNAT connetions', description: 'Total number of new SNAT connections created', type: 'raw', unit: 'short', @@ -61,8 +61,8 @@ function(this) }, detailsSyncPackets: { - name: 'Total Sync Packets by Resource Group', - description: 'Total number of SYN Packets transmitted by resource group', + name: 'Sync Packets', + description: 'Total number of SYN Packets transmitted within time period', type: 'raw', sources: { azuremonitor: { @@ -73,8 +73,8 @@ function(this) }, detailsTotalPackets: { - name: 'Packet Count by Resource Group', - description: 'Total number of Packets transmitted by resource group', + name: 'Packets', + description: 'Total number of Packets transmitted within time period', type: 'raw', sources: { azuremonitor: { @@ -84,8 +84,8 @@ function(this) }, }, detailsTotalBytes: { - name: 'Total Bytes by Resource Group', - description: 'Total number of Bytes transmitted by resource group', + name: 'Bytes', + description: 'Total number of Bytes transmitted within time period', type: 'raw', sources: { azuremonitor: { @@ -95,8 +95,8 @@ function(this) }, }, detailsSnatConn: { - name: 'SNAT Connections by Resource Group', - description: 'Total number of new SNAT connections created by resource group', + name: 'SNAT connections', + description: 'Total number of new SNAT connections created within time period', type: 'raw', sources: { azuremonitor: { @@ -108,7 +108,7 @@ function(this) snatPorts: { name: 'SNAT Ports', - description: 'Total number of SNAT ports used and allocated', + description: 'Total SNAT ports used and allocated within time period', type: 'raw', sources: { azuremonitor: { @@ -119,8 +119,8 @@ function(this) }, usedSnatPorts: { - name: 'Used SNAT Ports', - description: 'Total number of SNAT ports used', + name: 'Currently used SNAT ports', + description: 'Total SNAT ports used at the current time', type: 'raw', sources: { azuremonitor: { diff --git a/csp-mixin/signals/gcploadbalancer.libsonnet b/csp-mixin/signals/gcploadbalancer.libsonnet index b837e8c7c..b9d9a3025 100644 --- a/csp-mixin/signals/gcploadbalancer.libsonnet +++ b/csp-mixin/signals/gcploadbalancer.libsonnet @@ -11,8 +11,8 @@ function(this) }, signals: { requestsByStatus: { - name: 'Requests / sec', - description: 'The number of requests per second by status code.', + name: 'Requests by status code', + description: 'Amount of requests sent by status code for the filters selected', type: 'raw', sources: { stackdriver: { @@ -23,8 +23,8 @@ function(this) }, requestsByCountry: { - name: 'Requests by Country', - description: 'The number of requests per second by client country.', + name: 'Requests by country', + description: 'Amount of requests sent by country for the filters selected', type: 'raw', sources: { stackdriver: { @@ -35,8 +35,8 @@ function(this) }, requestsByCache: { - name: 'Requests by Cache Results', - description: 'The cache results per second of requests.', + name: 'Requests by cache results', + description: 'Amount of cache results for the filters selected', type: 'raw', sources: { stackdriver: { @@ -48,7 +48,7 @@ function(this) requestsByProtocol: { name: 'Requests by protocol', - description: 'The number of requests per second by protocol.', + description: 'Amount of requests by protocol for the filters selected', type: 'raw', sources: { stackdriver: { @@ -59,20 +59,20 @@ function(this) }, errorRate: { - name: 'Error rate visualization', - description: 'Percentage of requests failing', + name: 'Error rate percentage', + description: 'Percentage of requests failing for the filters selected', type: 'raw', sources: { stackdriver: { - expr: '100 * sum(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{%(queriesSelector)s, response_code_class!="200", response_code_class!="0"}) / sum(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{%(queriesSelector)s})', + expr: '100 * (sum(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{%(queriesSelector)s, response_code_class!="200", response_code_class!="0"}) / sum(stackdriver_https_lb_rule_loadbalancing_googleapis_com_https_request_count{%(queriesSelector)s}))', legendCustomTemplate: 'Error Rate visualization', }, }, }, totalResponseLatency50: { - name: 'Total Response Latency', - description: 'The total latency of responses', + name: 'Total Response', + description: 'Latency of all responses for the filters selected', type: 'raw', sources: { stackdriver: { @@ -108,7 +108,7 @@ function(this) totalResponseLatencyAverage: { name: 'Latency Average', - description: 'The total latency of responses', + description: 'Latency of return trip time for the frontend for the filters selected', type: 'raw', sources: { stackdriver: { @@ -119,8 +119,8 @@ function(this) }, frontendLatency50: { - name: 'Frontend RTT Latency', - description: 'The latency of frontend RTT.', + name: 'Frontend RTT', + description: 'Latency of return trip time for the frontend for the filters selected', type: 'raw', sources: { stackdriver: { @@ -132,7 +132,7 @@ function(this) frontendLatency90: { name: 'Frontend RTT Latency 90', - description: 'The latency of frontend RTT.', + description: 'Latency of return trip time for the frontend for the filters selected', type: 'raw', sources: { stackdriver: { @@ -144,7 +144,7 @@ function(this) frontendLatency99: { name: 'Frontend RTT Latency 99', - description: 'The latency of frontend RTT.', + description: 'Latency of return trip time for the frontend for the filters selected', type: 'raw', sources: { stackdriver: { @@ -155,8 +155,8 @@ function(this) }, backendLatency50: { - name: 'Backend Response Latency', - description: 'The backend latency of responses.', + name: 'Backend Response', + description: 'Latency of responses for the backend for the filters selected', type: 'raw', sources: { stackdriver: { @@ -168,7 +168,7 @@ function(this) backendLatency90: { name: 'Backend Response Latency 90', - description: 'The backend latency of responses.', + description: 'Latency of responses for the backend for the filters selected', type: 'raw', sources: { stackdriver: { @@ -180,7 +180,7 @@ function(this) backendLatency99: { name: 'Backend Response Latency 99', - description: 'The backend latency of responses.', + description: 'Latency of responses for the backend for the filters selected', type: 'raw', sources: { stackdriver: { @@ -191,8 +191,8 @@ function(this) }, totalReqSent: { - name: 'Total Requests sent/received', - description: 'Number of bytes sent from/received by the load balancer.', + name: 'Total requests sent/received', + description: 'Total bytes sent/received by load balancer for the filters selected', type: 'raw', sources: { stackdriver: { @@ -204,7 +204,7 @@ function(this) totalReqReceived: { name: 'Total Requests received', - description: 'Number of bytes sent from/received by the load balancer.', + description: 'Total bytes received by load balancer for the filters selected', type: 'raw', sources: { stackdriver: { diff --git a/csp-mixin/signals/gcpoadbalancerBackend.libsonnet b/csp-mixin/signals/gcpoadbalancerBackend.libsonnet index a51f1893f..d42653ea3 100644 --- a/csp-mixin/signals/gcpoadbalancerBackend.libsonnet +++ b/csp-mixin/signals/gcpoadbalancerBackend.libsonnet @@ -11,8 +11,8 @@ function(this) }, signals: { backendTotalReqSent: { - name: 'Backend Total Requests sent/received', - description: 'The number of bytes per second in requests sent from the load balancer to backends and in responses received from the load balancer to the backends.', + name: 'Backend requests sent/received', + description: 'Total bytes sent/received by backend for the filters selected', type: 'raw', sources: { stackdriver: { @@ -24,7 +24,7 @@ function(this) backendTotalReqReceived: { name: 'Backend Total Requests received', - description: 'The number of bytes per second in requests sent from the load balancer to backends and in responses received from the load balancer to the backends.', + description: 'Total bytes sent/received by backend for the filters selected', type: 'raw', sources: { stackdriver: {