From 9f370f015320fd9ba57ec8c94e567f998233da8a Mon Sep 17 00:00:00 2001 From: Greg Pattison Date: Thu, 30 Oct 2025 13:28:51 -0400 Subject: [PATCH 01/10] Modernize squid-mixin to grafonnet v11 and signals architecture --- .gitignore | 1 + squid-mixin/.lint | 12 +- squid-mixin/{alerts => }/alerts.libsonnet | 34 +- squid-mixin/config.libsonnet | 49 +- squid-mixin/dashboards.libsonnet | 64 + squid-mixin/dashboards/dashboards.libsonnet | 1 - .../dashboards/squid-overview.libsonnet | 1465 ---------------- .../dashboards_out/squid-overview.json | 1510 ++++------------- squid-mixin/g.libsonnet | 3 + squid-mixin/jsonnetfile.json | 13 +- squid-mixin/links.libsonnet | 13 + squid-mixin/main.libsonnet | 39 + squid-mixin/mixin.libsonnet | 18 +- squid-mixin/panels.libsonnet | 183 ++ .../prometheus_alerts.yaml | 10 +- squid-mixin/rows.libsonnet | 39 + squid-mixin/signals/client.libsonnet | 101 ++ squid-mixin/signals/server.libsonnet | 192 +++ squid-mixin/signals/service_time.libsonnet | 170 ++ 19 files changed, 1229 insertions(+), 2688 deletions(-) rename squid-mixin/{alerts => }/alerts.libsonnet (84%) create mode 100644 squid-mixin/dashboards.libsonnet delete mode 100644 squid-mixin/dashboards/dashboards.libsonnet delete mode 100644 squid-mixin/dashboards/squid-overview.libsonnet create mode 100644 squid-mixin/g.libsonnet create mode 100644 squid-mixin/links.libsonnet create mode 100644 squid-mixin/main.libsonnet create mode 100644 squid-mixin/panels.libsonnet create mode 100644 squid-mixin/rows.libsonnet create mode 100644 squid-mixin/signals/client.libsonnet create mode 100644 squid-mixin/signals/server.libsonnet create mode 100644 squid-mixin/signals/service_time.libsonnet diff --git a/.gitignore b/.gitignore index d68c86c04..1a57d51f0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ vendor jsonnetfile.lock.json *.zip +.worktrees diff --git a/squid-mixin/.lint b/squid-mixin/.lint index 16fa32fd4..6ac646a35 100644 --- a/squid-mixin/.lint +++ b/squid-mixin/.lint @@ -1,10 +1,14 @@ exclusions: + template-job-rule: + reason: "Prometheus datasource variable is being named as prometheus_datasource now while linter expects 'datasource'" + panel-datasource-rule: + reason: "Modern mixins use signal-based architecture where datasource references are handled by the framework" + template-datasource-rule: + reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" + template-instance-rule: + reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" panel-units-rule: reason: "Custom units are used for better user experience in these panels" entries: - panel: "Client request errors" - panel: "Server request errors" - template-datasource-rule: - reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" - template-instance-rule: - reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" diff --git a/squid-mixin/alerts/alerts.libsonnet b/squid-mixin/alerts.libsonnet similarity index 84% rename from squid-mixin/alerts/alerts.libsonnet rename to squid-mixin/alerts.libsonnet index 222abe5bc..d37f42da6 100644 --- a/squid-mixin/alerts/alerts.libsonnet +++ b/squid-mixin/alerts.libsonnet @@ -1,14 +1,14 @@ { - prometheusAlerts+:: { - groups+: [ + new(this): { + groups: [ { - name: 'squid', + name: this.config.uid + '-alerts', rules: [ { - alert: 'SquidHighPercentageOfHTTPServerRequestErrors', + alert: 'SquidHighHTTPServerRequestErrors', expr: ||| rate(squid_server_http_errors_total[5m]) / clamp_min(rate(squid_server_http_requests_total[5m]),1) * 100 > %(alertsCriticalHighPercentageRequestErrors)s - ||| % $._config, + ||| % this.config, 'for': '5m', labels: { severity: 'critical', @@ -17,14 +17,14 @@ summary: 'There are a high number of HTTP server errors.', description: ||| The percentage of HTTP server request errors is {{ printf "%%.0f" $value }} over the last 5m on {{ $labels.instance }} which is above the threshold of %(alertsCriticalHighPercentageRequestErrors)s. - ||| % $._config, + ||| % this.config, }, }, { - alert: 'SquidHighPercentageOfFTPServerRequestErrors', + alert: 'SquidHighFTPServerRequestErrors', expr: ||| rate(squid_server_ftp_errors_total[5m]) / clamp_min(rate(squid_server_ftp_requests_total[5m]),1) * 100 > %(alertsCriticalHighPercentageRequestErrors)s - ||| % $._config, + ||| % this.config, 'for': '5m', labels: { severity: 'critical', @@ -33,14 +33,14 @@ summary: 'There are a high number of FTP server request errors.', description: ||| The percentage of FTP server request errors is {{ printf "%%.0f" $value }} over the last 5m on {{ $labels.instance }} which is above the threshold of %(alertsCriticalHighPercentageRequestErrors)s. - ||| % $._config, + ||| % this.config, }, }, { - alert: 'SquidHighPercentageOfOtherServerRequestErrors', + alert: 'SquidHighOtherServerRequestErrors', expr: ||| rate(squid_server_other_errors_total[5m]) / clamp_min(rate(squid_server_other_requests_total[5m]),1) * 100 > %(alertsCriticalHighPercentageRequestErrors)s - ||| % $._config, + ||| % this.config, 'for': '5m', labels: { severity: 'critical', @@ -49,14 +49,14 @@ summary: 'There are a high number of other server request errors.', description: ||| The percentage of other server request errors is {{ printf "%%.0f" $value }} over the last 5m on {{ $labels.instance }} which is above the threshold of %(alertsCriticalHighPercentageRequestErrors)s. - ||| % $._config, + ||| % this.config, }, }, { - alert: 'SquidHighPercentageOfClientRequestErrors', + alert: 'SquidHighClientRequestErrors', expr: ||| rate(squid_client_http_errors_total[5m]) / clamp_min(rate(squid_client_http_requests_total[5m]),1) * 100 > %(alertsCriticalHighPercentageRequestErrors)s - ||| % $._config, + ||| % this.config, 'for': '5m', labels: { severity: 'critical', @@ -65,14 +65,14 @@ summary: 'There are a high number of HTTP client request errors.', description: ||| The percentage of HTTP client request errors is {{ printf "%%.0f" $value }} over the last 5m on {{ $labels.instance }} which is above the threshold of %(alertsCriticalHighPercentageRequestErrors)s. - ||| % $._config, + ||| % this.config, }, }, { alert: 'SquidLowCacheHitRatio', expr: ||| rate(squid_client_http_hits_total[10m]) / clamp_min(rate(squid_client_http_requests_total[10m]),1) * 100 < %(alertsWarningLowCacheHitRatio)s - ||| % $._config, + ||| % this.config, 'for': '10m', labels: { severity: 'warning', @@ -81,7 +81,7 @@ summary: 'The cache hit ratio has fallen below the configured threshold (%).', description: ||| The cache hit ratio is {{ printf "%%.0f" $value }} over the last 10m on {{ $labels.instance }} which is below the threshold of %(alertsWarningLowCacheHitRatio)s. - ||| % $._config, + ||| % this.config, }, }, ], diff --git a/squid-mixin/config.libsonnet b/squid-mixin/config.libsonnet index 8a9d7428e..628795602 100644 --- a/squid-mixin/config.libsonnet +++ b/squid-mixin/config.libsonnet @@ -1,16 +1,41 @@ { - _config+:: { - dashboardTags: ['squid'], - dashboardPeriod: 'now-1h', - dashboardTimezone: 'default', - dashboardRefresh: '1m', + local this = self, - // alerts thresholds - alertsCriticalHighPercentageRequestErrors: 5, - alertsWarningLowCacheHitRatio: 85, - enableLokiLogs: true, - enableMultiCluster: false, - multiclusterSelector: 'job=~"$job"', - squidSelector: if self.enableMultiCluster then 'job=~"$job", cluster=~"$cluster"' else 'job=~"$job"', + // Basic filtering + filteringSelector: 'job=~"$job", instance=~"$instance"', + groupLabels: ['job'], + instanceLabels: ['instance'], + + // Dashboard settings + dashboardTags: ['squid'], + dashboardPeriod: 'now-1h', + dashboardTimezone: 'default', + dashboardRefresh: '1m', + uid: 'squid', + dashboardNamePrefix: 'Squid', + + // Logs configuration + enableLokiLogs: true, + logLabels: ['job', 'instance', 'filename'], + extraLogLabels: [], + logsVolumeGroupBy: 'level', + showLogsVolume: true, + + // Multi-cluster support + enableMultiCluster: false, + multiclusterSelector: if self.enableMultiCluster then 'job=~"$job", cluster=~"$cluster"' else 'job=~"$job"', + + // Alert thresholds + alertsCriticalHighPercentageRequestErrors: 5, // % + alertsWarningLowCacheHitRatio: 85, // % + + // Metrics source + metricsSource: 'prometheus', + + // Signal definitions + signals: { + client: (import './signals/client.libsonnet')(this), + server: (import './signals/server.libsonnet')(this), + serviceTime: (import './signals/service_time.libsonnet')(this), }, } diff --git a/squid-mixin/dashboards.libsonnet b/squid-mixin/dashboards.libsonnet new file mode 100644 index 000000000..e7a0525a1 --- /dev/null +++ b/squid-mixin/dashboards.libsonnet @@ -0,0 +1,64 @@ +local g = import './g.libsonnet'; +local commonlib = import 'common-lib/common/main.libsonnet'; + +{ + local root = self, + new(this): + local prefix = this.config.dashboardNamePrefix; + local links = this.grafana.links; + local tags = this.config.dashboardTags; + local uid = this.config.uid; + local vars = commonlib.variables.new( + filteringSelector=this.config.filteringSelector, + groupLabels=this.config.groupLabels, + instanceLabels=this.config.instanceLabels, + varMetric='squid_server_http_requests_total', + customAllValue='.+', + enableLokiLogs=this.config.enableLokiLogs, + ); + local annotations = {}; + local refresh = this.config.dashboardRefresh; + local period = this.config.dashboardPeriod; + local timezone = this.config.dashboardTimezone; + + { + 'squid-overview.json': + g.dashboard.new(prefix + ' overview') + + g.dashboard.withDescription('') + + g.dashboard.withPanels( + g.util.panel.resolveCollapsedFlagOnRows( + g.util.grid.wrapPanels( + [ + this.grafana.rows.clientRow, + this.grafana.rows.serverRow, + ] + + + if this.config.enableLokiLogs then + [this.grafana.rows.logsRow] + else + [] + ) + ) + ) + + root.applyCommon( + vars.multiInstance, + uid + '-overview', + tags, + links, + annotations, + timezone, + refresh, + period + ), + }, + + applyCommon(vars, uid, tags, links, annotations, timezone, refresh, period): + g.dashboard.withTags(tags) + + g.dashboard.withUid(uid) + + g.dashboard.withLinks([links[key].asDashboardLink() for key in std.objectFields(links)]) + + g.dashboard.withTimezone(timezone) + + g.dashboard.withRefresh(refresh) + + g.dashboard.time.withFrom(period) + + g.dashboard.withVariables(vars) + + g.dashboard.withAnnotations(std.objectValues(annotations)), +} diff --git a/squid-mixin/dashboards/dashboards.libsonnet b/squid-mixin/dashboards/dashboards.libsonnet deleted file mode 100644 index 0cb8bcea2..000000000 --- a/squid-mixin/dashboards/dashboards.libsonnet +++ /dev/null @@ -1 +0,0 @@ -(import 'squid-overview.libsonnet') diff --git a/squid-mixin/dashboards/squid-overview.libsonnet b/squid-mixin/dashboards/squid-overview.libsonnet deleted file mode 100644 index cf20b4537..000000000 --- a/squid-mixin/dashboards/squid-overview.libsonnet +++ /dev/null @@ -1,1465 +0,0 @@ -local g = (import 'grafana-builder/grafana.libsonnet'); -local grafana = (import 'grafonnet/grafana.libsonnet'); -local dashboard = grafana.dashboard; -local template = grafana.template; -local prometheus = grafana.prometheus; - -local dashboardUid = 'squid-overview'; - -local promDatasourceName = 'prometheus_datasource'; -local lokiDatasourceName = 'loki_datasource'; -local getMatcher(cfg) = '%(squidSelector)s, instance=~"$instance"' % cfg; - -local promDatasource = { - uid: '${%s}' % promDatasourceName, -}; - -local lokiDatasource = { - uid: '${%s}' % lokiDatasourceName, -}; - -local clientRow = { - datasource: promDatasource, - targets: [], - type: 'row', - title: 'Client', - collapsed: false, -}; - -local clientRequestsPanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'rate(squid_client_http_requests_total{' + matcher + '}[$__rate_interval])', - datasource=promDatasource, - legendFormat='{{instance}}', - ), - ], - type: 'timeseries', - title: 'Client requests', - description: 'The request rate of client.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 'reqps', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local clientRequestErrorsPanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'rate(squid_client_http_errors_total{' + matcher + '}[$__rate_interval])', - datasource=promDatasource, - legendFormat='{{instance}}', - ), - ], - type: 'timeseries', - title: 'Client request errors', - description: 'The number of client HTTP errors.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 'errors/s', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local clientCacheHitRatioPanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - '(rate(squid_client_http_hits_total{' + matcher + '}[$__rate_interval]) / clamp_min(rate(squid_client_http_requests_total{' + matcher + '}[$__rate_interval]),1)) * 100', - datasource=promDatasource, - legendFormat='{{instance}}', - ), - ], - type: 'timeseries', - title: 'Client cache hit ratio', - description: 'The client cache hit ratio.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 'percent', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local clientRequestSentThroughputPanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'rate(squid_client_http_kbytes_out_kbytes_total{' + matcher + '}[$__rate_interval])', - datasource=promDatasource, - legendFormat='{{instance}}', - ), - ], - type: 'timeseries', - title: 'Client request sent throughput', - description: 'The throughput of client HTTP data sent.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 'KBs', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local clientHTTPReceivedThroughputPanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'rate(squid_client_http_kbytes_in_kbytes_total{' + matcher + '}[$__rate_interval])', - datasource=promDatasource, - legendFormat='{{instance}}', - ), - ], - type: 'timeseries', - title: 'Client HTTP received throughput', - description: 'The throughput of client HTTP data received.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 'KBs', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local clientCacheHitThroughputPanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'rate(squid_client_http_hit_kbytes_out_bytes_total{' + matcher + '}[$__rate_interval])', - datasource=promDatasource, - legendFormat='{{instance}}', - ), - ], - type: 'timeseries', - title: 'Client cache hit throughput', - description: 'The throughput of client cache hit.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 'KBs', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local httpRequestServiceTimePanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'squid_HTTP_Requests_All_50{' + matcher + '} ', - datasource=promDatasource, - legendFormat='50%', - ), - prometheus.target( - 'squid_HTTP_Requests_All_75{' + matcher + '}', - datasource=promDatasource, - legendFormat='75%', - ), - prometheus.target( - 'squid_HTTP_Requests_All_95{' + matcher + '}', - datasource=promDatasource, - legendFormat='95%', - ), - ], - type: 'timeseries', - title: 'HTTP request service time', - description: 'HTTP request service time percentiles.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 's', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local cacheHitServiceTimePanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'squid_Cache_Hits_50{' + matcher + '}', - datasource=promDatasource, - legendFormat='50%', - ), - prometheus.target( - 'squid_Cache_Hits_75{' + matcher + '}', - datasource=promDatasource, - legendFormat='75%', - ), - prometheus.target( - 'squid_Cache_Hits_95{' + matcher + '}', - datasource=promDatasource, - legendFormat='95%', - ), - ], - type: 'timeseries', - title: 'Cache hit service time', - description: 'Cache hits service time percentiles.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 's', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local cacheMissesServiceTimePanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'squid_Cache_Misses_50{' + matcher + '}', - datasource=promDatasource, - legendFormat='50%', - ), - prometheus.target( - 'squid_Cache_Misses_75{' + matcher + '}', - datasource=promDatasource, - legendFormat='75%', - ), - prometheus.target( - 'squid_Cache_Misses_95{' + matcher + '}', - datasource=promDatasource, - legendFormat='95%', - ), - ], - type: 'timeseries', - title: 'Cache misses service time', - description: 'Cache misses service time percentiles.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 's', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local serverRow = { - datasource: promDatasource, - targets: [], - type: 'row', - title: 'Server', - collapsed: false, -}; - -local serverRequestsPanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'rate(squid_server_ftp_requests_total{' + matcher + '}[$__rate_interval])', - datasource=promDatasource, - legendFormat='FTP', - ), - prometheus.target( - 'rate(squid_server_http_requests_total{' + matcher + '}[$__rate_interval])', - datasource=promDatasource, - legendFormat='HTTP', - ), - prometheus.target( - 'rate(squid_server_other_requests_total{' + matcher + '}[$__rate_interval])', - datasource=promDatasource, - legendFormat='other', - ), - ], - type: 'timeseries', - title: 'Server requests', - description: 'The number of HTTP, FTP, and other server requests.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'normal', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 'reqps', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local serverRequestErrorsPanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'rate(squid_server_ftp_errors_total{' + matcher + '}[$__rate_interval])', - datasource=promDatasource, - legendFormat='FTP', - ), - prometheus.target( - 'rate(squid_server_http_errors_total{' + matcher + '}[$__rate_interval])', - datasource=promDatasource, - legendFormat='HTTP', - ), - prometheus.target( - 'rate(squid_server_other_errors_total{' + matcher + '}[$__rate_interval])', - datasource=promDatasource, - legendFormat='other', - ), - ], - type: 'timeseries', - title: 'Server request errors', - description: 'The number of HTTP, FTP, and other server request errors.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'normal', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 'errors/s', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local serverRequestSentThroughputPanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'rate(squid_server_ftp_kbytes_out_kbytes_total{' + matcher + '}[$__rate_interval])', - datasource=promDatasource, - legendFormat='FTP', - ), - prometheus.target( - 'rate(squid_server_http_kbytes_out_kbytes_total{' + matcher + '}[$__rate_interval])', - datasource=promDatasource, - legendFormat='HTTP', - ), - prometheus.target( - 'rate(squid_server_other_kbytes_out_kbytes_total{' + matcher + '}[$__rate_interval])', - datasource=promDatasource, - legendFormat='other', - ), - ], - type: 'timeseries', - title: 'Server request sent throughput', - description: 'The number of HTTP, FTP, and other server sent throughput.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'normal', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 'KBs', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local serverObjectSwapPanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'rate(squid_swap_ins_total{' + matcher + '}[$__rate_interval])', - datasource=promDatasource, - legendFormat='{{instance}} - read', - ), - prometheus.target( - 'rate(squid_swap_outs_total{' + matcher + '}[$__rate_interval])', - datasource=promDatasource, - legendFormat='{{instance}} - saved', - ), - ], - type: 'timeseries', - title: 'Server object swap', - description: 'The number of objects read from disk and the number of objects saved to disk.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'normal', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 'cps', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local dnsLookupServiceTimePanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'squid_DNS_Lookups_50{' + matcher + '}', - datasource=promDatasource, - legendFormat='50%', - ), - prometheus.target( - 'squid_DNS_Lookups_75{' + matcher + '}', - datasource=promDatasource, - legendFormat='75%', - ), - prometheus.target( - 'squid_DNS_Lookups_95{' + matcher + '}', - datasource=promDatasource, - legendFormat='95%', - ), - ], - type: 'timeseries', - title: 'DNS lookup service time', - description: 'DNS lookup service time percentiles', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'normal', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 's', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local serverReceivedThroughputPanel(matcher) = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'rate(squid_server_ftp_kbytes_in_kbytes_total{' + matcher + '}[$__rate_interval])', - datasource=promDatasource, - legendFormat='FTP', - ), - prometheus.target( - 'rate(squid_server_http_kbytes_in_kbytes_total{' + matcher + '}[$__rate_interval])', - datasource=promDatasource, - legendFormat='HTTP', - ), - prometheus.target( - 'rate(squid_server_other_kbytes_in_kbytes_total{' + matcher + '}[$__rate_interval])', - datasource=promDatasource, - legendFormat='other', - ), - ], - type: 'timeseries', - title: 'Server received throughput', - description: 'The number of HTTP, FTP, and other server throughput.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 0, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - lineInterpolation: 'linear', - lineWidth: 1, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'auto', - spanNulls: false, - stacking: { - group: 'A', - mode: 'normal', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - unit: 'KBs', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'single', - sort: 'none', - }, - }, -}; - -local cacheLogsPanel(matcher) = { - datasource: lokiDatasource, - targets: [ - { - datasource: lokiDatasource, - editorMode: 'code', - expr: '{' + matcher + '} |= `` | (filename="/var/log/squid/cache.log" or log_type="cache")', - queryType: 'range', - refId: 'A', - }, - ], - type: 'logs', - title: 'Cache logs', - description: 'The log file that contains the debug and error messages that Squid generates.', - options: { - dedupStrategy: 'none', - enableLogDetails: true, - prettifyLogMessage: false, - showCommonLabels: false, - showLabels: false, - showTime: false, - sortOrder: 'Descending', - wrapLogMessage: false, - }, -}; - -local accessLogsPanel(matcher) = { - datasource: lokiDatasource, - targets: [ - { - datasource: lokiDatasource, - editorMode: 'code', - expr: '{' + matcher + '} |= `` | (filename="/var/log/squid/access.log" or log_type="access")', - queryType: 'range', - refId: 'A', - }, - ], - type: 'logs', - title: 'Access logs', - description: 'The log file that contains a record of all HTTP requests and responses processed by the Squid proxy server.', - options: { - dedupStrategy: 'none', - enableLogDetails: true, - prettifyLogMessage: false, - showCommonLabels: false, - showLabels: false, - showTime: false, - sortOrder: 'Descending', - wrapLogMessage: false, - }, -}; - -{ - grafanaDashboards+:: { - 'squid-overview.json': - dashboard.new( - 'Squid overview', - time_from='%s' % $._config.dashboardPeriod, - tags=($._config.dashboardTags), - timezone='%s' % $._config.dashboardTimezone, - refresh='%s' % $._config.dashboardRefresh, - description='', - uid=dashboardUid, - ) - - .addTemplates( - std.flattenArrays([ - [ - template.datasource( - promDatasourceName, - 'prometheus', - null, - label='Data Source', - refresh='load' - ), - ], - if $._config.enableLokiLogs then [ - template.datasource( - lokiDatasourceName, - 'loki', - null, - label='Loki Datasource', - refresh='load' - ), - ] else [], - [ - template.new( - 'job', - promDatasource, - 'label_values(squid_server_http_requests_total{}, job)', - label='Job', - refresh=2, - includeAll=true, - multi=true, - allValues='.+', - sort=0 - ), - template.new( - 'cluster', - promDatasource, - 'label_values(squid_server_http_requests_total{%(multiclusterSelector)s}, cluster)' % $._config, - label='Cluster', - refresh=2, - includeAll=true, - multi=true, - allValues='.*', - hide=if $._config.enableMultiCluster then '' else 'variable', - sort=0 - ), - template.new( - 'instance', - promDatasource, - 'label_values(squid_server_http_requests_total{%(multiclusterSelector)s}, instance)' % $._config, - label='Instance', - refresh=2, - includeAll=true, - multi=false, - allValues='', - sort=0 - ), - ], - ]) - ) - .addPanels( - std.flattenArrays([ - [ - clientRow { gridPos: { h: 1, w: 24, x: 0, y: 0 } }, - clientRequestsPanel(getMatcher($._config)) { gridPos: { h: 8, w: 8, x: 0, y: 1 } }, - clientRequestErrorsPanel(getMatcher($._config)) { gridPos: { h: 8, w: 8, x: 8, y: 1 } }, - clientCacheHitRatioPanel(getMatcher($._config)) { gridPos: { h: 8, w: 8, x: 16, y: 1 } }, - clientRequestSentThroughputPanel(getMatcher($._config)) { gridPos: { h: 7, w: 8, x: 0, y: 9 } }, - clientHTTPReceivedThroughputPanel(getMatcher($._config)) { gridPos: { h: 7, w: 8, x: 8, y: 9 } }, - clientCacheHitThroughputPanel(getMatcher($._config)) { gridPos: { h: 7, w: 8, x: 16, y: 9 } }, - httpRequestServiceTimePanel(getMatcher($._config)) { gridPos: { h: 7, w: 8, x: 0, y: 16 } }, - cacheHitServiceTimePanel(getMatcher($._config)) { gridPos: { h: 7, w: 8, x: 8, y: 16 } }, - cacheMissesServiceTimePanel(getMatcher($._config)) { gridPos: { h: 7, w: 8, x: 16, y: 16 } }, - serverRow { gridPos: { h: 1, w: 24, x: 0, y: 23 } }, - serverRequestsPanel(getMatcher($._config)) { gridPos: { h: 8, w: 8, x: 0, y: 24 } }, - serverRequestErrorsPanel(getMatcher($._config)) { gridPos: { h: 8, w: 8, x: 8, y: 24 } }, - serverRequestSentThroughputPanel(getMatcher($._config)) { gridPos: { h: 8, w: 8, x: 16, y: 24 } }, - serverObjectSwapPanel(getMatcher($._config)) { gridPos: { h: 8, w: 8, x: 0, y: 32 } }, - dnsLookupServiceTimePanel(getMatcher($._config)) { gridPos: { h: 8, w: 8, x: 8, y: 32 } }, - serverReceivedThroughputPanel(getMatcher($._config)) { gridPos: { h: 8, w: 8, x: 16, y: 32 } }, - ], - if $._config.enableLokiLogs then [ - cacheLogsPanel(getMatcher($._config)) { gridPos: { h: 6, w: 24, x: 0, y: 40 } }, - ] else [], - [ - ], - if $._config.enableLokiLogs then [ - accessLogsPanel(getMatcher($._config)) { gridPos: { h: 6, w: 24, x: 0, y: 46 } }, - ] else [], - [ - ], - ]) - ), - - }, -} diff --git a/squid-mixin/dashboards_out/squid-overview.json b/squid-mixin/dashboards_out/squid-overview.json index 151040aa5..f830da3e0 100644 --- a/squid-mixin/dashboards_out/squid-overview.json +++ b/squid-mixin/dashboards_out/squid-overview.json @@ -1,90 +1,40 @@ { - "__inputs": [ ], - "__requires": [ ], "annotations": { "list": [ ] }, "description": "", - "editable": false, - "gnetId": null, - "graphTooltip": 0, - "hideControls": false, - "id": null, - "links": [ ], + "links": [ + { + "keepTime": true, + "title": "Squid overview", + "type": "link", + "url": "/d/squid-overview" + } + ], "panels": [ { "collapsed": false, - "datasource": { - "uid": "${prometheus_datasource}" - }, "gridPos": { "h": 1, - "w": 24, + "w": 0, "x": 0, "y": 0 }, - "id": 2, - "targets": [ ], + "id": 1, + "panels": [ ], "title": "Client", "type": "row" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "datasource", + "uid": "-- Mixed --" }, "description": "The request rate of client.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, "unit": "reqps" - }, - "overrides": [ ] + } }, "gridPos": { "h": 8, @@ -92,28 +42,19 @@ "x": 0, "y": 1 }, - "id": 3, - "options": { - "legend": { - "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, + "id": 2, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(squid_client_http_requests_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])", + "expr": "avg by (job,instance) (\n rate(squid_client_http_requests_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}}" + "instant": false, + "legendFormat": "{{instance}}", + "refId": "Client HTTP requests" } ], "title": "Client requests", @@ -121,61 +62,14 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "datasource", + "uid": "-- Mixed --" }, "description": "The number of client HTTP errors.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, "unit": "errors/s" - }, - "overrides": [ ] + } }, "gridPos": { "h": 8, @@ -183,28 +77,19 @@ "x": 8, "y": 1 }, - "id": 4, - "options": { - "legend": { - "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, + "id": 3, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(squid_client_http_errors_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])", + "expr": "avg by (job,instance) (\n rate(squid_client_http_errors_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}}" + "instant": false, + "legendFormat": "{{instance}}", + "refId": "Client HTTP errors" } ], "title": "Client request errors", @@ -212,61 +97,14 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "datasource", + "uid": "-- Mixed --" }, "description": "The client cache hit ratio.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, "unit": "percent" - }, - "overrides": [ ] + } }, "gridPos": { "h": 8, @@ -274,28 +112,19 @@ "x": 16, "y": 1 }, - "id": 5, - "options": { - "legend": { - "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, + "id": 4, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "(rate(squid_client_http_hits_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval]) / clamp_min(rate(squid_client_http_requests_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval]),1)) * 100", + "expr": "(rate(squid_client_http_hits_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval]) / clamp_min(rate(squid_client_http_requests_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval]),1)) * 100", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}}" + "instant": false, + "legendFormat": "{{instance}}", + "refId": "Client cache hit ratio" } ], "title": "Client cache hit ratio", @@ -303,90 +132,34 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "datasource", + "uid": "-- Mixed --" }, "description": "The throughput of client HTTP data sent.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, "unit": "KBs" - }, - "overrides": [ ] + } }, "gridPos": { "h": 7, "w": 8, "x": 0, - "y": 9 - }, - "id": 6, - "options": { - "legend": { - "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "y": 8 }, + "id": 5, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(squid_client_http_kbytes_out_kbytes_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])", + "expr": "avg by (job,instance) (\n rate(squid_client_http_kbytes_out_kbytes_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}}" + "instant": false, + "legendFormat": "{{instance}}", + "refId": "Client HTTP sent throughput" } ], "title": "Client request sent throughput", @@ -394,90 +167,34 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "datasource", + "uid": "-- Mixed --" }, "description": "The throughput of client HTTP data received.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, "unit": "KBs" - }, - "overrides": [ ] + } }, "gridPos": { "h": 7, "w": 8, "x": 8, - "y": 9 - }, - "id": 7, - "options": { - "legend": { - "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "y": 8 }, + "id": 6, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(squid_client_http_kbytes_in_kbytes_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])", + "expr": "avg by (job,instance) (\n rate(squid_client_http_kbytes_in_kbytes_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}}" + "instant": false, + "legendFormat": "{{instance}}", + "refId": "Client HTTP received throughput" } ], "title": "Client HTTP received throughput", @@ -485,90 +202,34 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "datasource", + "uid": "-- Mixed --" }, "description": "The throughput of client cache hit.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, "unit": "KBs" - }, - "overrides": [ ] + } }, "gridPos": { "h": 7, "w": 8, "x": 16, - "y": 9 - }, - "id": 8, - "options": { - "legend": { - "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "y": 8 }, + "id": 7, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(squid_client_http_hit_kbytes_out_bytes_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])", + "expr": "avg by (job,instance) (\n rate(squid_client_http_hit_kbytes_out_bytes_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}}" + "instant": false, + "legendFormat": "{{instance}}", + "refId": "Client cache hit throughput" } ], "title": "Client cache hit throughput", @@ -576,108 +237,56 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "datasource", + "uid": "-- Mixed --" }, "description": "HTTP request service time percentiles.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, "unit": "s" - }, - "overrides": [ ] + } }, "gridPos": { "h": 7, "w": 8, "x": 0, - "y": 16 - }, - "id": 9, - "options": { - "legend": { - "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "y": 15 }, + "id": 8, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "squid_HTTP_Requests_All_50{job=~\"$job\", instance=~\"$instance\"} ", + "expr": "squid_HTTP_Requests_All_50{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "50%" + "instant": false, + "legendFormat": "50%", + "refId": "HTTP requests service time p50" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "squid_HTTP_Requests_All_75{job=~\"$job\", instance=~\"$instance\"}", + "expr": "squid_HTTP_Requests_All_75{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "75%" + "instant": false, + "legendFormat": "75%", + "refId": "HTTP requests service time p75" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "squid_HTTP_Requests_All_95{job=~\"$job\", instance=~\"$instance\"}", + "expr": "squid_HTTP_Requests_All_95{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "95%" + "instant": false, + "legendFormat": "95%", + "refId": "HTTP requests service time p95" } ], "title": "HTTP request service time", @@ -685,108 +294,56 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "datasource", + "uid": "-- Mixed --" }, "description": "Cache hits service time percentiles.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, "unit": "s" - }, - "overrides": [ ] + } }, "gridPos": { "h": 7, "w": 8, "x": 8, - "y": 16 - }, - "id": 10, - "options": { - "legend": { - "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "y": 15 }, + "id": 9, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "squid_Cache_Hits_50{job=~\"$job\", instance=~\"$instance\"}", + "expr": "squid_Cache_Hits_50{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "50%" + "instant": false, + "legendFormat": "50%", + "refId": "Cache hits service time p50" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "squid_Cache_Hits_75{job=~\"$job\", instance=~\"$instance\"}", + "expr": "squid_Cache_Hits_75{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "75%" + "instant": false, + "legendFormat": "75%", + "refId": "Cache hits service time p75" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "squid_Cache_Hits_95{job=~\"$job\", instance=~\"$instance\"}", + "expr": "squid_Cache_Hits_95{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "95%" + "instant": false, + "legendFormat": "95%", + "refId": "Cache hits service time p95" } ], "title": "Cache hit service time", @@ -794,108 +351,56 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "datasource", + "uid": "-- Mixed --" }, "description": "Cache misses service time percentiles.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, "unit": "s" - }, - "overrides": [ ] + } }, "gridPos": { "h": 7, "w": 8, "x": 16, - "y": 16 - }, - "id": 11, - "options": { - "legend": { - "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "y": 15 }, + "id": 10, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "squid_Cache_Misses_50{job=~\"$job\", instance=~\"$instance\"}", + "expr": "squid_Cache_Misses_50{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "50%" + "instant": false, + "legendFormat": "50%", + "refId": "Cache misses service time p50" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "squid_Cache_Misses_75{job=~\"$job\", instance=~\"$instance\"}", + "expr": "squid_Cache_Misses_75{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "75%" + "instant": false, + "legendFormat": "75%", + "refId": "Cache misses service time p75" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "squid_Cache_Misses_95{job=~\"$job\", instance=~\"$instance\"}", + "expr": "squid_Cache_Misses_95{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "95%" + "instant": false, + "legendFormat": "95%", + "refId": "Cache misses service time p95" } ], "title": "Cache misses service time", @@ -903,77 +408,32 @@ }, { "collapsed": false, - "datasource": { - "uid": "${prometheus_datasource}" - }, "gridPos": { "h": 1, - "w": 24, + "w": 0, "x": 0, "y": 23 }, - "id": 12, - "targets": [ ], + "id": 11, + "panels": [ ], "title": "Server", "type": "row" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "datasource", + "uid": "-- Mixed --" }, "description": "The number of HTTP, FTP, and other server requests.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, "stacking": { - "group": "A", "mode": "normal" - }, - "thresholdsStyle": { - "mode": "off" } }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, "unit": "reqps" - }, - "overrides": [ ] + } }, "gridPos": { "h": 8, @@ -981,46 +441,41 @@ "x": 0, "y": 24 }, - "id": 13, - "options": { - "legend": { - "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, + "id": 12, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(squid_server_ftp_requests_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])", + "expr": "avg by (job,instance) (\n rate(squid_server_ftp_requests_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "FTP" + "instant": false, + "legendFormat": "FTP", + "refId": "Server FTP requests" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(squid_server_http_requests_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])", + "expr": "avg by (job,instance) (\n rate(squid_server_http_requests_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "HTTP" + "instant": false, + "legendFormat": "HTTP", + "refId": "Server HTTP requests" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(squid_server_other_requests_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])", + "expr": "avg by (job,instance) (\n rate(squid_server_other_requests_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "other" + "instant": false, + "legendFormat": "other", + "refId": "Server other requests" } ], "title": "Server requests", @@ -1028,61 +483,19 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "datasource", + "uid": "-- Mixed --" }, "description": "The number of HTTP, FTP, and other server request errors.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, "stacking": { - "group": "A", "mode": "normal" - }, - "thresholdsStyle": { - "mode": "off" } }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, "unit": "errors/s" - }, - "overrides": [ ] + } }, "gridPos": { "h": 8, @@ -1090,46 +503,41 @@ "x": 8, "y": 24 }, - "id": 14, - "options": { - "legend": { - "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, + "id": 13, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(squid_server_ftp_errors_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])", + "expr": "avg by (job,instance) (\n rate(squid_server_ftp_errors_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "FTP" + "instant": false, + "legendFormat": "FTP", + "refId": "Server FTP errors" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(squid_server_http_errors_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])", + "expr": "avg by (job,instance) (\n rate(squid_server_http_errors_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "HTTP" + "instant": false, + "legendFormat": "HTTP", + "refId": "Server HTTP errors" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(squid_server_other_errors_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])", + "expr": "avg by (job,instance) (\n rate(squid_server_other_errors_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "other" + "instant": false, + "legendFormat": "other", + "refId": "Server other errors" } ], "title": "Server request errors", @@ -1137,61 +545,19 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "datasource", + "uid": "-- Mixed --" }, "description": "The number of HTTP, FTP, and other server sent throughput.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, "stacking": { - "group": "A", "mode": "normal" - }, - "thresholdsStyle": { - "mode": "off" } }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, "unit": "KBs" - }, - "overrides": [ ] + } }, "gridPos": { "h": 8, @@ -1199,46 +565,41 @@ "x": 16, "y": 24 }, - "id": 15, - "options": { - "legend": { - "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, + "id": 14, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(squid_server_ftp_kbytes_out_kbytes_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])", + "expr": "avg by (job,instance) (\n rate(squid_server_ftp_kbytes_out_kbytes_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "FTP" + "instant": false, + "legendFormat": "FTP", + "refId": "Server FTP sent throughput" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(squid_server_http_kbytes_out_kbytes_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])", + "expr": "avg by (job,instance) (\n rate(squid_server_http_kbytes_out_kbytes_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "HTTP" + "instant": false, + "legendFormat": "HTTP", + "refId": "Server HTTP sent throughput" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(squid_server_other_kbytes_out_kbytes_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])", + "expr": "avg by (job,instance) (\n rate(squid_server_other_kbytes_out_kbytes_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "other" + "instant": false, + "legendFormat": "other", + "refId": "Server other sent throughput" } ], "title": "Server request sent throughput", @@ -1246,61 +607,19 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "datasource", + "uid": "-- Mixed --" }, "description": "The number of objects read from disk and the number of objects saved to disk.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, "stacking": { - "group": "A", "mode": "normal" - }, - "thresholdsStyle": { - "mode": "off" } }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, "unit": "cps" - }, - "overrides": [ ] + } }, "gridPos": { "h": 8, @@ -1308,37 +627,30 @@ "x": 0, "y": 32 }, - "id": 16, - "options": { - "legend": { - "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, + "id": 15, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(squid_swap_ins_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])", + "expr": "avg by (job,instance) (\n rate(squid_swap_ins_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - read" + "instant": false, + "legendFormat": "{{instance}} - read", + "refId": "Server object swap ins" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(squid_swap_outs_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])", + "expr": "avg by (job,instance) (\n rate(squid_swap_outs_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{instance}} - saved" + "instant": false, + "legendFormat": "{{instance}} - saved", + "refId": "Server object swap outs" } ], "title": "Server object swap", @@ -1346,61 +658,19 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "datasource", + "uid": "-- Mixed --" }, "description": "DNS lookup service time percentiles", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, "stacking": { - "group": "A", "mode": "normal" - }, - "thresholdsStyle": { - "mode": "off" } }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, "unit": "s" - }, - "overrides": [ ] + } }, "gridPos": { "h": 8, @@ -1408,46 +678,41 @@ "x": 8, "y": 32 }, - "id": 17, - "options": { - "legend": { - "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, + "id": 16, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "squid_DNS_Lookups_50{job=~\"$job\", instance=~\"$instance\"}", + "expr": "squid_DNS_Lookups_50{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "50%" + "instant": false, + "legendFormat": "50%", + "refId": "DNS lookup service time p50" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "squid_DNS_Lookups_75{job=~\"$job\", instance=~\"$instance\"}", + "expr": "squid_DNS_Lookups_75{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "75%" + "instant": false, + "legendFormat": "75%", + "refId": "DNS lookup service time p75" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "squid_DNS_Lookups_95{job=~\"$job\", instance=~\"$instance\"}", + "expr": "squid_DNS_Lookups_95{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "95%" + "instant": false, + "legendFormat": "95%", + "refId": "DNS lookup service time p95" } ], "title": "DNS lookup service time", @@ -1455,61 +720,19 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "datasource", + "uid": "-- Mixed --" }, "description": "The number of HTTP, FTP, and other server throughput.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, "stacking": { - "group": "A", "mode": "normal" - }, - "thresholdsStyle": { - "mode": "off" } }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, "unit": "KBs" - }, - "overrides": [ ] + } }, "gridPos": { "h": 8, @@ -1517,82 +740,86 @@ "x": 16, "y": 32 }, - "id": 18, - "options": { - "legend": { - "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, + "id": 17, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(squid_server_ftp_kbytes_in_kbytes_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])", + "expr": "avg by (job,instance) (\n rate(squid_server_ftp_kbytes_in_kbytes_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "FTP" + "instant": false, + "legendFormat": "FTP", + "refId": "Server FTP received throughput" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(squid_server_http_kbytes_in_kbytes_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])", + "expr": "avg by (job,instance) (\n rate(squid_server_http_kbytes_in_kbytes_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "HTTP" + "instant": false, + "legendFormat": "HTTP", + "refId": "Server HTTP received throughput" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(squid_server_other_kbytes_in_kbytes_total{job=~\"$job\", instance=~\"$instance\"}[$__rate_interval])", + "expr": "avg by (job,instance) (\n rate(squid_server_other_kbytes_in_kbytes_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "other" + "instant": false, + "legendFormat": "other", + "refId": "Server other received throughput" } ], "title": "Server received throughput", "type": "timeseries" }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 0, + "x": 0, + "y": 40 + }, + "id": 18, + "panels": [ ], + "title": "Logs", + "type": "row" + }, { "datasource": { - "uid": "${loki_datasource}" + "type": "datasource", + "uid": "-- Mixed --" }, "description": "The log file that contains the debug and error messages that Squid generates.", "gridPos": { "h": 6, "w": 24, "x": 0, - "y": 40 + "y": 41 }, "id": 19, "options": { - "dedupStrategy": "none", "enableLogDetails": true, - "prettifyLogMessage": false, "showCommonLabels": false, - "showLabels": false, "showTime": false, - "sortOrder": "Descending", "wrapLogMessage": false }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { + "type": "loki", "uid": "${loki_datasource}" }, - "editorMode": "code", - "expr": "{job=~\"$job\", instance=~\"$instance\"} |= `` | (filename=\"/var/log/squid/cache.log\" or log_type=\"cache\")", - "queryType": "range", - "refId": "A" + "expr": "{job=~\"$job\", instance=~\"$instance\"} |= `` | (filename=\"/var/log/squid/cache.log\" or log_type=\"cache\")" } ], "title": "Cache logs", @@ -1600,35 +827,31 @@ }, { "datasource": { - "uid": "${loki_datasource}" + "type": "datasource", + "uid": "-- Mixed --" }, "description": "The log file that contains a record of all HTTP requests and responses processed by the Squid proxy server.", "gridPos": { "h": 6, "w": 24, "x": 0, - "y": 46 + "y": 47 }, "id": 20, "options": { - "dedupStrategy": "none", "enableLogDetails": true, - "prettifyLogMessage": false, "showCommonLabels": false, - "showLabels": false, "showTime": false, - "sortOrder": "Descending", "wrapLogMessage": false }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { + "type": "loki", "uid": "${loki_datasource}" }, - "editorMode": "code", - "expr": "{job=~\"$job\", instance=~\"$instance\"} |= `` | (filename=\"/var/log/squid/access.log\" or log_type=\"access\")", - "queryType": "range", - "refId": "A" + "expr": "{job=~\"$job\", instance=~\"$instance\"} |= `` | (filename=\"/var/log/squid/access.log\" or log_type=\"access\")" } ], "title": "Access logs", @@ -1636,101 +859,56 @@ } ], "refresh": "1m", - "rows": [ ], - "schemaVersion": 14, - "style": "dark", + "schemaVersion": 39, "tags": [ "squid" ], "templating": { "list": [ { - "current": { }, - "hide": 0, - "label": "Data Source", + "label": "Prometheus data source", "name": "prometheus_datasource", - "options": [ ], "query": "prometheus", - "refresh": 1, - "regex": "", - "type": "datasource" - }, - { - "current": { }, - "hide": 0, - "label": "Loki Datasource", - "name": "loki_datasource", - "options": [ ], - "query": "loki", - "refresh": 1, "regex": "", "type": "datasource" }, { "allValue": ".+", - "current": { }, "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "hide": 0, "includeAll": true, "label": "Job", "multi": true, "name": "job", - "options": [ ], - "query": "label_values(squid_server_http_requests_total{}, job)", + "query": "label_values(squid_server_http_requests_total{job=~\"$job\", instance=~\"$instance\"}, job)", "refresh": 2, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "sort": 1, + "type": "query" }, { - "allValue": ".*", - "current": { }, + "allValue": ".+", "datasource": { + "type": "prometheus", "uid": "${prometheus_datasource}" }, - "hide": 2, "includeAll": true, - "label": "Cluster", + "label": "Instance", "multi": true, - "name": "cluster", - "options": [ ], - "query": "label_values(squid_server_http_requests_total{job=~\"$job\"}, cluster)", + "name": "instance", + "query": "label_values(squid_server_http_requests_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\"}, instance)", "refresh": 2, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "sort": 1, + "type": "query" }, { - "allValue": "", - "current": { }, - "datasource": { - "uid": "${prometheus_datasource}" - }, - "hide": 0, - "includeAll": true, - "label": "Instance", - "multi": false, - "name": "instance", - "options": [ ], - "query": "label_values(squid_server_http_requests_total{job=~\"$job\"}, instance)", - "refresh": 2, + "hide": 2, + "label": "Loki data source", + "name": "loki_datasource", + "query": "loki", "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "type": "datasource" } ] }, @@ -1738,33 +916,7 @@ "from": "now-1h", "to": "now" }, - "timepicker": { - "refresh_intervals": [ - "5s", - "10s", - "30s", - "1m", - "5m", - "15m", - "30m", - "1h", - "2h", - "1d" - ], - "time_options": [ - "5m", - "15m", - "1h", - "6h", - "12h", - "24h", - "2d", - "7d", - "30d" - ] - }, "timezone": "default", "title": "Squid overview", - "uid": "squid-overview", - "version": 0 + "uid": "squid-overview" } \ No newline at end of file diff --git a/squid-mixin/g.libsonnet b/squid-mixin/g.libsonnet new file mode 100644 index 000000000..161012e80 --- /dev/null +++ b/squid-mixin/g.libsonnet @@ -0,0 +1,3 @@ +// grafonnet must be imported with "g" alias +local g = import './vendor/github.com/grafana/grafonnet/gen/grafonnet-v11.0.0/main.libsonnet'; +g diff --git a/squid-mixin/jsonnetfile.json b/squid-mixin/jsonnetfile.json index 93f3316ec..46d5af011 100644 --- a/squid-mixin/jsonnetfile.json +++ b/squid-mixin/jsonnetfile.json @@ -4,8 +4,17 @@ { "source": { "git": { - "remote": "https://github.com/grafana/grafonnet-lib.git", - "subdir": "grafonnet" + "remote": "https://github.com/grafana/grafonnet", + "subdir": "gen/grafonnet-v11.0.0" + } + }, + "version": "main" + }, + { + "source": { + "git": { + "remote": "https://github.com/grafana/jsonnet-libs.git", + "subdir": "common-lib" } }, "version": "master" diff --git a/squid-mixin/links.libsonnet b/squid-mixin/links.libsonnet new file mode 100644 index 000000000..e76731e0b --- /dev/null +++ b/squid-mixin/links.libsonnet @@ -0,0 +1,13 @@ +local g = import './g.libsonnet'; +local commonlib = import 'common-lib/common/main.libsonnet'; + +{ + new(this): + { + overview: { + asString(): '/d/' + this.config.uid + '-overview', + asDashboardLink(): g.dashboard.link.link.new('Squid overview', self.asString()) + + g.dashboard.link.link.options.withKeepTime(true), + }, + }, +} diff --git a/squid-mixin/main.libsonnet b/squid-mixin/main.libsonnet new file mode 100644 index 000000000..3e547d8bf --- /dev/null +++ b/squid-mixin/main.libsonnet @@ -0,0 +1,39 @@ +local alerts = import './alerts.libsonnet'; +local config = import './config.libsonnet'; +local dashboards = import './dashboards.libsonnet'; +local g = import './g.libsonnet'; +local links = import './links.libsonnet'; +local panels = import './panels.libsonnet'; +local rows = import './rows.libsonnet'; +local commonlib = import 'common-lib/common/main.libsonnet'; + +{ + new(): { + local this = self, + config: config, + + signals: + { + [category]: commonlib.signals.unmarshallJsonMulti( + this.config.signals[category], + type=this.config.metricsSource + ) + for category in std.objectFields(this.config.signals) + }, + + grafana: { + links: links.new(this), + panels: panels.new(this), + rows: rows.new(this), + dashboards: dashboards.new(this), + }, + + prometheus: { + alerts: alerts.new(this), + }, + }, + + withConfigMixin(config): { + config+: config, + }, +} diff --git a/squid-mixin/mixin.libsonnet b/squid-mixin/mixin.libsonnet index 4d987cf31..fb91408d7 100644 --- a/squid-mixin/mixin.libsonnet +++ b/squid-mixin/mixin.libsonnet @@ -1,3 +1,15 @@ -(import 'dashboards/dashboards.libsonnet') + -(import 'alerts/alerts.libsonnet') + -(import 'config.libsonnet') +local lib = import './main.libsonnet'; + +local squid = + lib.new() + + lib.withConfigMixin({ + // Override defaults if needed + }); + +{ + grafanaDashboards+:: squid.grafana.dashboards, + prometheusAlerts+:: squid.prometheus.alerts, + prometheusRules+:: { + groups+: [], + }, +} diff --git a/squid-mixin/panels.libsonnet b/squid-mixin/panels.libsonnet new file mode 100644 index 000000000..f16520baf --- /dev/null +++ b/squid-mixin/panels.libsonnet @@ -0,0 +1,183 @@ +local g = import './g.libsonnet'; +local commonlib = import 'common-lib/common/main.libsonnet'; + +{ + new(this): + { + local signals = this.signals, + + // Client panels + clientRequests: + g.panel.timeSeries.new('Client requests') + + g.panel.timeSeries.panelOptions.withDescription('The request rate of client.') + + g.panel.timeSeries.queryOptions.withTargets([ + signals.client.httpRequests.asTarget(), + ]) + + g.panel.timeSeries.standardOptions.withUnit('reqps'), + + clientRequestErrors: + g.panel.timeSeries.new('Client request errors') + + g.panel.timeSeries.panelOptions.withDescription('The number of client HTTP errors.') + + g.panel.timeSeries.queryOptions.withTargets([ + signals.client.httpErrors.asTarget(), + ]) + + g.panel.timeSeries.standardOptions.withUnit('errors/s'), + + clientCacheHitRatio: + g.panel.timeSeries.new('Client cache hit ratio') + + g.panel.timeSeries.panelOptions.withDescription('The client cache hit ratio.') + + g.panel.timeSeries.queryOptions.withTargets([ + signals.client.cacheHitRatio.asTarget(), + ]) + + g.panel.timeSeries.standardOptions.withUnit('percent'), + + clientRequestSentThroughput: + g.panel.timeSeries.new('Client request sent throughput') + + g.panel.timeSeries.panelOptions.withDescription('The throughput of client HTTP data sent.') + + g.panel.timeSeries.queryOptions.withTargets([ + signals.client.httpSentThroughput.asTarget(), + ]) + + g.panel.timeSeries.standardOptions.withUnit('KBs'), + + clientHTTPReceivedThroughput: + g.panel.timeSeries.new('Client HTTP received throughput') + + g.panel.timeSeries.panelOptions.withDescription('The throughput of client HTTP data received.') + + g.panel.timeSeries.queryOptions.withTargets([ + signals.client.httpReceivedThroughput.asTarget(), + ]) + + g.panel.timeSeries.standardOptions.withUnit('KBs'), + + clientCacheHitThroughput: + g.panel.timeSeries.new('Client cache hit throughput') + + g.panel.timeSeries.panelOptions.withDescription('The throughput of client cache hit.') + + g.panel.timeSeries.queryOptions.withTargets([ + signals.client.cacheHitThroughput.asTarget(), + ]) + + g.panel.timeSeries.standardOptions.withUnit('KBs'), + + httpRequestServiceTime: + g.panel.timeSeries.new('HTTP request service time') + + g.panel.timeSeries.panelOptions.withDescription('HTTP request service time percentiles.') + + g.panel.timeSeries.queryOptions.withTargets([ + signals.serviceTime.httpRequestsAll50.asTarget(), + signals.serviceTime.httpRequestsAll75.asTarget(), + signals.serviceTime.httpRequestsAll95.asTarget(), + ]) + + g.panel.timeSeries.standardOptions.withUnit('s'), + + cacheHitServiceTime: + g.panel.timeSeries.new('Cache hit service time') + + g.panel.timeSeries.panelOptions.withDescription('Cache hits service time percentiles.') + + g.panel.timeSeries.queryOptions.withTargets([ + signals.serviceTime.cacheHits50.asTarget(), + signals.serviceTime.cacheHits75.asTarget(), + signals.serviceTime.cacheHits95.asTarget(), + ]) + + g.panel.timeSeries.standardOptions.withUnit('s'), + + cacheMissesServiceTime: + g.panel.timeSeries.new('Cache misses service time') + + g.panel.timeSeries.panelOptions.withDescription('Cache misses service time percentiles.') + + g.panel.timeSeries.queryOptions.withTargets([ + signals.serviceTime.cacheMisses50.asTarget(), + signals.serviceTime.cacheMisses75.asTarget(), + signals.serviceTime.cacheMisses95.asTarget(), + ]) + + g.panel.timeSeries.standardOptions.withUnit('s'), + + // Server panels + serverRequests: + g.panel.timeSeries.new('Server requests') + + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server requests.') + + g.panel.timeSeries.queryOptions.withTargets([ + signals.server.ftpRequests.asTarget(), + signals.server.httpRequests.asTarget(), + signals.server.otherRequests.asTarget(), + ]) + + g.panel.timeSeries.standardOptions.withUnit('reqps') + + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), + + serverRequestErrors: + g.panel.timeSeries.new('Server request errors') + + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server request errors.') + + g.panel.timeSeries.queryOptions.withTargets([ + signals.server.ftpErrors.asTarget(), + signals.server.httpErrors.asTarget(), + signals.server.otherErrors.asTarget(), + ]) + + g.panel.timeSeries.standardOptions.withUnit('errors/s') + + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), + + serverRequestSentThroughput: + g.panel.timeSeries.new('Server request sent throughput') + + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server sent throughput.') + + g.panel.timeSeries.queryOptions.withTargets([ + signals.server.ftpSentThroughput.asTarget(), + signals.server.httpSentThroughput.asTarget(), + signals.server.otherSentThroughput.asTarget(), + ]) + + g.panel.timeSeries.standardOptions.withUnit('KBs') + + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), + + serverObjectSwap: + g.panel.timeSeries.new('Server object swap') + + g.panel.timeSeries.panelOptions.withDescription('The number of objects read from disk and the number of objects saved to disk.') + + g.panel.timeSeries.queryOptions.withTargets([ + signals.server.swapIns.asTarget(), + signals.server.swapOuts.asTarget(), + ]) + + g.panel.timeSeries.standardOptions.withUnit('cps') + + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), + + dnsLookupServiceTime: + g.panel.timeSeries.new('DNS lookup service time') + + g.panel.timeSeries.panelOptions.withDescription('DNS lookup service time percentiles') + + g.panel.timeSeries.queryOptions.withTargets([ + signals.serviceTime.dnsLookups50.asTarget(), + signals.serviceTime.dnsLookups75.asTarget(), + signals.serviceTime.dnsLookups95.asTarget(), + ]) + + g.panel.timeSeries.standardOptions.withUnit('s') + + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), + + serverReceivedThroughput: + g.panel.timeSeries.new('Server received throughput') + + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server throughput.') + + g.panel.timeSeries.queryOptions.withTargets([ + signals.server.ftpReceivedThroughput.asTarget(), + signals.server.httpReceivedThroughput.asTarget(), + signals.server.otherReceivedThroughput.asTarget(), + ]) + + g.panel.timeSeries.standardOptions.withUnit('KBs') + + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), + + // Logs panels + cacheLogs: + g.panel.logs.new('Cache logs') + + g.panel.logs.panelOptions.withDescription('The log file that contains the debug and error messages that Squid generates.') + + g.panel.logs.queryOptions.withTargets([ + g.query.loki.new( + '${loki_datasource}', + '{' + this.config.filteringSelector + '} |= `` | (filename="/var/log/squid/cache.log" or log_type="cache")' + ), + ]) + + g.panel.logs.options.withEnableLogDetails(true) + + g.panel.logs.options.withShowCommonLabels(false) + + g.panel.logs.options.withShowTime(false) + + g.panel.logs.options.withWrapLogMessage(false), + + accessLogs: + g.panel.logs.new('Access logs') + + g.panel.logs.panelOptions.withDescription('The log file that contains a record of all HTTP requests and responses processed by the Squid proxy server.') + + g.panel.logs.queryOptions.withTargets([ + g.query.loki.new( + '${loki_datasource}', + '{' + this.config.filteringSelector + '} |= `` | (filename="/var/log/squid/access.log" or log_type="access")' + ), + ]) + + g.panel.logs.options.withEnableLogDetails(true) + + g.panel.logs.options.withShowCommonLabels(false) + + g.panel.logs.options.withShowTime(false) + + g.panel.logs.options.withWrapLogMessage(false), + }, +} diff --git a/squid-mixin/prometheus_rules_out/prometheus_alerts.yaml b/squid-mixin/prometheus_rules_out/prometheus_alerts.yaml index 7b7966f8a..add490baa 100644 --- a/squid-mixin/prometheus_rules_out/prometheus_alerts.yaml +++ b/squid-mixin/prometheus_rules_out/prometheus_alerts.yaml @@ -1,7 +1,7 @@ groups: - - name: squid + - name: squid-alerts rules: - - alert: SquidHighPercentageOfHTTPServerRequestErrors + - alert: SquidHighHTTPServerRequestErrors annotations: description: | The percentage of HTTP server request errors is {{ printf "%.0f" $value }} over the last 5m on {{ $labels.instance }} which is above the threshold of 5. @@ -11,7 +11,7 @@ groups: for: 5m labels: severity: critical - - alert: SquidHighPercentageOfFTPServerRequestErrors + - alert: SquidHighFTPServerRequestErrors annotations: description: | The percentage of FTP server request errors is {{ printf "%.0f" $value }} over the last 5m on {{ $labels.instance }} which is above the threshold of 5. @@ -21,7 +21,7 @@ groups: for: 5m labels: severity: critical - - alert: SquidHighPercentageOfOtherServerRequestErrors + - alert: SquidHighOtherServerRequestErrors annotations: description: | The percentage of other server request errors is {{ printf "%.0f" $value }} over the last 5m on {{ $labels.instance }} which is above the threshold of 5. @@ -31,7 +31,7 @@ groups: for: 5m labels: severity: critical - - alert: SquidHighPercentageOfClientRequestErrors + - alert: SquidHighClientRequestErrors annotations: description: | The percentage of HTTP client request errors is {{ printf "%.0f" $value }} over the last 5m on {{ $labels.instance }} which is above the threshold of 5. diff --git a/squid-mixin/rows.libsonnet b/squid-mixin/rows.libsonnet new file mode 100644 index 000000000..fbff02627 --- /dev/null +++ b/squid-mixin/rows.libsonnet @@ -0,0 +1,39 @@ +local g = import './g.libsonnet'; + +{ + new(this): { + local panels = this.grafana.panels, + + clientRow: + g.panel.row.new('Client') + + g.panel.row.withPanels([ + panels.clientRequests { gridPos: { h: 8, w: 8, x: 0, y: 1 } }, + panels.clientRequestErrors { gridPos: { h: 8, w: 8, x: 8, y: 1 } }, + panels.clientCacheHitRatio { gridPos: { h: 8, w: 8, x: 16, y: 1 } }, + panels.clientRequestSentThroughput { gridPos: { h: 7, w: 8, x: 0, y: 9 } }, + panels.clientHTTPReceivedThroughput { gridPos: { h: 7, w: 8, x: 8, y: 9 } }, + panels.clientCacheHitThroughput { gridPos: { h: 7, w: 8, x: 16, y: 9 } }, + panels.httpRequestServiceTime { gridPos: { h: 7, w: 8, x: 0, y: 16 } }, + panels.cacheHitServiceTime { gridPos: { h: 7, w: 8, x: 8, y: 16 } }, + panels.cacheMissesServiceTime { gridPos: { h: 7, w: 8, x: 16, y: 16 } }, + ]), + + serverRow: + g.panel.row.new('Server') + + g.panel.row.withPanels([ + panels.serverRequests { gridPos: { h: 8, w: 8, x: 0, y: 24 } }, + panels.serverRequestErrors { gridPos: { h: 8, w: 8, x: 8, y: 24 } }, + panels.serverRequestSentThroughput { gridPos: { h: 8, w: 8, x: 16, y: 24 } }, + panels.serverObjectSwap { gridPos: { h: 8, w: 8, x: 0, y: 32 } }, + panels.dnsLookupServiceTime { gridPos: { h: 8, w: 8, x: 8, y: 32 } }, + panels.serverReceivedThroughput { gridPos: { h: 8, w: 8, x: 16, y: 32 } }, + ]), + + logsRow: + g.panel.row.new('Logs') + + g.panel.row.withPanels([ + panels.cacheLogs { gridPos: { h: 6, w: 24, x: 0, y: 40 } }, + panels.accessLogs { gridPos: { h: 6, w: 24, x: 0, y: 46 } }, + ]), + }, +} diff --git a/squid-mixin/signals/client.libsonnet b/squid-mixin/signals/client.libsonnet new file mode 100644 index 000000000..41658646b --- /dev/null +++ b/squid-mixin/signals/client.libsonnet @@ -0,0 +1,101 @@ +function(this) + { + filteringSelector: this.filteringSelector, + groupLabels: this.groupLabels, + instanceLabels: this.instanceLabels, + aggLevel: 'instance', + aggFunction: 'avg', + signals: { + + httpRequests: { + name: 'Client HTTP requests', + type: 'counter', + unit: 'reqps', + description: 'The request rate of client.', + sources: { + prometheus: { + expr: 'squid_client_http_requests_total{%(queriesSelector)s}', + legendCustomTemplate: '{{instance}}', + }, + }, + }, + + httpErrors: { + name: 'Client HTTP errors', + type: 'counter', + unit: 'errors/s', + description: 'The number of client HTTP errors.', + sources: { + prometheus: { + expr: 'squid_client_http_errors_total{%(queriesSelector)s}', + legendCustomTemplate: '{{instance}}', + }, + }, + }, + + httpHits: { + name: 'Client HTTP cache hits', + type: 'counter', + unit: 'ops', + description: 'The number of client cache hits.', + sources: { + prometheus: { + expr: 'squid_client_http_hits_total{%(queriesSelector)s}', + legendCustomTemplate: '{{instance}}', + }, + }, + }, + + cacheHitRatio: { + name: 'Client cache hit ratio', + type: 'raw', + unit: 'percent', + description: 'The client cache hit ratio.', + sources: { + prometheus: { + expr: '(rate(squid_client_http_hits_total{%(queriesSelector)s}[$__rate_interval]) / clamp_min(rate(squid_client_http_requests_total{%(queriesSelector)s}[$__rate_interval]),1)) * 100', + legendCustomTemplate: '{{instance}}', + }, + }, + }, + + httpSentThroughput: { + name: 'Client HTTP sent throughput', + type: 'counter', + unit: 'KBs', + description: 'The throughput of client HTTP data sent.', + sources: { + prometheus: { + expr: 'squid_client_http_kbytes_out_kbytes_total{%(queriesSelector)s}', + legendCustomTemplate: '{{instance}}', + }, + }, + }, + + httpReceivedThroughput: { + name: 'Client HTTP received throughput', + type: 'counter', + unit: 'KBs', + description: 'The throughput of client HTTP data received.', + sources: { + prometheus: { + expr: 'squid_client_http_kbytes_in_kbytes_total{%(queriesSelector)s}', + legendCustomTemplate: '{{instance}}', + }, + }, + }, + + cacheHitThroughput: { + name: 'Client cache hit throughput', + type: 'counter', + unit: 'KBs', + description: 'The throughput of client cache hit.', + sources: { + prometheus: { + expr: 'squid_client_http_hit_kbytes_out_bytes_total{%(queriesSelector)s}', + legendCustomTemplate: '{{instance}}', + }, + }, + }, + }, + } diff --git a/squid-mixin/signals/server.libsonnet b/squid-mixin/signals/server.libsonnet new file mode 100644 index 000000000..0fb47c123 --- /dev/null +++ b/squid-mixin/signals/server.libsonnet @@ -0,0 +1,192 @@ +function(this) + { + filteringSelector: this.filteringSelector, + groupLabels: this.groupLabels, + instanceLabels: this.instanceLabels, + aggLevel: 'instance', + aggFunction: 'avg', + signals: { + + ftpRequests: { + name: 'Server FTP requests', + type: 'counter', + unit: 'reqps', + description: 'The number of FTP server requests.', + sources: { + prometheus: { + expr: 'squid_server_ftp_requests_total{%(queriesSelector)s}', + legendCustomTemplate: 'FTP', + }, + }, + }, + + httpRequests: { + name: 'Server HTTP requests', + type: 'counter', + unit: 'reqps', + description: 'The number of HTTP server requests.', + sources: { + prometheus: { + expr: 'squid_server_http_requests_total{%(queriesSelector)s}', + legendCustomTemplate: 'HTTP', + }, + }, + }, + + otherRequests: { + name: 'Server other requests', + type: 'counter', + unit: 'reqps', + description: 'The number of other server requests.', + sources: { + prometheus: { + expr: 'squid_server_other_requests_total{%(queriesSelector)s}', + legendCustomTemplate: 'other', + }, + }, + }, + + ftpErrors: { + name: 'Server FTP errors', + type: 'counter', + unit: 'errors/s', + description: 'The number of FTP server request errors.', + sources: { + prometheus: { + expr: 'squid_server_ftp_errors_total{%(queriesSelector)s}', + legendCustomTemplate: 'FTP', + }, + }, + }, + + httpErrors: { + name: 'Server HTTP errors', + type: 'counter', + unit: 'errors/s', + description: 'The number of HTTP server request errors.', + sources: { + prometheus: { + expr: 'squid_server_http_errors_total{%(queriesSelector)s}', + legendCustomTemplate: 'HTTP', + }, + }, + }, + + otherErrors: { + name: 'Server other errors', + type: 'counter', + unit: 'errors/s', + description: 'The number of other server request errors.', + sources: { + prometheus: { + expr: 'squid_server_other_errors_total{%(queriesSelector)s}', + legendCustomTemplate: 'other', + }, + }, + }, + + ftpSentThroughput: { + name: 'Server FTP sent throughput', + type: 'counter', + unit: 'KBs', + description: 'The throughput of FTP server data sent.', + sources: { + prometheus: { + expr: 'squid_server_ftp_kbytes_out_kbytes_total{%(queriesSelector)s}', + legendCustomTemplate: 'FTP', + }, + }, + }, + + httpSentThroughput: { + name: 'Server HTTP sent throughput', + type: 'counter', + unit: 'KBs', + description: 'The throughput of HTTP server data sent.', + sources: { + prometheus: { + expr: 'squid_server_http_kbytes_out_kbytes_total{%(queriesSelector)s}', + legendCustomTemplate: 'HTTP', + }, + }, + }, + + otherSentThroughput: { + name: 'Server other sent throughput', + type: 'counter', + unit: 'KBs', + description: 'The throughput of other server data sent.', + sources: { + prometheus: { + expr: 'squid_server_other_kbytes_out_kbytes_total{%(queriesSelector)s}', + legendCustomTemplate: 'other', + }, + }, + }, + + swapIns: { + name: 'Server object swap ins', + type: 'counter', + unit: 'cps', + description: 'The number of objects read from disk.', + sources: { + prometheus: { + expr: 'squid_swap_ins_total{%(queriesSelector)s}', + legendCustomTemplate: '{{instance}} - read', + }, + }, + }, + + swapOuts: { + name: 'Server object swap outs', + type: 'counter', + unit: 'cps', + description: 'The number of objects saved to disk.', + sources: { + prometheus: { + expr: 'squid_swap_outs_total{%(queriesSelector)s}', + legendCustomTemplate: '{{instance}} - saved', + }, + }, + }, + + ftpReceivedThroughput: { + name: 'Server FTP received throughput', + type: 'counter', + unit: 'KBs', + description: 'The throughput of FTP server data received.', + sources: { + prometheus: { + expr: 'squid_server_ftp_kbytes_in_kbytes_total{%(queriesSelector)s}', + legendCustomTemplate: 'FTP', + }, + }, + }, + + httpReceivedThroughput: { + name: 'Server HTTP received throughput', + type: 'counter', + unit: 'KBs', + description: 'The throughput of HTTP server data received.', + sources: { + prometheus: { + expr: 'squid_server_http_kbytes_in_kbytes_total{%(queriesSelector)s}', + legendCustomTemplate: 'HTTP', + }, + }, + }, + + otherReceivedThroughput: { + name: 'Server other received throughput', + type: 'counter', + unit: 'KBs', + description: 'The throughput of other server data received.', + sources: { + prometheus: { + expr: 'squid_server_other_kbytes_in_kbytes_total{%(queriesSelector)s}', + legendCustomTemplate: 'other', + }, + }, + }, + }, + } diff --git a/squid-mixin/signals/service_time.libsonnet b/squid-mixin/signals/service_time.libsonnet new file mode 100644 index 000000000..49f465f03 --- /dev/null +++ b/squid-mixin/signals/service_time.libsonnet @@ -0,0 +1,170 @@ +function(this) + { + filteringSelector: this.filteringSelector, + groupLabels: this.groupLabels, + instanceLabels: this.instanceLabels, + aggLevel: 'none', + aggFunction: 'avg', + signals: { + + // HTTP Request service time percentiles + httpRequestsAll50: { + name: 'HTTP requests service time p50', + type: 'gauge', + unit: 's', + description: 'HTTP request service time 50th percentile.', + sources: { + prometheus: { + expr: 'squid_HTTP_Requests_All_50{%(queriesSelector)s}', + legendCustomTemplate: '50%%', + }, + }, + }, + + httpRequestsAll75: { + name: 'HTTP requests service time p75', + type: 'gauge', + unit: 's', + description: 'HTTP request service time 75th percentile.', + sources: { + prometheus: { + expr: 'squid_HTTP_Requests_All_75{%(queriesSelector)s}', + legendCustomTemplate: '75%%', + }, + }, + }, + + httpRequestsAll95: { + name: 'HTTP requests service time p95', + type: 'gauge', + unit: 's', + description: 'HTTP request service time 95th percentile.', + sources: { + prometheus: { + expr: 'squid_HTTP_Requests_All_95{%(queriesSelector)s}', + legendCustomTemplate: '95%%', + }, + }, + }, + + // Cache hits service time percentiles + cacheHits50: { + name: 'Cache hits service time p50', + type: 'gauge', + unit: 's', + description: 'Cache hits service time 50th percentile.', + sources: { + prometheus: { + expr: 'squid_Cache_Hits_50{%(queriesSelector)s}', + legendCustomTemplate: '50%%', + }, + }, + }, + + cacheHits75: { + name: 'Cache hits service time p75', + type: 'gauge', + unit: 's', + description: 'Cache hits service time 75th percentile.', + sources: { + prometheus: { + expr: 'squid_Cache_Hits_75{%(queriesSelector)s}', + legendCustomTemplate: '75%%', + }, + }, + }, + + cacheHits95: { + name: 'Cache hits service time p95', + type: 'gauge', + unit: 's', + description: 'Cache hits service time 95th percentile.', + sources: { + prometheus: { + expr: 'squid_Cache_Hits_95{%(queriesSelector)s}', + legendCustomTemplate: '95%%', + }, + }, + }, + + // Cache misses service time percentiles + cacheMisses50: { + name: 'Cache misses service time p50', + type: 'gauge', + unit: 's', + description: 'Cache misses service time 50th percentile.', + sources: { + prometheus: { + expr: 'squid_Cache_Misses_50{%(queriesSelector)s}', + legendCustomTemplate: '50%%', + }, + }, + }, + + cacheMisses75: { + name: 'Cache misses service time p75', + type: 'gauge', + unit: 's', + description: 'Cache misses service time 75th percentile.', + sources: { + prometheus: { + expr: 'squid_Cache_Misses_75{%(queriesSelector)s}', + legendCustomTemplate: '75%%', + }, + }, + }, + + cacheMisses95: { + name: 'Cache misses service time p95', + type: 'gauge', + unit: 's', + description: 'Cache misses service time 95th percentile.', + sources: { + prometheus: { + expr: 'squid_Cache_Misses_95{%(queriesSelector)s}', + legendCustomTemplate: '95%%', + }, + }, + }, + + // DNS lookup service time percentiles + dnsLookups50: { + name: 'DNS lookup service time p50', + type: 'gauge', + unit: 's', + description: 'DNS lookup service time 50th percentile.', + sources: { + prometheus: { + expr: 'squid_DNS_Lookups_50{%(queriesSelector)s}', + legendCustomTemplate: '50%%', + }, + }, + }, + + dnsLookups75: { + name: 'DNS lookup service time p75', + type: 'gauge', + unit: 's', + description: 'DNS lookup service time 75th percentile.', + sources: { + prometheus: { + expr: 'squid_DNS_Lookups_75{%(queriesSelector)s}', + legendCustomTemplate: '75%%', + }, + }, + }, + + dnsLookups95: { + name: 'DNS lookup service time p95', + type: 'gauge', + unit: 's', + description: 'DNS lookup service time 95th percentile.', + sources: { + prometheus: { + expr: 'squid_DNS_Lookups_95{%(queriesSelector)s}', + legendCustomTemplate: '95%%', + }, + }, + }, + }, + } From c37d4ebd491bb11ce5c7cac0ad0163ad82bafee1 Mon Sep 17 00:00:00 2001 From: Greg Pattison Date: Mon, 17 Nov 2025 13:30:17 -0500 Subject: [PATCH 02/10] Refactored signal files to align with the dashboards instead of grouping by category. --- squid-mixin/config.libsonnet | 24 +- squid-mixin/dashboards.libsonnet | 63 +-- squid-mixin/dashboards_out/squid-logs.json | 305 ++++++++++++++ .../dashboards_out/squid-overview.json | 266 ++++++------- squid-mixin/jsonnetfile.json | 50 ++- squid-mixin/links.libsonnet | 18 +- squid-mixin/main.libsonnet | 20 +- squid-mixin/mixin.libsonnet | 30 +- squid-mixin/panels.libsonnet | 161 +++++--- squid-mixin/signals/client.libsonnet | 375 +++++++++++++++++- squid-mixin/signals/service_time.libsonnet | 24 +- 11 files changed, 1019 insertions(+), 317 deletions(-) create mode 100644 squid-mixin/dashboards_out/squid-logs.json diff --git a/squid-mixin/config.libsonnet b/squid-mixin/config.libsonnet index 628795602..6e7ad20de 100644 --- a/squid-mixin/config.libsonnet +++ b/squid-mixin/config.libsonnet @@ -2,40 +2,32 @@ local this = self, // Basic filtering - filteringSelector: 'job=~"$job", instance=~"$instance"', + filteringSelector: 'job="integrations/squid"', groupLabels: ['job'], + logLabels: ['job', 'instance'], instanceLabels: ['instance'], // Dashboard settings - dashboardTags: ['squid'], + uid: 'squid', + dashboardNamePrefix: 'Squid', + dashboardTags: [self.uid], dashboardPeriod: 'now-1h', dashboardTimezone: 'default', dashboardRefresh: '1m', - uid: 'squid', - dashboardNamePrefix: 'Squid', - + metricsSource: 'prometheus', + // Logs configuration enableLokiLogs: true, - logLabels: ['job', 'instance', 'filename'], - extraLogLabels: [], + extraLogLabels: ['level', 'severity'], logsVolumeGroupBy: 'level', showLogsVolume: true, - // Multi-cluster support - enableMultiCluster: false, - multiclusterSelector: if self.enableMultiCluster then 'job=~"$job", cluster=~"$cluster"' else 'job=~"$job"', - // Alert thresholds alertsCriticalHighPercentageRequestErrors: 5, // % alertsWarningLowCacheHitRatio: 85, // % - // Metrics source - metricsSource: 'prometheus', - // Signal definitions signals: { client: (import './signals/client.libsonnet')(this), - server: (import './signals/server.libsonnet')(this), - serviceTime: (import './signals/service_time.libsonnet')(this), }, } diff --git a/squid-mixin/dashboards.libsonnet b/squid-mixin/dashboards.libsonnet index e7a0525a1..19c1e9c11 100644 --- a/squid-mixin/dashboards.libsonnet +++ b/squid-mixin/dashboards.libsonnet @@ -1,5 +1,6 @@ local g = import './g.libsonnet'; local commonlib = import 'common-lib/common/main.libsonnet'; +local logslib = import 'logs-lib/logs/main.libsonnet'; { local root = self, @@ -7,55 +8,71 @@ local commonlib = import 'common-lib/common/main.libsonnet'; local prefix = this.config.dashboardNamePrefix; local links = this.grafana.links; local tags = this.config.dashboardTags; - local uid = this.config.uid; - local vars = commonlib.variables.new( - filteringSelector=this.config.filteringSelector, - groupLabels=this.config.groupLabels, - instanceLabels=this.config.instanceLabels, - varMetric='squid_server_http_requests_total', - customAllValue='.+', - enableLokiLogs=this.config.enableLokiLogs, - ); - local annotations = {}; + local uid = g.util.string.slugify(this.config.uid); + local vars = this.grafana.variables; + local annotations = this.grafana.annotations; local refresh = this.config.dashboardRefresh; local period = this.config.dashboardPeriod; local timezone = this.config.dashboardTimezone; - + local extraLogLabels = this.config.extraLogLabels; { 'squid-overview.json': g.dashboard.new(prefix + ' overview') + g.dashboard.withDescription('') + g.dashboard.withPanels( g.util.panel.resolveCollapsedFlagOnRows( - g.util.grid.wrapPanels( - [ + g.util.grid.wrapPanels([ this.grafana.rows.clientRow, this.grafana.rows.serverRow, - ] - + - if this.config.enableLokiLogs then - [this.grafana.rows.logsRow] - else - [] - ) + ]) ) ) + root.applyCommon( vars.multiInstance, uid + '-overview', tags, - links, + links {squidOverview+:: {} }, annotations, timezone, refresh, period ), - }, + } + if this.config.enableLokiLogs then { + 'squid-logs.json': + logslib.new( + this.config.dashboardNamePrefix + ' logs', + datasourceName=this.grafana.variables.datasources.loki.name, + datasourceRegex=this.grafana.variables.datasources.loki.regex, + filterSelector=this.config.filteringSelector, + labels=this.config.groupLabels + this.config.extraLogLabels, + formatParser=null, + showLogsVolume=this.config.showLogsVolume, + ) + { + dashboards+: + { + logs+: + root.applyCommon(super.logs.templating.list, uid=uid + '-logs', tags=tags, links=links { logs+:: {} }, annotations=annotations, timezone=timezone, refresh=refresh, period=period), + }, + panels+: + { + logs+: + g.panel.logs.options.withEnableLogDetails(true) + + g.panel.logs.options.withShowTime(false) + + g.panel.logs.options.withWrapLogMessage(false), + }, + variables+: { + toArray+: [ + this.grafana.variables.datasources.prometheus { hide: 2 }, + ], + }, + }.dashboards.logs, + } else {}, applyCommon(vars, uid, tags, links, annotations, timezone, refresh, period): g.dashboard.withTags(tags) + g.dashboard.withUid(uid) - + g.dashboard.withLinks([links[key].asDashboardLink() for key in std.objectFields(links)]) + + g.dashboard.withLinks(std.objectValues(links)) + g.dashboard.withTimezone(timezone) + g.dashboard.withRefresh(refresh) + g.dashboard.time.withFrom(period) diff --git a/squid-mixin/dashboards_out/squid-logs.json b/squid-mixin/dashboards_out/squid-logs.json new file mode 100644 index 000000000..5082f7692 --- /dev/null +++ b/squid-mixin/dashboards_out/squid-logs.json @@ -0,0 +1,305 @@ +{ + "annotations": { + "list": [ ] + }, + "editable": false, + "id": null, + "links": [ + { + "keepTime": true, + "title": "Squid overview", + "type": "link", + "url": "/d/squid-overview" + } + ], + "panels": [ + { + "datasource": { + "type": "loki", + "uid": "${loki_datasource}" + }, + "description": "Logs volume grouped by \"level\" label.", + "fieldConfig": { + "defaults": { + "custom": { + "drawStyle": "bars", + "fillOpacity": 50, + "stacking": { + "mode": "normal" + } + }, + "unit": "none" + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "(E|e)merg|(F|f)atal|(A|a)lert|(C|c)rit.*" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "purple", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "(E|e)(rr.*|RR.*)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "red", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "(W|w)(arn.*|ARN.*|rn|RN)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "orange", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "(N|n)(otice|ote)|(I|i)(nf.*|NF.*)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "green", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "dbg.*|DBG.*|(D|d)(EBUG|ebug)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "(T|t)(race|RACE)" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "light-blue", + "mode": "fixed" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": "logs" + }, + "properties": [ + { + "id": "color", + "value": { + "fixedColor": "text", + "mode": "fixed" + } + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 1, + "maxDataPoints": 100, + "options": { + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "pluginVersion": "v11.0.0", + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "${loki_datasource}" + }, + "expr": "sum by (level) (count_over_time({job=\"integrations/squid\",job=~\"$job\",level=~\"$level\",severity=~\"$severity\"}\n|~ \"$regex_search\"\n\n[$__auto]))\n", + "legendFormat": "{{ level }}" + } + ], + "title": "Logs volume", + "transformations": [ + { + "id": "renameByRegex", + "options": { + "regex": "Value", + "renamePattern": "logs" + } + } + ], + "type": "timeseries" + }, + { + "datasource": { + "type": "datasource", + "uid": "-- Mixed --" + }, + "gridPos": { + "h": 18, + "w": 24, + "x": 0, + "y": 18 + }, + "id": 2, + "options": { + "dedupStrategy": "exact", + "enableLogDetails": true, + "prettifyLogMessage": true, + "showTime": false, + "wrapLogMessage": false + }, + "pluginVersion": "v11.0.0", + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "${loki_datasource}" + }, + "expr": "{job=\"integrations/squid\",job=~\"$job\",level=~\"$level\",severity=~\"$severity\"} \n|~ \"$regex_search\"\n\n\n" + } + ], + "title": "Logs", + "type": "logs" + } + ], + "refresh": "30s", + "schemaVersion": 39, + "tags": [ + "squid" + ], + "templating": { + "list": [ + { + "label": "Loki data source", + "name": "loki_datasource", + "query": "loki", + "regex": "(?!grafanacloud.+usage-insights|grafanacloud.+alert-state-history).+", + "type": "datasource" + }, + { + "allValue": ".*", + "datasource": { + "type": "loki", + "uid": "${loki_datasource}" + }, + "includeAll": true, + "label": "Job", + "multi": true, + "name": "job", + "query": "label_values({job=\"integrations/squid\"}, job)", + "refresh": 2, + "sort": 1, + "type": "query" + }, + { + "allValue": ".*", + "datasource": { + "type": "loki", + "uid": "${loki_datasource}" + }, + "includeAll": true, + "label": "Level", + "multi": true, + "name": "level", + "query": "label_values({job=\"integrations/squid\",job=~\"$job\"}, level)", + "refresh": 2, + "sort": 1, + "type": "query" + }, + { + "allValue": ".*", + "datasource": { + "type": "loki", + "uid": "${loki_datasource}" + }, + "includeAll": true, + "label": "Severity", + "multi": true, + "name": "severity", + "query": "label_values({job=\"integrations/squid\",job=~\"$job\",level=~\"$level\"}, severity)", + "refresh": 2, + "sort": 1, + "type": "query" + }, + { + "current": { + "selected": false, + "text": "", + "value": "" + }, + "label": "Regex search", + "name": "regex_search", + "options": [ + { + "selected": true, + "text": "", + "value": "" + } + ], + "query": "", + "type": "textbox" + }, + { + "hide": 2, + "label": "Prometheus data source", + "name": "prometheus_datasource", + "query": "prometheus", + "regex": "(?!grafanacloud-usage|grafanacloud-ml-metrics).+", + "type": "datasource" + } + ] + }, + "time": { + "from": "now-30m", + "to": "now" + }, + "timezone": "default", + "title": "Squid logs", + "uid": "squid-logs" + } \ No newline at end of file diff --git a/squid-mixin/dashboards_out/squid-overview.json b/squid-mixin/dashboards_out/squid-overview.json index f830da3e0..5af6e3ce2 100644 --- a/squid-mixin/dashboards_out/squid-overview.json +++ b/squid-mixin/dashboards_out/squid-overview.json @@ -3,12 +3,14 @@ "list": [ ] }, "description": "", + "editable": false, + "id": null, "links": [ { "keepTime": true, - "title": "Squid overview", + "title": "Squid logs", "type": "link", - "url": "/d/squid-overview" + "url": "/d/squid-logs" } ], "panels": [ @@ -48,11 +50,13 @@ { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "avg by (job,instance) (\n rate(squid_client_http_requests_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", + "expr": "rate(squid_client_http_requests_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "{{instance}}", "refId": "Client HTTP requests" } @@ -83,11 +87,13 @@ { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "avg by (job,instance) (\n rate(squid_client_http_errors_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", + "expr": "rate(squid_client_http_errors_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "{{instance}}", "refId": "Client HTTP errors" } @@ -118,11 +124,13 @@ { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "(rate(squid_client_http_hits_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval]) / clamp_min(rate(squid_client_http_requests_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval]),1)) * 100", + "expr": "(rate(squid_client_http_hits_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval]) / clamp_min(rate(squid_client_http_requests_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval]),1)) * 100", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "{{instance}}", "refId": "Client cache hit ratio" } @@ -153,11 +161,13 @@ { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "avg by (job,instance) (\n rate(squid_client_http_kbytes_out_kbytes_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", + "expr": "rate(squid_client_http_kbytes_out_kbytes_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "{{instance}}", "refId": "Client HTTP sent throughput" } @@ -188,11 +198,13 @@ { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "avg by (job,instance) (\n rate(squid_client_http_kbytes_in_kbytes_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", + "expr": "rate(squid_client_http_kbytes_in_kbytes_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "{{instance}}", "refId": "Client HTTP received throughput" } @@ -223,11 +235,13 @@ { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "avg by (job,instance) (\n rate(squid_client_http_hit_kbytes_out_bytes_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", + "expr": "rate(squid_client_http_hit_kbytes_out_bytes_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "{{instance}}", "refId": "Client cache hit throughput" } @@ -258,9 +272,9 @@ { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "squid_HTTP_Requests_All_50{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_HTTP_Requests_All_50{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", "instant": false, "legendFormat": "50%", @@ -269,9 +283,9 @@ { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "squid_HTTP_Requests_All_75{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_HTTP_Requests_All_75{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", "instant": false, "legendFormat": "75%", @@ -280,9 +294,9 @@ { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "squid_HTTP_Requests_All_95{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_HTTP_Requests_All_95{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", "instant": false, "legendFormat": "95%", @@ -315,33 +329,36 @@ { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "squid_Cache_Hits_50{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_Cache_Hits_50{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", "instant": false, + "intervalFactor": 2, "legendFormat": "50%", "refId": "Cache hits service time p50" }, { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "squid_Cache_Hits_75{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_Cache_Hits_75{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", "instant": false, + "intervalFactor": 2, "legendFormat": "75%", "refId": "Cache hits service time p75" }, { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "squid_Cache_Hits_95{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_Cache_Hits_95{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", "instant": false, + "intervalFactor": 2, "legendFormat": "95%", "refId": "Cache hits service time p95" } @@ -372,33 +389,36 @@ { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "squid_Cache_Misses_50{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_Cache_Nisses_50{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", "instant": false, + "intervalFactor": 2, "legendFormat": "50%", "refId": "Cache misses service time p50" }, { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "squid_Cache_Misses_75{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_Cache_Misses_75{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", "instant": false, + "intervalFactor": 2, "legendFormat": "75%", "refId": "Cache misses service time p75" }, { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "squid_Cache_Misses_95{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_Cache_Misses_95{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", "instant": false, + "intervalFactor": 2, "legendFormat": "95%", "refId": "Cache misses service time p95" } @@ -447,33 +467,39 @@ { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "avg by (job,instance) (\n rate(squid_server_ftp_requests_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", + "expr": "rate(squid_server_ftp_requests_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "FTP", "refId": "Server FTP requests" }, { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "avg by (job,instance) (\n rate(squid_server_http_requests_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", + "expr": "rate(squid_server_http_requests_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "HTTP", "refId": "Server HTTP requests" }, { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "avg by (job,instance) (\n rate(squid_server_other_requests_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", + "expr": "rate(squid_server_other_requests_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "other", "refId": "Server other requests" } @@ -509,9 +535,9 @@ { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "avg by (job,instance) (\n rate(squid_server_ftp_errors_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", + "expr": "rate(squid_server_ftp_errors_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "legendFormat": "FTP", @@ -520,9 +546,9 @@ { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "avg by (job,instance) (\n rate(squid_server_http_errors_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", + "expr": "rate(squid_server_http_errors_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "legendFormat": "HTTP", @@ -531,9 +557,9 @@ { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "avg by (job,instance) (\n rate(squid_server_other_errors_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", + "expr": "rate(squid_server_other_errors_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "legendFormat": "other", @@ -571,33 +597,39 @@ { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "avg by (job,instance) (\n rate(squid_server_ftp_kbytes_out_kbytes_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", + "expr": "rate(squid_server_ftp_kbytes_out_kbytes_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "FTP", "refId": "Server FTP sent throughput" }, { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "avg by (job,instance) (\n rate(squid_server_http_kbytes_out_kbytes_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", + "expr": "rate(squid_server_http_kbytes_out_kbytes_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "HTTP", "refId": "Server HTTP sent throughput" }, { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "avg by (job,instance) (\n rate(squid_server_other_kbytes_out_kbytes_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", + "expr": "rate(squid_server_other_kbytes_out_kbytes_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "other", "refId": "Server other sent throughput" } @@ -633,22 +665,26 @@ { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "avg by (job,instance) (\n rate(squid_swap_ins_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", + "expr": "rate(squid_swap_ins_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "{{instance}} - read", "refId": "Server object swap ins" }, { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "avg by (job,instance) (\n rate(squid_swap_outs_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", + "expr": "rate(squid_swap_outs_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "{{instance}} - saved", "refId": "Server object swap outs" } @@ -684,33 +720,36 @@ { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "squid_DNS_Lookups_50{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_DNS_Lookups_50{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", "instant": false, + "intervalFactor": 2, "legendFormat": "50%", "refId": "DNS lookup service time p50" }, { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "squid_DNS_Lookups_75{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_DNS_Lookups_75{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", "instant": false, + "intervalFactor": 2, "legendFormat": "75%", "refId": "DNS lookup service time p75" }, { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "squid_DNS_Lookups_95{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_DNS_Lookups_95{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", "format": "time_series", "instant": false, + "intervalFactor": 2, "legendFormat": "95%", "refId": "DNS lookup service time p95" } @@ -746,119 +785,48 @@ { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "avg by (job,instance) (\n rate(squid_server_ftp_kbytes_in_kbytes_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", + "expr": "rate(squid_server_ftp_kbytes_in_kbytes_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "FTP", "refId": "Server FTP received throughput" }, { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "avg by (job,instance) (\n rate(squid_server_http_kbytes_in_kbytes_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", + "expr": "rate(squid_server_http_kbytes_in_kbytes_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "HTTP", "refId": "Server HTTP received throughput" }, { "datasource": { "type": "prometheus", - "uid": "${datasource}" + "uid": "${prometheus_datasource}" }, - "expr": "avg by (job,instance) (\n rate(squid_server_other_kbytes_in_kbytes_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])\n)", + "expr": "rate(squid_server_other_kbytes_in_kbytes_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "other", "refId": "Server other received throughput" } ], "title": "Server received throughput", "type": "timeseries" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 0, - "x": 0, - "y": 40 - }, - "id": 18, - "panels": [ ], - "title": "Logs", - "type": "row" - }, - { - "datasource": { - "type": "datasource", - "uid": "-- Mixed --" - }, - "description": "The log file that contains the debug and error messages that Squid generates.", - "gridPos": { - "h": 6, - "w": 24, - "x": 0, - "y": 41 - }, - "id": 19, - "options": { - "enableLogDetails": true, - "showCommonLabels": false, - "showTime": false, - "wrapLogMessage": false - }, - "pluginVersion": "v11.0.0", - "targets": [ - { - "datasource": { - "type": "loki", - "uid": "${loki_datasource}" - }, - "expr": "{job=~\"$job\", instance=~\"$instance\"} |= `` | (filename=\"/var/log/squid/cache.log\" or log_type=\"cache\")" - } - ], - "title": "Cache logs", - "type": "logs" - }, - { - "datasource": { - "type": "datasource", - "uid": "-- Mixed --" - }, - "description": "The log file that contains a record of all HTTP requests and responses processed by the Squid proxy server.", - "gridPos": { - "h": 6, - "w": 24, - "x": 0, - "y": 47 - }, - "id": 20, - "options": { - "enableLogDetails": true, - "showCommonLabels": false, - "showTime": false, - "wrapLogMessage": false - }, - "pluginVersion": "v11.0.0", - "targets": [ - { - "datasource": { - "type": "loki", - "uid": "${loki_datasource}" - }, - "expr": "{job=~\"$job\", instance=~\"$instance\"} |= `` | (filename=\"/var/log/squid/access.log\" or log_type=\"access\")" - } - ], - "title": "Access logs", - "type": "logs" } ], - "refresh": "1m", + "refresh": "30s", "schemaVersion": 39, "tags": [ "squid" @@ -869,7 +837,7 @@ "label": "Prometheus data source", "name": "prometheus_datasource", "query": "prometheus", - "regex": "", + "regex": "(?!grafanacloud-usage|grafanacloud-ml-metrics).+", "type": "datasource" }, { @@ -882,7 +850,7 @@ "label": "Job", "multi": true, "name": "job", - "query": "label_values(squid_server_http_requests_total{job=~\"$job\", instance=~\"$instance\"}, job)", + "query": "label_values(squid_client_http_requests_total{job=\"integrations/squid\"}, job)", "refresh": 2, "sort": 1, "type": "query" @@ -897,7 +865,7 @@ "label": "Instance", "multi": true, "name": "instance", - "query": "label_values(squid_server_http_requests_total{job=~\"$job\", instance=~\"$instance\",job=~\"$job\"}, instance)", + "query": "label_values(squid_client_http_requests_total{job=\"integrations/squid\",job=~\"$job\"}, instance)", "refresh": 2, "sort": 1, "type": "query" @@ -907,13 +875,13 @@ "label": "Loki data source", "name": "loki_datasource", "query": "loki", - "regex": "", + "regex": "(?!grafanacloud.+usage-insights|grafanacloud.+alert-state-history).+", "type": "datasource" } ] }, "time": { - "from": "now-1h", + "from": "now-30m", "to": "now" }, "timezone": "default", diff --git a/squid-mixin/jsonnetfile.json b/squid-mixin/jsonnetfile.json index 46d5af011..6354d0e12 100644 --- a/squid-mixin/jsonnetfile.json +++ b/squid-mixin/jsonnetfile.json @@ -1,24 +1,42 @@ { "version": 1, "dependencies": [ - { - "source": { - "git": { - "remote": "https://github.com/grafana/grafonnet", - "subdir": "gen/grafonnet-v11.0.0" - } + { + "source": { + "git": { + "remote": "https://github.com/grafana/grafonnet-lib.git", + "subdir": "grafonnet" + } + }, + "version": "master" }, - "version": "main" - }, - { - "source": { - "git": { - "remote": "https://github.com/grafana/jsonnet-libs.git", - "subdir": "common-lib" - } + { + "source": { + "git": { + "remote": "https://github.com/grafana/jsonnet-libs.git", + "subdir": "common-lib" + } + }, + "version": "master" }, - "version": "master" - } + { + "source": { + "git": { + "remote": "https://github.com/grafana/jsonnet-libs.git", + "subdir": "grafana-cloud-integration-utils" + } + }, + "version": "master" + }, + { + "source": { + "git": { + "remote": "https://github.com/grafana/jsonnet-libs.git", + "subdir": "logs-lib" + } + }, + "version": "master" + } ], "legacyImports": true } diff --git a/squid-mixin/links.libsonnet b/squid-mixin/links.libsonnet index e76731e0b..4d8adc365 100644 --- a/squid-mixin/links.libsonnet +++ b/squid-mixin/links.libsonnet @@ -1,13 +1,17 @@ local g = import './g.libsonnet'; -local commonlib = import 'common-lib/common/main.libsonnet'; { + local link = g.dashboard.link, new(this): { - overview: { - asString(): '/d/' + this.config.uid + '-overview', - asDashboardLink(): g.dashboard.link.link.new('Squid overview', self.asString()) - + g.dashboard.link.link.options.withKeepTime(true), - }, - }, + squidOverview: + link.link.new('Squid overview', '/d/' + this.grafana.dashboards['squid-overview.json'].uid) + + link.link.options.withKeepTime(true), + } + if this.config.enableLokiLogs then + { + logs: + link.link.new('Squid logs', '/d/' + this.grafana.dashboards['squid-logs.json'].uid) + + link.link.options.withKeepTime(true), + } + else {}, } diff --git a/squid-mixin/main.libsonnet b/squid-mixin/main.libsonnet index 3e547d8bf..dcc3da60c 100644 --- a/squid-mixin/main.libsonnet +++ b/squid-mixin/main.libsonnet @@ -8,6 +8,10 @@ local rows = import './rows.libsonnet'; local commonlib = import 'common-lib/common/main.libsonnet'; { + withConfigMixin(config): { + config+: config, + }, + new(): { local this = self, config: config, @@ -22,18 +26,24 @@ local commonlib = import 'common-lib/common/main.libsonnet'; }, grafana: { + variables: commonlib.variables.new( + filteringSelector=this.config.filteringSelector, + groupLabels=this.config.groupLabels, + instanceLabels=this.config.instanceLabels, + varMetric='squid_client_http_requests_total', + customAllValue='.+', + enableLokiLogs=this.config.enableLokiLogs, + ), + annotations: {}, links: links.new(this), panels: panels.new(this), - rows: rows.new(this), dashboards: dashboards.new(this), + rows: rows.new(this), }, prometheus: { alerts: alerts.new(this), + recordingRules: {}, }, }, - - withConfigMixin(config): { - config+: config, - }, } diff --git a/squid-mixin/mixin.libsonnet b/squid-mixin/mixin.libsonnet index fb91408d7..287a5b7dd 100644 --- a/squid-mixin/mixin.libsonnet +++ b/squid-mixin/mixin.libsonnet @@ -1,15 +1,25 @@ -local lib = import './main.libsonnet'; +local mixinlib = import './main.libsonnet'; +local config = (import './config.libsonnet'); +local util = import 'grafana-cloud-integration-utils/util.libsonnet'; -local squid = - lib.new() - + lib.withConfigMixin({ - // Override defaults if needed - }); + +local mixin = mixinlib.new() + + mixinlib.withConfigMixin( + { + filteringSelector: config.filteringSelector, + uid: config.uid, + enableLokiLogs: true, + } + ); { - grafanaDashboards+:: squid.grafana.dashboards, - prometheusAlerts+:: squid.prometheus.alerts, - prometheusRules+:: { - groups+: [], + grafanaDashboards+:: { + [fname]: + local dashboard = util.decorate_dashboard(mixin.grafana.dashboards[fname], tags=config.dashboardTags); + dashboard + + for fname in std.objectFields(mixin.grafana.dashboards) }, + prometheusAlerts+:: mixin.prometheus.alerts, + prometheusRules+:: mixin.prometheus.recordingRules, } diff --git a/squid-mixin/panels.libsonnet b/squid-mixin/panels.libsonnet index f16520baf..b838a507a 100644 --- a/squid-mixin/panels.libsonnet +++ b/squid-mixin/panels.libsonnet @@ -11,7 +11,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Client requests') + g.panel.timeSeries.panelOptions.withDescription('The request rate of client.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.httpRequests.asTarget(), + signals.client.clientHTTPRequests.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), ]) + g.panel.timeSeries.standardOptions.withUnit('reqps'), @@ -19,7 +21,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Client request errors') + g.panel.timeSeries.panelOptions.withDescription('The number of client HTTP errors.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.httpErrors.asTarget(), + signals.client.clientHTTPErrors.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), ]) + g.panel.timeSeries.standardOptions.withUnit('errors/s'), @@ -27,7 +31,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Client cache hit ratio') + g.panel.timeSeries.panelOptions.withDescription('The client cache hit ratio.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.cacheHitRatio.asTarget(), + signals.client.clientCacheHitRatio.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), ]) + g.panel.timeSeries.standardOptions.withUnit('percent'), @@ -35,7 +41,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Client request sent throughput') + g.panel.timeSeries.panelOptions.withDescription('The throughput of client HTTP data sent.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.httpSentThroughput.asTarget(), + signals.client.clientHTTPSentThroughput.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), ]) + g.panel.timeSeries.standardOptions.withUnit('KBs'), @@ -43,7 +51,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Client HTTP received throughput') + g.panel.timeSeries.panelOptions.withDescription('The throughput of client HTTP data received.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.httpReceivedThroughput.asTarget(), + signals.client.clientHTTPReceivedThroughput.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), ]) + g.panel.timeSeries.standardOptions.withUnit('KBs'), @@ -51,7 +61,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Client cache hit throughput') + g.panel.timeSeries.panelOptions.withDescription('The throughput of client cache hit.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.cacheHitThroughput.asTarget(), + signals.client.clientCacheHitThroughput.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), ]) + g.panel.timeSeries.standardOptions.withUnit('KBs'), @@ -59,9 +71,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('HTTP request service time') + g.panel.timeSeries.panelOptions.withDescription('HTTP request service time percentiles.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.serviceTime.httpRequestsAll50.asTarget(), - signals.serviceTime.httpRequestsAll75.asTarget(), - signals.serviceTime.httpRequestsAll95.asTarget(), + signals.client.httpRequestsAll50.asTarget(), + signals.client.httpRequestsAll75.asTarget(), + signals.client.httpRequestsAll95.asTarget(), ]) + g.panel.timeSeries.standardOptions.withUnit('s'), @@ -69,9 +81,12 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Cache hit service time') + g.panel.timeSeries.panelOptions.withDescription('Cache hits service time percentiles.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.serviceTime.cacheHits50.asTarget(), - signals.serviceTime.cacheHits75.asTarget(), - signals.serviceTime.cacheHits95.asTarget(), + signals.client.cacheHits50.asTarget() + + g.query.prometheus.withIntervalFactor(2), + signals.client.cacheHits75.asTarget() + + g.query.prometheus.withIntervalFactor(2), + signals.client.cacheHits95.asTarget() + + g.query.prometheus.withIntervalFactor(2), ]) + g.panel.timeSeries.standardOptions.withUnit('s'), @@ -79,9 +94,12 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Cache misses service time') + g.panel.timeSeries.panelOptions.withDescription('Cache misses service time percentiles.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.serviceTime.cacheMisses50.asTarget(), - signals.serviceTime.cacheMisses75.asTarget(), - signals.serviceTime.cacheMisses95.asTarget(), + signals.client.cacheMisses50.asTarget() + + g.query.prometheus.withIntervalFactor(2), + signals.client.cacheMisses75.asTarget() + + g.query.prometheus.withIntervalFactor(2), + signals.client.cacheMisses95.asTarget() + + g.query.prometheus.withIntervalFactor(2), ]) + g.panel.timeSeries.standardOptions.withUnit('s'), @@ -90,9 +108,15 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Server requests') + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server requests.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.server.ftpRequests.asTarget(), - signals.server.httpRequests.asTarget(), - signals.server.otherRequests.asTarget(), + signals.client.serverFTPRequests.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), + signals.client.serverHTTPRequests.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), + signals.client.serverOtherRequests.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), ]) + g.panel.timeSeries.standardOptions.withUnit('reqps') + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), @@ -101,9 +125,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Server request errors') + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server request errors.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.server.ftpErrors.asTarget(), - signals.server.httpErrors.asTarget(), - signals.server.otherErrors.asTarget(), + signals.client.serverFTPErrors.asTarget(), + signals.client.serverHTTPErrors.asTarget(), + signals.client.serverOtherErrors.asTarget(), ]) + g.panel.timeSeries.standardOptions.withUnit('errors/s') + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), @@ -112,9 +136,15 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Server request sent throughput') + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server sent throughput.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.server.ftpSentThroughput.asTarget(), - signals.server.httpSentThroughput.asTarget(), - signals.server.otherSentThroughput.asTarget(), + signals.client.serverFTPSentThroughput.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), + signals.client.serverHTTPSentThroughput.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), + signals.client.serverOtherSentThroughput.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), ]) + g.panel.timeSeries.standardOptions.withUnit('KBs') + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), @@ -123,8 +153,12 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Server object swap') + g.panel.timeSeries.panelOptions.withDescription('The number of objects read from disk and the number of objects saved to disk.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.server.swapIns.asTarget(), - signals.server.swapOuts.asTarget(), + signals.client.swapIns.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), + signals.client.swapOuts.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), ]) + g.panel.timeSeries.standardOptions.withUnit('cps') + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), @@ -133,9 +167,12 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('DNS lookup service time') + g.panel.timeSeries.panelOptions.withDescription('DNS lookup service time percentiles') + g.panel.timeSeries.queryOptions.withTargets([ - signals.serviceTime.dnsLookups50.asTarget(), - signals.serviceTime.dnsLookups75.asTarget(), - signals.serviceTime.dnsLookups95.asTarget(), + signals.client.dnsLookups50.asTarget() + + g.query.prometheus.withIntervalFactor(2), + signals.client.dnsLookups75.asTarget() + + g.query.prometheus.withIntervalFactor(2), + signals.client.dnsLookups95.asTarget() + + g.query.prometheus.withIntervalFactor(2), ]) + g.panel.timeSeries.standardOptions.withUnit('s') + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), @@ -144,40 +181,46 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Server received throughput') + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server throughput.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.server.ftpReceivedThroughput.asTarget(), - signals.server.httpReceivedThroughput.asTarget(), - signals.server.otherReceivedThroughput.asTarget(), + signals.client.serverFTPReceivedThroughput.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), + signals.client.serverHTTPReceivedThroughput.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), + signals.client.serverOtherReceivedThroughput.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), ]) + g.panel.timeSeries.standardOptions.withUnit('KBs') + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), // Logs panels - cacheLogs: - g.panel.logs.new('Cache logs') - + g.panel.logs.panelOptions.withDescription('The log file that contains the debug and error messages that Squid generates.') - + g.panel.logs.queryOptions.withTargets([ - g.query.loki.new( - '${loki_datasource}', - '{' + this.config.filteringSelector + '} |= `` | (filename="/var/log/squid/cache.log" or log_type="cache")' - ), - ]) - + g.panel.logs.options.withEnableLogDetails(true) - + g.panel.logs.options.withShowCommonLabels(false) - + g.panel.logs.options.withShowTime(false) - + g.panel.logs.options.withWrapLogMessage(false), - - accessLogs: - g.panel.logs.new('Access logs') - + g.panel.logs.panelOptions.withDescription('The log file that contains a record of all HTTP requests and responses processed by the Squid proxy server.') - + g.panel.logs.queryOptions.withTargets([ - g.query.loki.new( - '${loki_datasource}', - '{' + this.config.filteringSelector + '} |= `` | (filename="/var/log/squid/access.log" or log_type="access")' - ), - ]) - + g.panel.logs.options.withEnableLogDetails(true) - + g.panel.logs.options.withShowCommonLabels(false) - + g.panel.logs.options.withShowTime(false) - + g.panel.logs.options.withWrapLogMessage(false), + // cacheLogs: + // g.panel.logs.new('Cache logs') + // + g.panel.logs.panelOptions.withDescription('The log file that contains the debug and error messages that Squid generates.') + // + g.panel.logs.queryOptions.withTargets([ + // g.query.loki.new( + // '${loki_datasource}', + // '{' + this.config.filteringSelector + '} |= `` | (filename="/var/log/squid/cache.log" or log_type="cache")' + // ), + // ]) + // + g.panel.logs.options.withEnableLogDetails(true) + // + g.panel.logs.options.withShowCommonLabels(false) + // + g.panel.logs.options.withShowTime(false) + // + g.panel.logs.options.withWrapLogMessage(false), + + // accessLogs: + // g.panel.logs.new('Access logs') + // + g.panel.logs.panelOptions.withDescription('The log file that contains a record of all HTTP requests and responses processed by the Squid proxy server.') + // + g.panel.logs.queryOptions.withTargets([ + // g.query.loki.new( + // '${loki_datasource}', + // '{' + this.config.filteringSelector + '} |= `` | (filename="/var/log/squid/access.log" or log_type="access")' + // ), + // ]) + // + g.panel.logs.options.withEnableLogDetails(true) + // + g.panel.logs.options.withShowCommonLabels(false) + // + g.panel.logs.options.withShowTime(false) + // + g.panel.logs.options.withWrapLogMessage(false), }, } diff --git a/squid-mixin/signals/client.libsonnet b/squid-mixin/signals/client.libsonnet index 41658646b..3186dadcd 100644 --- a/squid-mixin/signals/client.libsonnet +++ b/squid-mixin/signals/client.libsonnet @@ -3,11 +3,17 @@ function(this) filteringSelector: this.filteringSelector, groupLabels: this.groupLabels, instanceLabels: this.instanceLabels, - aggLevel: 'instance', + enableLokiLogs: this.enableLokiLogs, + aggLevel: 'none', aggFunction: 'avg', + alertsInterval: '5m', + discoveryMetric: { + prometheus: 'squid_client_http_requests_total', + }, + signals: { - httpRequests: { + clientHTTPRequests: { name: 'Client HTTP requests', type: 'counter', unit: 'reqps', @@ -20,7 +26,7 @@ function(this) }, }, - httpErrors: { + clientHTTPErrors: { name: 'Client HTTP errors', type: 'counter', unit: 'errors/s', @@ -33,20 +39,7 @@ function(this) }, }, - httpHits: { - name: 'Client HTTP cache hits', - type: 'counter', - unit: 'ops', - description: 'The number of client cache hits.', - sources: { - prometheus: { - expr: 'squid_client_http_hits_total{%(queriesSelector)s}', - legendCustomTemplate: '{{instance}}', - }, - }, - }, - - cacheHitRatio: { + clientCacheHitRatio: { name: 'Client cache hit ratio', type: 'raw', unit: 'percent', @@ -59,7 +52,7 @@ function(this) }, }, - httpSentThroughput: { + clientHTTPSentThroughput: { name: 'Client HTTP sent throughput', type: 'counter', unit: 'KBs', @@ -72,7 +65,7 @@ function(this) }, }, - httpReceivedThroughput: { + clientHTTPReceivedThroughput: { name: 'Client HTTP received throughput', type: 'counter', unit: 'KBs', @@ -85,7 +78,7 @@ function(this) }, }, - cacheHitThroughput: { + clientCacheHitThroughput: { name: 'Client cache hit throughput', type: 'counter', unit: 'KBs', @@ -97,5 +90,347 @@ function(this) }, }, }, + + serverFTPRequests: { + name: 'Server FTP requests', + type: 'counter', + unit: 'reqps', + description: 'The number of FTP server requests.', + sources: { + prometheus: { + expr: 'squid_server_ftp_requests_total{%(queriesSelector)s}', + legendCustomTemplate: 'FTP', + }, + }, + }, + + serverHTTPRequests: { + name: 'Server HTTP requests', + type: 'counter', + unit: 'reqps', + description: 'The number of HTTP server requests.', + sources: { + prometheus: { + expr: 'squid_server_http_requests_total{%(queriesSelector)s}', + legendCustomTemplate: 'HTTP', + }, + }, + }, + + serverOtherRequests: { + name: 'Server other requests', + type: 'counter', + unit: 'reqps', + description: 'The number of other server requests.', + sources: { + prometheus: { + expr: 'squid_server_other_requests_total{%(queriesSelector)s}', + legendCustomTemplate: 'other', + }, + }, + }, + + serverFTPErrors: { + name: 'Server FTP errors', + type: 'counter', + unit: 'errors/s', + description: 'The number of FTP server request errors.', + sources: { + prometheus: { + expr: 'squid_server_ftp_errors_total{%(queriesSelector)s}', + legendCustomTemplate: 'FTP', + }, + }, + }, + + serverHTTPErrors: { + name: 'Server HTTP errors', + type: 'counter', + unit: 'errors/s', + description: 'The number of HTTP server request errors.', + sources: { + prometheus: { + expr: 'squid_server_http_errors_total{%(queriesSelector)s}', + legendCustomTemplate: 'HTTP', + }, + }, + }, + + serverOtherErrors: { + name: 'Server other errors', + type: 'counter', + unit: 'errors/s', + description: 'The number of other server request errors.', + sources: { + prometheus: { + expr: 'squid_server_other_errors_total{%(queriesSelector)s}', + legendCustomTemplate: 'other', + }, + }, + }, + + serverFTPSentThroughput: { + name: 'Server FTP sent throughput', + type: 'counter', + unit: 'KBs', + description: 'The throughput of FTP server data sent.', + sources: { + prometheus: { + expr: 'squid_server_ftp_kbytes_out_kbytes_total{%(queriesSelector)s}', + legendCustomTemplate: 'FTP', + }, + }, + }, + + serverHTTPSentThroughput: { + name: 'Server HTTP sent throughput', + type: 'counter', + unit: 'KBs', + description: 'The throughput of HTTP server data sent.', + sources: { + prometheus: { + expr: 'squid_server_http_kbytes_out_kbytes_total{%(queriesSelector)s}', + legendCustomTemplate: 'HTTP', + }, + }, + }, + + serverOtherSentThroughput: { + name: 'Server other sent throughput', + type: 'counter', + unit: 'KBs', + description: 'The throughput of other server data sent.', + sources: { + prometheus: { + expr: 'squid_server_other_kbytes_out_kbytes_total{%(queriesSelector)s}', + legendCustomTemplate: 'other', + }, + }, + }, + + swapIns: { + name: 'Server object swap ins', + type: 'counter', + unit: 'cps', + description: 'The number of objects read from disk.', + sources: { + prometheus: { + expr: 'squid_swap_ins_total{%(queriesSelector)s}', + legendCustomTemplate: '{{instance}} - read', + }, + }, + }, + + swapOuts: { + name: 'Server object swap outs', + type: 'counter', + unit: 'cps', + description: 'The number of objects saved to disk.', + sources: { + prometheus: { + expr: 'squid_swap_outs_total{%(queriesSelector)s}', + legendCustomTemplate: '{{instance}} - saved', + }, + }, + }, + + serverFTPReceivedThroughput: { + name: 'Server FTP received throughput', + type: 'counter', + unit: 'KBs', + description: 'The throughput of FTP server data received.', + sources: { + prometheus: { + expr: 'squid_server_ftp_kbytes_in_kbytes_total{%(queriesSelector)s}', + legendCustomTemplate: 'FTP', + }, + }, + }, + + serverHTTPReceivedThroughput: { + name: 'Server HTTP received throughput', + type: 'counter', + unit: 'KBs', + description: 'The throughput of HTTP server data received.', + sources: { + prometheus: { + expr: 'squid_server_http_kbytes_in_kbytes_total{%(queriesSelector)s}', + legendCustomTemplate: 'HTTP', + }, + }, + }, + + serverOtherReceivedThroughput: { + name: 'Server other received throughput', + type: 'counter', + unit: 'KBs', + description: 'The throughput of other server data received.', + sources: { + prometheus: { + expr: 'squid_server_other_kbytes_in_kbytes_total{%(queriesSelector)s}', + legendCustomTemplate: 'other', + }, + }, + }, + + // HTTP Request service time percentiles + httpRequestsAll50: { + name: 'HTTP requests service time p50', + type: 'gauge', + unit: 's', + description: 'HTTP request service time 50th percentile.', + sources: { + prometheus: { + expr: 'squid_HTTP_Requests_All_50{%(queriesSelector)s}', + legendCustomTemplate: '50%%', + }, + }, + }, + + httpRequestsAll75: { + name: 'HTTP requests service time p75', + type: 'gauge', + unit: 's', + description: 'HTTP request service time 75th percentile.', + sources: { + prometheus: { + expr: 'squid_HTTP_Requests_All_75{%(queriesSelector)s}', + legendCustomTemplate: '75%%', + }, + }, + }, + + httpRequestsAll95: { + name: 'HTTP requests service time p95', + type: 'gauge', + unit: 's', + description: 'HTTP request service time 95th percentile.', + sources: { + prometheus: { + expr: 'squid_HTTP_Requests_All_95{%(queriesSelector)s}', + legendCustomTemplate: '95%%', + }, + }, + }, + + // Cache hits service time percentiles + cacheHits50: { + name: 'Cache hits service time p50', + type: 'gauge', + unit: 's', + description: 'Cache hits service time 50th percentile.', + sources: { + prometheus: { + expr: 'squid_Cache_Hits_50{%(queriesSelector)s}', + legendCustomTemplate: '50%%', + }, + }, + }, + + cacheHits75: { + name: 'Cache hits service time p75', + type: 'gauge', + unit: 's', + description: 'Cache hits service time 75th percentile.', + sources: { + prometheus: { + expr: 'squid_Cache_Hits_75{%(queriesSelector)s}', + legendCustomTemplate: '75%%', + }, + }, + }, + + cacheHits95: { + name: 'Cache hits service time p95', + type: 'gauge', + unit: 's', + description: 'Cache hits service time 95th percentile.', + sources: { + prometheus: { + expr: 'squid_Cache_Hits_95{%(queriesSelector)s}', + legendCustomTemplate: '95%%', + }, + }, + }, + + // Cache misses service time percentiles + cacheMisses50: { + name: 'Cache misses service time p50', + type: 'gauge', + unit: 's', + description: 'Cache misses service time 50th percentile.', + sources: { + prometheus: { + expr: 'squid_Cache_Nisses_50{%(queriesSelector)s}', + legendCustomTemplate: '50%%', + }, + }, + }, + + cacheMisses75: { + name: 'Cache misses service time p75', + type: 'gauge', + unit: 's', + description: 'Cache misses service time 75th percentile.', + sources: { + prometheus: { + expr: 'squid_Cache_Misses_75{%(queriesSelector)s}', + legendCustomTemplate: '75%%', + }, + }, + }, + + cacheMisses95: { + name: 'Cache misses service time p95', + type: 'gauge', + unit: 's', + description: 'Cache misses service time 95th percentile.', + sources: { + prometheus: { + expr: 'squid_Cache_Misses_95{%(queriesSelector)s}', + legendCustomTemplate: '95%%', + }, + }, + }, + + // DNS lookup service time percentiles + dnsLookups50: { + name: 'DNS lookup service time p50', + type: 'gauge', + unit: 's', + description: 'DNS lookup service time 50th percentile.', + sources: { + prometheus: { + expr: 'squid_DNS_Lookups_50{%(queriesSelector)s}', + legendCustomTemplate: '50%%', + }, + }, + }, + + dnsLookups75: { + name: 'DNS lookup service time p75', + type: 'gauge', + unit: 's', + description: 'DNS lookup service time 75th percentile.', + sources: { + prometheus: { + expr: 'squid_DNS_Lookups_75{%(queriesSelector)s}', + legendCustomTemplate: '75%%', + }, + }, + }, + + dnsLookups95: { + name: 'DNS lookup service time p95', + type: 'gauge', + unit: 's', + description: 'DNS lookup service time 95th percentile.', + sources: { + prometheus: { + expr: 'squid_DNS_Lookups_95{%(queriesSelector)s}', + legendCustomTemplate: '95%%', + }, + }, + }, }, } diff --git a/squid-mixin/signals/service_time.libsonnet b/squid-mixin/signals/service_time.libsonnet index 49f465f03..f454c7a76 100644 --- a/squid-mixin/signals/service_time.libsonnet +++ b/squid-mixin/signals/service_time.libsonnet @@ -15,7 +15,7 @@ function(this) description: 'HTTP request service time 50th percentile.', sources: { prometheus: { - expr: 'squid_HTTP_Requests_All_50{%(queriesSelector)s}', + expr: 'squid_http_requests_all_50{%(queriesSelector)s}', legendCustomTemplate: '50%%', }, }, @@ -28,7 +28,7 @@ function(this) description: 'HTTP request service time 75th percentile.', sources: { prometheus: { - expr: 'squid_HTTP_Requests_All_75{%(queriesSelector)s}', + expr: 'squid_http_requests_all_75{%(queriesSelector)s}', legendCustomTemplate: '75%%', }, }, @@ -41,7 +41,7 @@ function(this) description: 'HTTP request service time 95th percentile.', sources: { prometheus: { - expr: 'squid_HTTP_Requests_All_95{%(queriesSelector)s}', + expr: 'squid_http_requests_all_95{%(queriesSelector)s}', legendCustomTemplate: '95%%', }, }, @@ -55,7 +55,7 @@ function(this) description: 'Cache hits service time 50th percentile.', sources: { prometheus: { - expr: 'squid_Cache_Hits_50{%(queriesSelector)s}', + expr: 'squid_cache_hits_50{%(queriesSelector)s}', legendCustomTemplate: '50%%', }, }, @@ -68,7 +68,7 @@ function(this) description: 'Cache hits service time 75th percentile.', sources: { prometheus: { - expr: 'squid_Cache_Hits_75{%(queriesSelector)s}', + expr: 'squid_cache_hits_75{%(queriesSelector)s}', legendCustomTemplate: '75%%', }, }, @@ -81,7 +81,7 @@ function(this) description: 'Cache hits service time 95th percentile.', sources: { prometheus: { - expr: 'squid_Cache_Hits_95{%(queriesSelector)s}', + expr: 'squid_cache_hits_95{%(queriesSelector)s}', legendCustomTemplate: '95%%', }, }, @@ -95,7 +95,7 @@ function(this) description: 'Cache misses service time 50th percentile.', sources: { prometheus: { - expr: 'squid_Cache_Misses_50{%(queriesSelector)s}', + expr: 'squid_cache_misses_50{%(queriesSelector)s}', legendCustomTemplate: '50%%', }, }, @@ -108,7 +108,7 @@ function(this) description: 'Cache misses service time 75th percentile.', sources: { prometheus: { - expr: 'squid_Cache_Misses_75{%(queriesSelector)s}', + expr: 'squid_cache_misses_75{%(queriesSelector)s}', legendCustomTemplate: '75%%', }, }, @@ -121,7 +121,7 @@ function(this) description: 'Cache misses service time 95th percentile.', sources: { prometheus: { - expr: 'squid_Cache_Misses_95{%(queriesSelector)s}', + expr: 'squid_cache_misses_95{%(queriesSelector)s}', legendCustomTemplate: '95%%', }, }, @@ -135,7 +135,7 @@ function(this) description: 'DNS lookup service time 50th percentile.', sources: { prometheus: { - expr: 'squid_DNS_Lookups_50{%(queriesSelector)s}', + expr: 'squid_dns_lookups_50{%(queriesSelector)s}', legendCustomTemplate: '50%%', }, }, @@ -148,7 +148,7 @@ function(this) description: 'DNS lookup service time 75th percentile.', sources: { prometheus: { - expr: 'squid_DNS_Lookups_75{%(queriesSelector)s}', + expr: 'squid_dns_lookups_75{%(queriesSelector)s}', legendCustomTemplate: '75%%', }, }, @@ -161,7 +161,7 @@ function(this) description: 'DNS lookup service time 95th percentile.', sources: { prometheus: { - expr: 'squid_DNS_Lookups_95{%(queriesSelector)s}', + expr: 'squid_dns_lookups_95{%(queriesSelector)s}', legendCustomTemplate: '95%%', }, }, From 47539a0cf53ffe30cde87069c94c955f158360fa Mon Sep 17 00:00:00 2001 From: Greg Pattison Date: Wed, 19 Nov 2025 07:51:14 -0500 Subject: [PATCH 03/10] Reworked signals to line up with dashboards --- squid-mixin/config.libsonnet | 6 +- squid-mixin/dashboards_out/squid-logs.json | 23 ++- .../dashboards_out/squid-overview.json | 81 +++++--- squid-mixin/g.libsonnet | 4 +- squid-mixin/panels.libsonnet | 93 +++------ .../{client.libsonnet => overview.libsonnet} | 0 squid-mixin/signals/server.libsonnet | 192 ------------------ squid-mixin/signals/service_time.libsonnet | 170 ---------------- 8 files changed, 103 insertions(+), 466 deletions(-) rename squid-mixin/signals/{client.libsonnet => overview.libsonnet} (100%) delete mode 100644 squid-mixin/signals/server.libsonnet delete mode 100644 squid-mixin/signals/service_time.libsonnet diff --git a/squid-mixin/config.libsonnet b/squid-mixin/config.libsonnet index 6e7ad20de..a6eff675e 100644 --- a/squid-mixin/config.libsonnet +++ b/squid-mixin/config.libsonnet @@ -3,8 +3,8 @@ // Basic filtering filteringSelector: 'job="integrations/squid"', - groupLabels: ['job'], - logLabels: ['job', 'instance'], + groupLabels: ['job', 'cluster'], + logLabels: ['job', 'cluster', 'instance'], instanceLabels: ['instance'], // Dashboard settings @@ -28,6 +28,6 @@ // Signal definitions signals: { - client: (import './signals/client.libsonnet')(this), + overview: (import './signals/overview.libsonnet')(this), }, } diff --git a/squid-mixin/dashboards_out/squid-logs.json b/squid-mixin/dashboards_out/squid-logs.json index 5082f7692..891cf00ea 100644 --- a/squid-mixin/dashboards_out/squid-logs.json +++ b/squid-mixin/dashboards_out/squid-logs.json @@ -159,7 +159,7 @@ "type": "loki", "uid": "${loki_datasource}" }, - "expr": "sum by (level) (count_over_time({job=\"integrations/squid\",job=~\"$job\",level=~\"$level\",severity=~\"$severity\"}\n|~ \"$regex_search\"\n\n[$__auto]))\n", + "expr": "sum by (level) (count_over_time({job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",level=~\"$level\",severity=~\"$severity\"}\n|~ \"$regex_search\"\n\n[$__auto]))\n", "legendFormat": "{{ level }}" } ], @@ -201,7 +201,7 @@ "type": "loki", "uid": "${loki_datasource}" }, - "expr": "{job=\"integrations/squid\",job=~\"$job\",level=~\"$level\",severity=~\"$severity\"} \n|~ \"$regex_search\"\n\n\n" + "expr": "{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",level=~\"$level\",severity=~\"$severity\"} \n|~ \"$regex_search\"\n\n\n" } ], "title": "Logs", @@ -237,6 +237,21 @@ "sort": 1, "type": "query" }, + { + "allValue": ".*", + "datasource": { + "type": "loki", + "uid": "${loki_datasource}" + }, + "includeAll": true, + "label": "Cluster", + "multi": true, + "name": "cluster", + "query": "label_values({job=\"integrations/squid\",job=~\"$job\"}, cluster)", + "refresh": 2, + "sort": 1, + "type": "query" + }, { "allValue": ".*", "datasource": { @@ -247,7 +262,7 @@ "label": "Level", "multi": true, "name": "level", - "query": "label_values({job=\"integrations/squid\",job=~\"$job\"}, level)", + "query": "label_values({job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\"}, level)", "refresh": 2, "sort": 1, "type": "query" @@ -262,7 +277,7 @@ "label": "Severity", "multi": true, "name": "severity", - "query": "label_values({job=\"integrations/squid\",job=~\"$job\",level=~\"$level\"}, severity)", + "query": "label_values({job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",level=~\"$level\"}, severity)", "refresh": 2, "sort": 1, "type": "query" diff --git a/squid-mixin/dashboards_out/squid-overview.json b/squid-mixin/dashboards_out/squid-overview.json index 5af6e3ce2..6f0aa6fc7 100644 --- a/squid-mixin/dashboards_out/squid-overview.json +++ b/squid-mixin/dashboards_out/squid-overview.json @@ -52,7 +52,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(squid_client_http_requests_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(squid_client_http_requests_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "interval": "2m", @@ -89,7 +89,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(squid_client_http_errors_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(squid_client_http_errors_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "interval": "2m", @@ -126,7 +126,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "(rate(squid_client_http_hits_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval]) / clamp_min(rate(squid_client_http_requests_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval]),1)) * 100", + "expr": "(rate(squid_client_http_hits_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval]) / clamp_min(rate(squid_client_http_requests_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval]),1)) * 100", "format": "time_series", "instant": false, "interval": "2m", @@ -163,7 +163,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(squid_client_http_kbytes_out_kbytes_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(squid_client_http_kbytes_out_kbytes_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "interval": "2m", @@ -200,7 +200,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(squid_client_http_kbytes_in_kbytes_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(squid_client_http_kbytes_in_kbytes_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "interval": "2m", @@ -237,7 +237,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(squid_client_http_hit_kbytes_out_bytes_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(squid_client_http_hit_kbytes_out_bytes_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "interval": "2m", @@ -274,7 +274,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "squid_HTTP_Requests_All_50{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_HTTP_Requests_All_50{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}", "format": "time_series", "instant": false, "legendFormat": "50%", @@ -285,7 +285,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "squid_HTTP_Requests_All_75{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_HTTP_Requests_All_75{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}", "format": "time_series", "instant": false, "legendFormat": "75%", @@ -296,7 +296,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "squid_HTTP_Requests_All_95{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_HTTP_Requests_All_95{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}", "format": "time_series", "instant": false, "legendFormat": "95%", @@ -331,7 +331,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "squid_Cache_Hits_50{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_Cache_Hits_50{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}", "format": "time_series", "instant": false, "intervalFactor": 2, @@ -343,7 +343,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "squid_Cache_Hits_75{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_Cache_Hits_75{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}", "format": "time_series", "instant": false, "intervalFactor": 2, @@ -355,7 +355,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "squid_Cache_Hits_95{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_Cache_Hits_95{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}", "format": "time_series", "instant": false, "intervalFactor": 2, @@ -391,7 +391,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "squid_Cache_Nisses_50{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_Cache_Nisses_50{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}", "format": "time_series", "instant": false, "intervalFactor": 2, @@ -403,7 +403,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "squid_Cache_Misses_75{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_Cache_Misses_75{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}", "format": "time_series", "instant": false, "intervalFactor": 2, @@ -415,7 +415,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "squid_Cache_Misses_95{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_Cache_Misses_95{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}", "format": "time_series", "instant": false, "intervalFactor": 2, @@ -469,7 +469,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(squid_server_ftp_requests_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(squid_server_ftp_requests_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "interval": "2m", @@ -482,7 +482,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(squid_server_http_requests_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(squid_server_http_requests_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "interval": "2m", @@ -495,7 +495,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(squid_server_other_requests_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(squid_server_other_requests_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "interval": "2m", @@ -537,7 +537,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(squid_server_ftp_errors_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(squid_server_ftp_errors_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "legendFormat": "FTP", @@ -548,7 +548,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(squid_server_http_errors_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(squid_server_http_errors_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "legendFormat": "HTTP", @@ -559,7 +559,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(squid_server_other_errors_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(squid_server_other_errors_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "legendFormat": "other", @@ -599,7 +599,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(squid_server_ftp_kbytes_out_kbytes_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(squid_server_ftp_kbytes_out_kbytes_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "interval": "2m", @@ -612,7 +612,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(squid_server_http_kbytes_out_kbytes_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(squid_server_http_kbytes_out_kbytes_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "interval": "2m", @@ -625,7 +625,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(squid_server_other_kbytes_out_kbytes_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(squid_server_other_kbytes_out_kbytes_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "interval": "2m", @@ -667,7 +667,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(squid_swap_ins_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(squid_swap_ins_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "interval": "2m", @@ -680,7 +680,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(squid_swap_outs_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(squid_swap_outs_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "interval": "2m", @@ -722,7 +722,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "squid_DNS_Lookups_50{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_DNS_Lookups_50{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}", "format": "time_series", "instant": false, "intervalFactor": 2, @@ -734,7 +734,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "squid_DNS_Lookups_75{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_DNS_Lookups_75{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}", "format": "time_series", "instant": false, "intervalFactor": 2, @@ -746,7 +746,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "squid_DNS_Lookups_95{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}", + "expr": "squid_DNS_Lookups_95{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}", "format": "time_series", "instant": false, "intervalFactor": 2, @@ -787,7 +787,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(squid_server_ftp_kbytes_in_kbytes_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(squid_server_ftp_kbytes_in_kbytes_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "interval": "2m", @@ -800,7 +800,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(squid_server_http_kbytes_in_kbytes_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(squid_server_http_kbytes_in_kbytes_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "interval": "2m", @@ -813,7 +813,7 @@ "type": "prometheus", "uid": "${prometheus_datasource}" }, - "expr": "rate(squid_server_other_kbytes_in_kbytes_total{job=\"integrations/squid\",job=~\"$job\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(squid_server_other_kbytes_in_kbytes_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "interval": "2m", @@ -855,6 +855,21 @@ "sort": 1, "type": "query" }, + { + "allValue": ".+", + "datasource": { + "type": "prometheus", + "uid": "${prometheus_datasource}" + }, + "includeAll": true, + "label": "Cluster", + "multi": true, + "name": "cluster", + "query": "label_values(squid_client_http_requests_total{job=\"integrations/squid\",job=~\"$job\"}, cluster)", + "refresh": 2, + "sort": 1, + "type": "query" + }, { "allValue": ".+", "datasource": { @@ -865,7 +880,7 @@ "label": "Instance", "multi": true, "name": "instance", - "query": "label_values(squid_client_http_requests_total{job=\"integrations/squid\",job=~\"$job\"}, instance)", + "query": "label_values(squid_client_http_requests_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\"}, instance)", "refresh": 2, "sort": 1, "type": "query" diff --git a/squid-mixin/g.libsonnet b/squid-mixin/g.libsonnet index 161012e80..987f6c54b 100644 --- a/squid-mixin/g.libsonnet +++ b/squid-mixin/g.libsonnet @@ -1,3 +1 @@ -// grafonnet must be imported with "g" alias -local g = import './vendor/github.com/grafana/grafonnet/gen/grafonnet-v11.0.0/main.libsonnet'; -g +import 'github.com/grafana/grafonnet/gen/grafonnet-v11.0.0/main.libsonnet' \ No newline at end of file diff --git a/squid-mixin/panels.libsonnet b/squid-mixin/panels.libsonnet index b838a507a..b9e3fd3ad 100644 --- a/squid-mixin/panels.libsonnet +++ b/squid-mixin/panels.libsonnet @@ -11,7 +11,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Client requests') + g.panel.timeSeries.panelOptions.withDescription('The request rate of client.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.clientHTTPRequests.asTarget() + signals.overview.clientHTTPRequests.asTarget() + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) @@ -21,7 +21,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Client request errors') + g.panel.timeSeries.panelOptions.withDescription('The number of client HTTP errors.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.clientHTTPErrors.asTarget() + signals.overview.clientHTTPErrors.asTarget() + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) @@ -31,7 +31,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Client cache hit ratio') + g.panel.timeSeries.panelOptions.withDescription('The client cache hit ratio.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.clientCacheHitRatio.asTarget() + signals.overview.clientCacheHitRatio.asTarget() + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) @@ -41,7 +41,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Client request sent throughput') + g.panel.timeSeries.panelOptions.withDescription('The throughput of client HTTP data sent.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.clientHTTPSentThroughput.asTarget() + signals.overview.clientHTTPSentThroughput.asTarget() + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) @@ -51,7 +51,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Client HTTP received throughput') + g.panel.timeSeries.panelOptions.withDescription('The throughput of client HTTP data received.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.clientHTTPReceivedThroughput.asTarget() + signals.overview.clientHTTPReceivedThroughput.asTarget() + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) @@ -61,7 +61,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Client cache hit throughput') + g.panel.timeSeries.panelOptions.withDescription('The throughput of client cache hit.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.clientCacheHitThroughput.asTarget() + signals.overview.clientCacheHitThroughput.asTarget() + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) @@ -71,9 +71,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('HTTP request service time') + g.panel.timeSeries.panelOptions.withDescription('HTTP request service time percentiles.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.httpRequestsAll50.asTarget(), - signals.client.httpRequestsAll75.asTarget(), - signals.client.httpRequestsAll95.asTarget(), + signals.overview.httpRequestsAll50.asTarget(), + signals.overview.httpRequestsAll75.asTarget(), + signals.overview.httpRequestsAll95.asTarget(), ]) + g.panel.timeSeries.standardOptions.withUnit('s'), @@ -81,11 +81,11 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Cache hit service time') + g.panel.timeSeries.panelOptions.withDescription('Cache hits service time percentiles.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.cacheHits50.asTarget() + signals.overview.cacheHits50.asTarget() + g.query.prometheus.withIntervalFactor(2), - signals.client.cacheHits75.asTarget() + signals.overview.cacheHits75.asTarget() + g.query.prometheus.withIntervalFactor(2), - signals.client.cacheHits95.asTarget() + signals.overview.cacheHits95.asTarget() + g.query.prometheus.withIntervalFactor(2), ]) + g.panel.timeSeries.standardOptions.withUnit('s'), @@ -94,11 +94,11 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Cache misses service time') + g.panel.timeSeries.panelOptions.withDescription('Cache misses service time percentiles.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.cacheMisses50.asTarget() + signals.overview.cacheMisses50.asTarget() + g.query.prometheus.withIntervalFactor(2), - signals.client.cacheMisses75.asTarget() + signals.overview.cacheMisses75.asTarget() + g.query.prometheus.withIntervalFactor(2), - signals.client.cacheMisses95.asTarget() + signals.overview.cacheMisses95.asTarget() + g.query.prometheus.withIntervalFactor(2), ]) + g.panel.timeSeries.standardOptions.withUnit('s'), @@ -108,13 +108,13 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Server requests') + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server requests.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.serverFTPRequests.asTarget() + signals.overview.serverFTPRequests.asTarget() + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), - signals.client.serverHTTPRequests.asTarget() + signals.overview.serverHTTPRequests.asTarget() + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), - signals.client.serverOtherRequests.asTarget() + signals.overview.serverOtherRequests.asTarget() + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) @@ -125,9 +125,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Server request errors') + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server request errors.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.serverFTPErrors.asTarget(), - signals.client.serverHTTPErrors.asTarget(), - signals.client.serverOtherErrors.asTarget(), + signals.overview.serverFTPErrors.asTarget(), + signals.overview.serverHTTPErrors.asTarget(), + signals.overview.serverOtherErrors.asTarget(), ]) + g.panel.timeSeries.standardOptions.withUnit('errors/s') + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), @@ -136,13 +136,13 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Server request sent throughput') + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server sent throughput.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.serverFTPSentThroughput.asTarget() + signals.overview.serverFTPSentThroughput.asTarget() + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), - signals.client.serverHTTPSentThroughput.asTarget() + signals.overview.serverHTTPSentThroughput.asTarget() + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), - signals.client.serverOtherSentThroughput.asTarget() + signals.overview.serverOtherSentThroughput.asTarget() + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) @@ -153,10 +153,10 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Server object swap') + g.panel.timeSeries.panelOptions.withDescription('The number of objects read from disk and the number of objects saved to disk.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.swapIns.asTarget() + signals.overview.swapIns.asTarget() + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), - signals.client.swapOuts.asTarget() + signals.overview.swapOuts.asTarget() + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) @@ -167,11 +167,11 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('DNS lookup service time') + g.panel.timeSeries.panelOptions.withDescription('DNS lookup service time percentiles') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.dnsLookups50.asTarget() + signals.overview.dnsLookups50.asTarget() + g.query.prometheus.withIntervalFactor(2), - signals.client.dnsLookups75.asTarget() + signals.overview.dnsLookups75.asTarget() + g.query.prometheus.withIntervalFactor(2), - signals.client.dnsLookups95.asTarget() + signals.overview.dnsLookups95.asTarget() + g.query.prometheus.withIntervalFactor(2), ]) + g.panel.timeSeries.standardOptions.withUnit('s') @@ -181,46 +181,17 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Server received throughput') + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server throughput.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.client.serverFTPReceivedThroughput.asTarget() + signals.overview.serverFTPReceivedThroughput.asTarget() + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), - signals.client.serverHTTPReceivedThroughput.asTarget() + signals.overview.serverHTTPReceivedThroughput.asTarget() + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), - signals.client.serverOtherReceivedThroughput.asTarget() + signals.overview.serverOtherReceivedThroughput.asTarget() + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) + g.panel.timeSeries.standardOptions.withUnit('KBs') + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), - - // Logs panels - // cacheLogs: - // g.panel.logs.new('Cache logs') - // + g.panel.logs.panelOptions.withDescription('The log file that contains the debug and error messages that Squid generates.') - // + g.panel.logs.queryOptions.withTargets([ - // g.query.loki.new( - // '${loki_datasource}', - // '{' + this.config.filteringSelector + '} |= `` | (filename="/var/log/squid/cache.log" or log_type="cache")' - // ), - // ]) - // + g.panel.logs.options.withEnableLogDetails(true) - // + g.panel.logs.options.withShowCommonLabels(false) - // + g.panel.logs.options.withShowTime(false) - // + g.panel.logs.options.withWrapLogMessage(false), - - // accessLogs: - // g.panel.logs.new('Access logs') - // + g.panel.logs.panelOptions.withDescription('The log file that contains a record of all HTTP requests and responses processed by the Squid proxy server.') - // + g.panel.logs.queryOptions.withTargets([ - // g.query.loki.new( - // '${loki_datasource}', - // '{' + this.config.filteringSelector + '} |= `` | (filename="/var/log/squid/access.log" or log_type="access")' - // ), - // ]) - // + g.panel.logs.options.withEnableLogDetails(true) - // + g.panel.logs.options.withShowCommonLabels(false) - // + g.panel.logs.options.withShowTime(false) - // + g.panel.logs.options.withWrapLogMessage(false), }, } diff --git a/squid-mixin/signals/client.libsonnet b/squid-mixin/signals/overview.libsonnet similarity index 100% rename from squid-mixin/signals/client.libsonnet rename to squid-mixin/signals/overview.libsonnet diff --git a/squid-mixin/signals/server.libsonnet b/squid-mixin/signals/server.libsonnet deleted file mode 100644 index 0fb47c123..000000000 --- a/squid-mixin/signals/server.libsonnet +++ /dev/null @@ -1,192 +0,0 @@ -function(this) - { - filteringSelector: this.filteringSelector, - groupLabels: this.groupLabels, - instanceLabels: this.instanceLabels, - aggLevel: 'instance', - aggFunction: 'avg', - signals: { - - ftpRequests: { - name: 'Server FTP requests', - type: 'counter', - unit: 'reqps', - description: 'The number of FTP server requests.', - sources: { - prometheus: { - expr: 'squid_server_ftp_requests_total{%(queriesSelector)s}', - legendCustomTemplate: 'FTP', - }, - }, - }, - - httpRequests: { - name: 'Server HTTP requests', - type: 'counter', - unit: 'reqps', - description: 'The number of HTTP server requests.', - sources: { - prometheus: { - expr: 'squid_server_http_requests_total{%(queriesSelector)s}', - legendCustomTemplate: 'HTTP', - }, - }, - }, - - otherRequests: { - name: 'Server other requests', - type: 'counter', - unit: 'reqps', - description: 'The number of other server requests.', - sources: { - prometheus: { - expr: 'squid_server_other_requests_total{%(queriesSelector)s}', - legendCustomTemplate: 'other', - }, - }, - }, - - ftpErrors: { - name: 'Server FTP errors', - type: 'counter', - unit: 'errors/s', - description: 'The number of FTP server request errors.', - sources: { - prometheus: { - expr: 'squid_server_ftp_errors_total{%(queriesSelector)s}', - legendCustomTemplate: 'FTP', - }, - }, - }, - - httpErrors: { - name: 'Server HTTP errors', - type: 'counter', - unit: 'errors/s', - description: 'The number of HTTP server request errors.', - sources: { - prometheus: { - expr: 'squid_server_http_errors_total{%(queriesSelector)s}', - legendCustomTemplate: 'HTTP', - }, - }, - }, - - otherErrors: { - name: 'Server other errors', - type: 'counter', - unit: 'errors/s', - description: 'The number of other server request errors.', - sources: { - prometheus: { - expr: 'squid_server_other_errors_total{%(queriesSelector)s}', - legendCustomTemplate: 'other', - }, - }, - }, - - ftpSentThroughput: { - name: 'Server FTP sent throughput', - type: 'counter', - unit: 'KBs', - description: 'The throughput of FTP server data sent.', - sources: { - prometheus: { - expr: 'squid_server_ftp_kbytes_out_kbytes_total{%(queriesSelector)s}', - legendCustomTemplate: 'FTP', - }, - }, - }, - - httpSentThroughput: { - name: 'Server HTTP sent throughput', - type: 'counter', - unit: 'KBs', - description: 'The throughput of HTTP server data sent.', - sources: { - prometheus: { - expr: 'squid_server_http_kbytes_out_kbytes_total{%(queriesSelector)s}', - legendCustomTemplate: 'HTTP', - }, - }, - }, - - otherSentThroughput: { - name: 'Server other sent throughput', - type: 'counter', - unit: 'KBs', - description: 'The throughput of other server data sent.', - sources: { - prometheus: { - expr: 'squid_server_other_kbytes_out_kbytes_total{%(queriesSelector)s}', - legendCustomTemplate: 'other', - }, - }, - }, - - swapIns: { - name: 'Server object swap ins', - type: 'counter', - unit: 'cps', - description: 'The number of objects read from disk.', - sources: { - prometheus: { - expr: 'squid_swap_ins_total{%(queriesSelector)s}', - legendCustomTemplate: '{{instance}} - read', - }, - }, - }, - - swapOuts: { - name: 'Server object swap outs', - type: 'counter', - unit: 'cps', - description: 'The number of objects saved to disk.', - sources: { - prometheus: { - expr: 'squid_swap_outs_total{%(queriesSelector)s}', - legendCustomTemplate: '{{instance}} - saved', - }, - }, - }, - - ftpReceivedThroughput: { - name: 'Server FTP received throughput', - type: 'counter', - unit: 'KBs', - description: 'The throughput of FTP server data received.', - sources: { - prometheus: { - expr: 'squid_server_ftp_kbytes_in_kbytes_total{%(queriesSelector)s}', - legendCustomTemplate: 'FTP', - }, - }, - }, - - httpReceivedThroughput: { - name: 'Server HTTP received throughput', - type: 'counter', - unit: 'KBs', - description: 'The throughput of HTTP server data received.', - sources: { - prometheus: { - expr: 'squid_server_http_kbytes_in_kbytes_total{%(queriesSelector)s}', - legendCustomTemplate: 'HTTP', - }, - }, - }, - - otherReceivedThroughput: { - name: 'Server other received throughput', - type: 'counter', - unit: 'KBs', - description: 'The throughput of other server data received.', - sources: { - prometheus: { - expr: 'squid_server_other_kbytes_in_kbytes_total{%(queriesSelector)s}', - legendCustomTemplate: 'other', - }, - }, - }, - }, - } diff --git a/squid-mixin/signals/service_time.libsonnet b/squid-mixin/signals/service_time.libsonnet deleted file mode 100644 index f454c7a76..000000000 --- a/squid-mixin/signals/service_time.libsonnet +++ /dev/null @@ -1,170 +0,0 @@ -function(this) - { - filteringSelector: this.filteringSelector, - groupLabels: this.groupLabels, - instanceLabels: this.instanceLabels, - aggLevel: 'none', - aggFunction: 'avg', - signals: { - - // HTTP Request service time percentiles - httpRequestsAll50: { - name: 'HTTP requests service time p50', - type: 'gauge', - unit: 's', - description: 'HTTP request service time 50th percentile.', - sources: { - prometheus: { - expr: 'squid_http_requests_all_50{%(queriesSelector)s}', - legendCustomTemplate: '50%%', - }, - }, - }, - - httpRequestsAll75: { - name: 'HTTP requests service time p75', - type: 'gauge', - unit: 's', - description: 'HTTP request service time 75th percentile.', - sources: { - prometheus: { - expr: 'squid_http_requests_all_75{%(queriesSelector)s}', - legendCustomTemplate: '75%%', - }, - }, - }, - - httpRequestsAll95: { - name: 'HTTP requests service time p95', - type: 'gauge', - unit: 's', - description: 'HTTP request service time 95th percentile.', - sources: { - prometheus: { - expr: 'squid_http_requests_all_95{%(queriesSelector)s}', - legendCustomTemplate: '95%%', - }, - }, - }, - - // Cache hits service time percentiles - cacheHits50: { - name: 'Cache hits service time p50', - type: 'gauge', - unit: 's', - description: 'Cache hits service time 50th percentile.', - sources: { - prometheus: { - expr: 'squid_cache_hits_50{%(queriesSelector)s}', - legendCustomTemplate: '50%%', - }, - }, - }, - - cacheHits75: { - name: 'Cache hits service time p75', - type: 'gauge', - unit: 's', - description: 'Cache hits service time 75th percentile.', - sources: { - prometheus: { - expr: 'squid_cache_hits_75{%(queriesSelector)s}', - legendCustomTemplate: '75%%', - }, - }, - }, - - cacheHits95: { - name: 'Cache hits service time p95', - type: 'gauge', - unit: 's', - description: 'Cache hits service time 95th percentile.', - sources: { - prometheus: { - expr: 'squid_cache_hits_95{%(queriesSelector)s}', - legendCustomTemplate: '95%%', - }, - }, - }, - - // Cache misses service time percentiles - cacheMisses50: { - name: 'Cache misses service time p50', - type: 'gauge', - unit: 's', - description: 'Cache misses service time 50th percentile.', - sources: { - prometheus: { - expr: 'squid_cache_misses_50{%(queriesSelector)s}', - legendCustomTemplate: '50%%', - }, - }, - }, - - cacheMisses75: { - name: 'Cache misses service time p75', - type: 'gauge', - unit: 's', - description: 'Cache misses service time 75th percentile.', - sources: { - prometheus: { - expr: 'squid_cache_misses_75{%(queriesSelector)s}', - legendCustomTemplate: '75%%', - }, - }, - }, - - cacheMisses95: { - name: 'Cache misses service time p95', - type: 'gauge', - unit: 's', - description: 'Cache misses service time 95th percentile.', - sources: { - prometheus: { - expr: 'squid_cache_misses_95{%(queriesSelector)s}', - legendCustomTemplate: '95%%', - }, - }, - }, - - // DNS lookup service time percentiles - dnsLookups50: { - name: 'DNS lookup service time p50', - type: 'gauge', - unit: 's', - description: 'DNS lookup service time 50th percentile.', - sources: { - prometheus: { - expr: 'squid_dns_lookups_50{%(queriesSelector)s}', - legendCustomTemplate: '50%%', - }, - }, - }, - - dnsLookups75: { - name: 'DNS lookup service time p75', - type: 'gauge', - unit: 's', - description: 'DNS lookup service time 75th percentile.', - sources: { - prometheus: { - expr: 'squid_dns_lookups_75{%(queriesSelector)s}', - legendCustomTemplate: '75%%', - }, - }, - }, - - dnsLookups95: { - name: 'DNS lookup service time p95', - type: 'gauge', - unit: 's', - description: 'DNS lookup service time 95th percentile.', - sources: { - prometheus: { - expr: 'squid_dns_lookups_95{%(queriesSelector)s}', - legendCustomTemplate: '95%%', - }, - }, - }, - }, - } From f364f66660f44a27023535f45e46a2e8d48a6bcb Mon Sep 17 00:00:00 2001 From: Greg Pattison Date: Fri, 21 Nov 2025 07:47:19 -0500 Subject: [PATCH 04/10] Tweaked timeseries panels to match best practices --- .../dashboards_out/squid-overview.json | 71 ++++++++++++++++++- squid-mixin/mixin.libsonnet | 8 ++- squid-mixin/panels.libsonnet | 57 ++++++++++++++- 3 files changed, 131 insertions(+), 5 deletions(-) diff --git a/squid-mixin/dashboards_out/squid-overview.json b/squid-mixin/dashboards_out/squid-overview.json index 6f0aa6fc7..c1f22b852 100644 --- a/squid-mixin/dashboards_out/squid-overview.json +++ b/squid-mixin/dashboards_out/squid-overview.json @@ -35,6 +35,11 @@ "description": "The request rate of client.", "fieldConfig": { "defaults": { + "custom": { + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" + }, "unit": "reqps" } }, @@ -72,6 +77,11 @@ "description": "The number of client HTTP errors.", "fieldConfig": { "defaults": { + "custom": { + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" + }, "unit": "errors/s" } }, @@ -109,6 +119,11 @@ "description": "The client cache hit ratio.", "fieldConfig": { "defaults": { + "custom": { + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" + }, "unit": "percent" } }, @@ -146,6 +161,11 @@ "description": "The throughput of client HTTP data sent.", "fieldConfig": { "defaults": { + "custom": { + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" + }, "unit": "KBs" } }, @@ -183,6 +203,11 @@ "description": "The throughput of client HTTP data received.", "fieldConfig": { "defaults": { + "custom": { + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" + }, "unit": "KBs" } }, @@ -220,6 +245,11 @@ "description": "The throughput of client cache hit.", "fieldConfig": { "defaults": { + "custom": { + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" + }, "unit": "KBs" } }, @@ -257,6 +287,11 @@ "description": "HTTP request service time percentiles.", "fieldConfig": { "defaults": { + "custom": { + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" + }, "unit": "s" } }, @@ -314,6 +349,11 @@ "description": "Cache hits service time percentiles.", "fieldConfig": { "defaults": { + "custom": { + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" + }, "unit": "s" } }, @@ -374,6 +414,11 @@ "description": "Cache misses service time percentiles.", "fieldConfig": { "defaults": { + "custom": { + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never" + }, "unit": "s" } }, @@ -448,6 +493,9 @@ "fieldConfig": { "defaults": { "custom": { + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never", "stacking": { "mode": "normal" } @@ -516,6 +564,9 @@ "fieldConfig": { "defaults": { "custom": { + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never", "stacking": { "mode": "normal" } @@ -540,6 +591,8 @@ "expr": "rate(squid_server_ftp_errors_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "FTP", "refId": "Server FTP errors" }, @@ -551,6 +604,8 @@ "expr": "rate(squid_server_http_errors_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "HTTP", "refId": "Server HTTP errors" }, @@ -562,6 +617,8 @@ "expr": "rate(squid_server_other_errors_total{job=\"integrations/squid\",job=~\"$job\",cluster=~\"$cluster\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "other", "refId": "Server other errors" } @@ -578,6 +635,9 @@ "fieldConfig": { "defaults": { "custom": { + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never", "stacking": { "mode": "normal" } @@ -646,6 +706,9 @@ "fieldConfig": { "defaults": { "custom": { + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never", "stacking": { "mode": "normal" } @@ -701,6 +764,9 @@ "fieldConfig": { "defaults": { "custom": { + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never", "stacking": { "mode": "normal" } @@ -766,6 +832,9 @@ "fieldConfig": { "defaults": { "custom": { + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never", "stacking": { "mode": "normal" } @@ -856,7 +925,7 @@ "type": "query" }, { - "allValue": ".+", + "allValue": ".*", "datasource": { "type": "prometheus", "uid": "${prometheus_datasource}" diff --git a/squid-mixin/mixin.libsonnet b/squid-mixin/mixin.libsonnet index 287a5b7dd..2e8bd294c 100644 --- a/squid-mixin/mixin.libsonnet +++ b/squid-mixin/mixin.libsonnet @@ -12,11 +12,17 @@ local mixin = mixinlib.new() } ); +local label_patch = { + cluster+: { + allValue: '.*', + }, +}; + { grafanaDashboards+:: { [fname]: local dashboard = util.decorate_dashboard(mixin.grafana.dashboards[fname], tags=config.dashboardTags); - dashboard + dashboard + util.patch_variables(dashboard, label_patch) for fname in std.objectFields(mixin.grafana.dashboards) }, diff --git a/squid-mixin/panels.libsonnet b/squid-mixin/panels.libsonnet index b9e3fd3ad..481fa3094 100644 --- a/squid-mixin/panels.libsonnet +++ b/squid-mixin/panels.libsonnet @@ -15,6 +15,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) + + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + g.panel.timeSeries.standardOptions.withUnit('reqps'), clientRequestErrors: @@ -25,6 +28,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) + + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + g.panel.timeSeries.standardOptions.withUnit('errors/s'), clientCacheHitRatio: @@ -35,6 +41,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) + + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + g.panel.timeSeries.standardOptions.withUnit('percent'), clientRequestSentThroughput: @@ -45,6 +54,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) + + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + g.panel.timeSeries.standardOptions.withUnit('KBs'), clientHTTPReceivedThroughput: @@ -55,6 +67,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) + + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + g.panel.timeSeries.standardOptions.withUnit('KBs'), clientCacheHitThroughput: @@ -65,6 +80,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) + + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + g.panel.timeSeries.standardOptions.withUnit('KBs'), httpRequestServiceTime: @@ -75,6 +93,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; signals.overview.httpRequestsAll75.asTarget(), signals.overview.httpRequestsAll95.asTarget(), ]) + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) + + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + g.panel.timeSeries.standardOptions.withUnit('s'), cacheHitServiceTime: @@ -88,6 +109,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; signals.overview.cacheHits95.asTarget() + g.query.prometheus.withIntervalFactor(2), ]) + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) + + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + g.panel.timeSeries.standardOptions.withUnit('s'), cacheMissesServiceTime: @@ -101,6 +125,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; signals.overview.cacheMisses95.asTarget() + g.query.prometheus.withIntervalFactor(2), ]) + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) + + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + g.panel.timeSeries.standardOptions.withUnit('s'), // Server panels @@ -118,6 +145,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) + + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + g.panel.timeSeries.standardOptions.withUnit('reqps') + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), @@ -125,10 +155,19 @@ local commonlib = import 'common-lib/common/main.libsonnet'; g.panel.timeSeries.new('Server request errors') + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server request errors.') + g.panel.timeSeries.queryOptions.withTargets([ - signals.overview.serverFTPErrors.asTarget(), - signals.overview.serverHTTPErrors.asTarget(), - signals.overview.serverOtherErrors.asTarget(), + signals.overview.serverFTPErrors.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), + signals.overview.serverHTTPErrors.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), + signals.overview.serverOtherErrors.asTarget() + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2), ]) + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) + + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + g.panel.timeSeries.standardOptions.withUnit('errors/s') + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), @@ -146,6 +185,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) + + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + g.panel.timeSeries.standardOptions.withUnit('KBs') + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), @@ -160,6 +202,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) + + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + g.panel.timeSeries.standardOptions.withUnit('cps') + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), @@ -174,6 +219,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; signals.overview.dnsLookups95.asTarget() + g.query.prometheus.withIntervalFactor(2), ]) + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) + + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + g.panel.timeSeries.standardOptions.withUnit('s') + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), @@ -191,6 +239,9 @@ local commonlib = import 'common-lib/common/main.libsonnet'; + g.query.prometheus.withInterval('2m') + g.query.prometheus.withIntervalFactor(2), ]) + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') + + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) + + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + g.panel.timeSeries.standardOptions.withUnit('KBs') + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), }, From ea90c47be09c2cad8584c96ba48334a28505e9c7 Mon Sep 17 00:00:00 2001 From: Greg Pattison Date: Fri, 21 Nov 2025 08:10:09 -0500 Subject: [PATCH 05/10] Reset .lint configuration to master branch version --- squid-mixin/.lint | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/squid-mixin/.lint b/squid-mixin/.lint index 6ac646a35..16fa32fd4 100644 --- a/squid-mixin/.lint +++ b/squid-mixin/.lint @@ -1,14 +1,10 @@ exclusions: - template-job-rule: - reason: "Prometheus datasource variable is being named as prometheus_datasource now while linter expects 'datasource'" - panel-datasource-rule: - reason: "Modern mixins use signal-based architecture where datasource references are handled by the framework" - template-datasource-rule: - reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" - template-instance-rule: - reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" panel-units-rule: reason: "Custom units are used for better user experience in these panels" entries: - panel: "Client request errors" - panel: "Server request errors" + template-datasource-rule: + reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" + template-instance-rule: + reason: "Based on new convention we are using variable names prometheus_datasource and loki_datasource where as linter expects 'datasource'" From d45236d6a65fe9725b5e387b77953145c8258a3f Mon Sep 17 00:00:00 2001 From: Greg Pattison Date: Fri, 21 Nov 2025 08:17:42 -0500 Subject: [PATCH 06/10] Reset .gitignore to master version --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 1a57d51f0..d68c86c04 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,3 @@ vendor jsonnetfile.lock.json *.zip -.worktrees From 83550ed784911e22f6bf3decfed7ce8f147fedaf Mon Sep 17 00:00:00 2001 From: Greg Pattison Date: Fri, 21 Nov 2025 09:36:50 -0500 Subject: [PATCH 07/10] Ran make fmt. Fixed linting errors for prometheus_datasource --- squid-mixin/config.libsonnet | 2 +- squid-mixin/dashboards.libsonnet | 6 +- .../dashboards_out/squid-overview.json | 60 +++++++++---------- squid-mixin/g.libsonnet | 2 +- squid-mixin/panels.libsonnet | 15 +++++ 5 files changed, 50 insertions(+), 35 deletions(-) diff --git a/squid-mixin/config.libsonnet b/squid-mixin/config.libsonnet index a6eff675e..b217276c8 100644 --- a/squid-mixin/config.libsonnet +++ b/squid-mixin/config.libsonnet @@ -15,7 +15,7 @@ dashboardTimezone: 'default', dashboardRefresh: '1m', metricsSource: 'prometheus', - + // Logs configuration enableLokiLogs: true, extraLogLabels: ['level', 'severity'], diff --git a/squid-mixin/dashboards.libsonnet b/squid-mixin/dashboards.libsonnet index 19c1e9c11..1614dec0e 100644 --- a/squid-mixin/dashboards.libsonnet +++ b/squid-mixin/dashboards.libsonnet @@ -22,8 +22,8 @@ local logslib = import 'logs-lib/logs/main.libsonnet'; + g.dashboard.withPanels( g.util.panel.resolveCollapsedFlagOnRows( g.util.grid.wrapPanels([ - this.grafana.rows.clientRow, - this.grafana.rows.serverRow, + this.grafana.rows.clientRow, + this.grafana.rows.serverRow, ]) ) ) @@ -31,7 +31,7 @@ local logslib = import 'logs-lib/logs/main.libsonnet'; vars.multiInstance, uid + '-overview', tags, - links {squidOverview+:: {} }, + links { squidOverview+:: {} }, annotations, timezone, refresh, diff --git a/squid-mixin/dashboards_out/squid-overview.json b/squid-mixin/dashboards_out/squid-overview.json index c1f22b852..f4db0e046 100644 --- a/squid-mixin/dashboards_out/squid-overview.json +++ b/squid-mixin/dashboards_out/squid-overview.json @@ -29,8 +29,8 @@ }, { "datasource": { - "type": "datasource", - "uid": "-- Mixed --" + "type": "prometheus", + "uid": "${prometheus_datasource}" }, "description": "The request rate of client.", "fieldConfig": { @@ -71,8 +71,8 @@ }, { "datasource": { - "type": "datasource", - "uid": "-- Mixed --" + "type": "prometheus", + "uid": "${prometheus_datasource}" }, "description": "The number of client HTTP errors.", "fieldConfig": { @@ -113,8 +113,8 @@ }, { "datasource": { - "type": "datasource", - "uid": "-- Mixed --" + "type": "prometheus", + "uid": "${prometheus_datasource}" }, "description": "The client cache hit ratio.", "fieldConfig": { @@ -155,8 +155,8 @@ }, { "datasource": { - "type": "datasource", - "uid": "-- Mixed --" + "type": "prometheus", + "uid": "${prometheus_datasource}" }, "description": "The throughput of client HTTP data sent.", "fieldConfig": { @@ -197,8 +197,8 @@ }, { "datasource": { - "type": "datasource", - "uid": "-- Mixed --" + "type": "prometheus", + "uid": "${prometheus_datasource}" }, "description": "The throughput of client HTTP data received.", "fieldConfig": { @@ -239,8 +239,8 @@ }, { "datasource": { - "type": "datasource", - "uid": "-- Mixed --" + "type": "prometheus", + "uid": "${prometheus_datasource}" }, "description": "The throughput of client cache hit.", "fieldConfig": { @@ -281,8 +281,8 @@ }, { "datasource": { - "type": "datasource", - "uid": "-- Mixed --" + "type": "prometheus", + "uid": "${prometheus_datasource}" }, "description": "HTTP request service time percentiles.", "fieldConfig": { @@ -343,8 +343,8 @@ }, { "datasource": { - "type": "datasource", - "uid": "-- Mixed --" + "type": "prometheus", + "uid": "${prometheus_datasource}" }, "description": "Cache hits service time percentiles.", "fieldConfig": { @@ -408,8 +408,8 @@ }, { "datasource": { - "type": "datasource", - "uid": "-- Mixed --" + "type": "prometheus", + "uid": "${prometheus_datasource}" }, "description": "Cache misses service time percentiles.", "fieldConfig": { @@ -486,8 +486,8 @@ }, { "datasource": { - "type": "datasource", - "uid": "-- Mixed --" + "type": "prometheus", + "uid": "${prometheus_datasource}" }, "description": "The number of HTTP, FTP, and other server requests.", "fieldConfig": { @@ -557,8 +557,8 @@ }, { "datasource": { - "type": "datasource", - "uid": "-- Mixed --" + "type": "prometheus", + "uid": "${prometheus_datasource}" }, "description": "The number of HTTP, FTP, and other server request errors.", "fieldConfig": { @@ -628,8 +628,8 @@ }, { "datasource": { - "type": "datasource", - "uid": "-- Mixed --" + "type": "prometheus", + "uid": "${prometheus_datasource}" }, "description": "The number of HTTP, FTP, and other server sent throughput.", "fieldConfig": { @@ -699,8 +699,8 @@ }, { "datasource": { - "type": "datasource", - "uid": "-- Mixed --" + "type": "prometheus", + "uid": "${prometheus_datasource}" }, "description": "The number of objects read from disk and the number of objects saved to disk.", "fieldConfig": { @@ -757,8 +757,8 @@ }, { "datasource": { - "type": "datasource", - "uid": "-- Mixed --" + "type": "prometheus", + "uid": "${prometheus_datasource}" }, "description": "DNS lookup service time percentiles", "fieldConfig": { @@ -825,8 +825,8 @@ }, { "datasource": { - "type": "datasource", - "uid": "-- Mixed --" + "type": "prometheus", + "uid": "${prometheus_datasource}" }, "description": "The number of HTTP, FTP, and other server throughput.", "fieldConfig": { diff --git a/squid-mixin/g.libsonnet b/squid-mixin/g.libsonnet index 987f6c54b..f89dcc064 100644 --- a/squid-mixin/g.libsonnet +++ b/squid-mixin/g.libsonnet @@ -1 +1 @@ -import 'github.com/grafana/grafonnet/gen/grafonnet-v11.0.0/main.libsonnet' \ No newline at end of file +import 'github.com/grafana/grafonnet/gen/grafonnet-v11.0.0/main.libsonnet' diff --git a/squid-mixin/panels.libsonnet b/squid-mixin/panels.libsonnet index 481fa3094..381fe1505 100644 --- a/squid-mixin/panels.libsonnet +++ b/squid-mixin/panels.libsonnet @@ -10,6 +10,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; clientRequests: g.panel.timeSeries.new('Client requests') + g.panel.timeSeries.panelOptions.withDescription('The request rate of client.') + + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') + g.panel.timeSeries.queryOptions.withTargets([ signals.overview.clientHTTPRequests.asTarget() + g.query.prometheus.withInterval('2m') @@ -23,6 +24,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; clientRequestErrors: g.panel.timeSeries.new('Client request errors') + g.panel.timeSeries.panelOptions.withDescription('The number of client HTTP errors.') + + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') + g.panel.timeSeries.queryOptions.withTargets([ signals.overview.clientHTTPErrors.asTarget() + g.query.prometheus.withInterval('2m') @@ -36,6 +38,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; clientCacheHitRatio: g.panel.timeSeries.new('Client cache hit ratio') + g.panel.timeSeries.panelOptions.withDescription('The client cache hit ratio.') + + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') + g.panel.timeSeries.queryOptions.withTargets([ signals.overview.clientCacheHitRatio.asTarget() + g.query.prometheus.withInterval('2m') @@ -49,6 +52,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; clientRequestSentThroughput: g.panel.timeSeries.new('Client request sent throughput') + g.panel.timeSeries.panelOptions.withDescription('The throughput of client HTTP data sent.') + + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') + g.panel.timeSeries.queryOptions.withTargets([ signals.overview.clientHTTPSentThroughput.asTarget() + g.query.prometheus.withInterval('2m') @@ -62,6 +66,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; clientHTTPReceivedThroughput: g.panel.timeSeries.new('Client HTTP received throughput') + g.panel.timeSeries.panelOptions.withDescription('The throughput of client HTTP data received.') + + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') + g.panel.timeSeries.queryOptions.withTargets([ signals.overview.clientHTTPReceivedThroughput.asTarget() + g.query.prometheus.withInterval('2m') @@ -75,6 +80,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; clientCacheHitThroughput: g.panel.timeSeries.new('Client cache hit throughput') + g.panel.timeSeries.panelOptions.withDescription('The throughput of client cache hit.') + + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') + g.panel.timeSeries.queryOptions.withTargets([ signals.overview.clientCacheHitThroughput.asTarget() + g.query.prometheus.withInterval('2m') @@ -88,6 +94,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; httpRequestServiceTime: g.panel.timeSeries.new('HTTP request service time') + g.panel.timeSeries.panelOptions.withDescription('HTTP request service time percentiles.') + + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') + g.panel.timeSeries.queryOptions.withTargets([ signals.overview.httpRequestsAll50.asTarget(), signals.overview.httpRequestsAll75.asTarget(), @@ -101,6 +108,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; cacheHitServiceTime: g.panel.timeSeries.new('Cache hit service time') + g.panel.timeSeries.panelOptions.withDescription('Cache hits service time percentiles.') + + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') + g.panel.timeSeries.queryOptions.withTargets([ signals.overview.cacheHits50.asTarget() + g.query.prometheus.withIntervalFactor(2), @@ -117,6 +125,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; cacheMissesServiceTime: g.panel.timeSeries.new('Cache misses service time') + g.panel.timeSeries.panelOptions.withDescription('Cache misses service time percentiles.') + + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') + g.panel.timeSeries.queryOptions.withTargets([ signals.overview.cacheMisses50.asTarget() + g.query.prometheus.withIntervalFactor(2), @@ -134,6 +143,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; serverRequests: g.panel.timeSeries.new('Server requests') + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server requests.') + + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') + g.panel.timeSeries.queryOptions.withTargets([ signals.overview.serverFTPRequests.asTarget() + g.query.prometheus.withInterval('2m') @@ -154,6 +164,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; serverRequestErrors: g.panel.timeSeries.new('Server request errors') + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server request errors.') + + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') + g.panel.timeSeries.queryOptions.withTargets([ signals.overview.serverFTPErrors.asTarget() + g.query.prometheus.withInterval('2m') @@ -174,6 +185,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; serverRequestSentThroughput: g.panel.timeSeries.new('Server request sent throughput') + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server sent throughput.') + + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') + g.panel.timeSeries.queryOptions.withTargets([ signals.overview.serverFTPSentThroughput.asTarget() + g.query.prometheus.withInterval('2m') @@ -194,6 +206,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; serverObjectSwap: g.panel.timeSeries.new('Server object swap') + g.panel.timeSeries.panelOptions.withDescription('The number of objects read from disk and the number of objects saved to disk.') + + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') + g.panel.timeSeries.queryOptions.withTargets([ signals.overview.swapIns.asTarget() + g.query.prometheus.withInterval('2m') @@ -211,6 +224,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; dnsLookupServiceTime: g.panel.timeSeries.new('DNS lookup service time') + g.panel.timeSeries.panelOptions.withDescription('DNS lookup service time percentiles') + + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') + g.panel.timeSeries.queryOptions.withTargets([ signals.overview.dnsLookups50.asTarget() + g.query.prometheus.withIntervalFactor(2), @@ -228,6 +242,7 @@ local commonlib = import 'common-lib/common/main.libsonnet'; serverReceivedThroughput: g.panel.timeSeries.new('Server received throughput') + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server throughput.') + + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') + g.panel.timeSeries.queryOptions.withTargets([ signals.overview.serverFTPReceivedThroughput.asTarget() + g.query.prometheus.withInterval('2m') From 4ee7a12cf6bd5b2b602d0d9ee0f1c2ff832bb086 Mon Sep 17 00:00:00 2001 From: Greg Pattison Date: Fri, 21 Nov 2025 13:40:03 -0500 Subject: [PATCH 08/10] Reworked all panels to use commonlib as base. --- .../dashboards_out/squid-overview.json | 185 +++++++++- squid-mixin/panels.libsonnet | 316 +++++++----------- 2 files changed, 294 insertions(+), 207 deletions(-) diff --git a/squid-mixin/dashboards_out/squid-overview.json b/squid-mixin/dashboards_out/squid-overview.json index f4db0e046..b0fce6970 100644 --- a/squid-mixin/dashboards_out/squid-overview.json +++ b/squid-mixin/dashboards_out/squid-overview.json @@ -36,6 +36,8 @@ "fieldConfig": { "defaults": { "custom": { + "fillOpacity": 30, + "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never" @@ -50,6 +52,16 @@ "y": 1 }, "id": 2, + "options": { + "legend": { + "calcs": [ ], + "displayMode": "list" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, "pluginVersion": "v11.0.0", "targets": [ { @@ -78,6 +90,8 @@ "fieldConfig": { "defaults": { "custom": { + "fillOpacity": 30, + "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never" @@ -92,6 +106,16 @@ "y": 1 }, "id": 3, + "options": { + "legend": { + "calcs": [ ], + "displayMode": "list" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, "pluginVersion": "v11.0.0", "targets": [ { @@ -120,6 +144,8 @@ "fieldConfig": { "defaults": { "custom": { + "fillOpacity": 30, + "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never" @@ -134,6 +160,16 @@ "y": 1 }, "id": 4, + "options": { + "legend": { + "calcs": [ ], + "displayMode": "list" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, "pluginVersion": "v11.0.0", "targets": [ { @@ -162,6 +198,8 @@ "fieldConfig": { "defaults": { "custom": { + "fillOpacity": 30, + "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never" @@ -176,6 +214,16 @@ "y": 8 }, "id": 5, + "options": { + "legend": { + "calcs": [ ], + "displayMode": "list" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, "pluginVersion": "v11.0.0", "targets": [ { @@ -204,6 +252,8 @@ "fieldConfig": { "defaults": { "custom": { + "fillOpacity": 30, + "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never" @@ -218,6 +268,16 @@ "y": 8 }, "id": 6, + "options": { + "legend": { + "calcs": [ ], + "displayMode": "list" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, "pluginVersion": "v11.0.0", "targets": [ { @@ -246,6 +306,8 @@ "fieldConfig": { "defaults": { "custom": { + "fillOpacity": 30, + "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never" @@ -260,6 +322,16 @@ "y": 8 }, "id": 7, + "options": { + "legend": { + "calcs": [ ], + "displayMode": "list" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, "pluginVersion": "v11.0.0", "targets": [ { @@ -288,6 +360,8 @@ "fieldConfig": { "defaults": { "custom": { + "fillOpacity": 30, + "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never" @@ -302,6 +376,16 @@ "y": 15 }, "id": 8, + "options": { + "legend": { + "calcs": [ ], + "displayMode": "list" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, "pluginVersion": "v11.0.0", "targets": [ { @@ -350,6 +434,8 @@ "fieldConfig": { "defaults": { "custom": { + "fillOpacity": 30, + "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never" @@ -364,6 +450,16 @@ "y": 15 }, "id": 9, + "options": { + "legend": { + "calcs": [ ], + "displayMode": "list" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, "pluginVersion": "v11.0.0", "targets": [ { @@ -415,6 +511,8 @@ "fieldConfig": { "defaults": { "custom": { + "fillOpacity": 30, + "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never" @@ -429,6 +527,16 @@ "y": 15 }, "id": 10, + "options": { + "legend": { + "calcs": [ ], + "displayMode": "list" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, "pluginVersion": "v11.0.0", "targets": [ { @@ -493,6 +601,8 @@ "fieldConfig": { "defaults": { "custom": { + "fillOpacity": 30, + "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never", @@ -510,6 +620,16 @@ "y": 24 }, "id": 12, + "options": { + "legend": { + "calcs": [ ], + "displayMode": "list" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, "pluginVersion": "v11.0.0", "targets": [ { @@ -564,6 +684,8 @@ "fieldConfig": { "defaults": { "custom": { + "fillOpacity": 30, + "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never", @@ -581,6 +703,16 @@ "y": 24 }, "id": 13, + "options": { + "legend": { + "calcs": [ ], + "displayMode": "list" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, "pluginVersion": "v11.0.0", "targets": [ { @@ -635,6 +767,8 @@ "fieldConfig": { "defaults": { "custom": { + "fillOpacity": 30, + "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never", @@ -652,6 +786,16 @@ "y": 24 }, "id": 14, + "options": { + "legend": { + "calcs": [ ], + "displayMode": "list" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, "pluginVersion": "v11.0.0", "targets": [ { @@ -706,6 +850,8 @@ "fieldConfig": { "defaults": { "custom": { + "fillOpacity": 30, + "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never", @@ -723,6 +869,16 @@ "y": 32 }, "id": 15, + "options": { + "legend": { + "calcs": [ ], + "displayMode": "list" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, "pluginVersion": "v11.0.0", "targets": [ { @@ -764,12 +920,11 @@ "fieldConfig": { "defaults": { "custom": { + "fillOpacity": 30, + "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, - "showPoints": "never", - "stacking": { - "mode": "normal" - } + "showPoints": "never" }, "unit": "s" } @@ -781,6 +936,16 @@ "y": 32 }, "id": 16, + "options": { + "legend": { + "calcs": [ ], + "displayMode": "list" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, "pluginVersion": "v11.0.0", "targets": [ { @@ -832,6 +997,8 @@ "fieldConfig": { "defaults": { "custom": { + "fillOpacity": 30, + "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never", @@ -849,6 +1016,16 @@ "y": 32 }, "id": 17, + "options": { + "legend": { + "calcs": [ ], + "displayMode": "list" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, "pluginVersion": "v11.0.0", "targets": [ { diff --git a/squid-mixin/panels.libsonnet b/squid-mixin/panels.libsonnet index 381fe1505..4bc7d8c7a 100644 --- a/squid-mixin/panels.libsonnet +++ b/squid-mixin/panels.libsonnet @@ -8,255 +8,165 @@ local commonlib = import 'common-lib/common/main.libsonnet'; // Client panels clientRequests: - g.panel.timeSeries.new('Client requests') - + g.panel.timeSeries.panelOptions.withDescription('The request rate of client.') - + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') - + g.panel.timeSeries.queryOptions.withTargets([ - signals.overview.clientHTTPRequests.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - ]) - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) - + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + commonlib.panels.generic.timeSeries.base.new( + 'Client requests', + targets=[signals.overview.clientHTTPRequests.asTarget() { interval: '2m', intervalFactor: 2 }], + description='The request rate of client.' + ) + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0) + g.panel.timeSeries.standardOptions.withUnit('reqps'), clientRequestErrors: - g.panel.timeSeries.new('Client request errors') - + g.panel.timeSeries.panelOptions.withDescription('The number of client HTTP errors.') - + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') - + g.panel.timeSeries.queryOptions.withTargets([ - signals.overview.clientHTTPErrors.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - ]) - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) - + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + commonlib.panels.generic.timeSeries.base.new( + 'Client request errors', + targets=[signals.overview.clientHTTPErrors.asTarget() { interval: '2m', intervalFactor: 2 }], + description='The number of client HTTP errors.' + ) + g.panel.timeSeries.standardOptions.withUnit('errors/s'), clientCacheHitRatio: - g.panel.timeSeries.new('Client cache hit ratio') - + g.panel.timeSeries.panelOptions.withDescription('The client cache hit ratio.') - + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') - + g.panel.timeSeries.queryOptions.withTargets([ - signals.overview.clientCacheHitRatio.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - ]) - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) - + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + commonlib.panels.generic.timeSeries.base.new( + 'Client cache hit ratio', + targets=[signals.overview.clientCacheHitRatio.asTarget() { interval: '2m', intervalFactor: 2 }], + description='The client cache hit ratio.' + ) + g.panel.timeSeries.standardOptions.withUnit('percent'), clientRequestSentThroughput: - g.panel.timeSeries.new('Client request sent throughput') - + g.panel.timeSeries.panelOptions.withDescription('The throughput of client HTTP data sent.') - + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') - + g.panel.timeSeries.queryOptions.withTargets([ - signals.overview.clientHTTPSentThroughput.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - ]) - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) - + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + commonlib.panels.generic.timeSeries.base.new( + 'Client request sent throughput', + targets=[signals.overview.clientHTTPSentThroughput.asTarget() { interval: '2m', intervalFactor: 2 }], + description='The throughput of client HTTP data sent.' + ) + g.panel.timeSeries.standardOptions.withUnit('KBs'), clientHTTPReceivedThroughput: - g.panel.timeSeries.new('Client HTTP received throughput') - + g.panel.timeSeries.panelOptions.withDescription('The throughput of client HTTP data received.') - + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') - + g.panel.timeSeries.queryOptions.withTargets([ - signals.overview.clientHTTPReceivedThroughput.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - ]) - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) - + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + commonlib.panels.generic.timeSeries.base.new( + 'Client HTTP received throughput', + targets=[signals.overview.clientHTTPReceivedThroughput.asTarget() { interval: '2m', intervalFactor: 2 }], + description='The throughput of client HTTP data received.' + ) + g.panel.timeSeries.standardOptions.withUnit('KBs'), clientCacheHitThroughput: - g.panel.timeSeries.new('Client cache hit throughput') - + g.panel.timeSeries.panelOptions.withDescription('The throughput of client cache hit.') - + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') - + g.panel.timeSeries.queryOptions.withTargets([ - signals.overview.clientCacheHitThroughput.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - ]) - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) - + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + commonlib.panels.generic.timeSeries.base.new( + 'Client cache hit throughput', + targets=[signals.overview.clientCacheHitThroughput.asTarget() { interval: '2m', intervalFactor: 2 }], + description='The throughput of client cache hit.' + ) + g.panel.timeSeries.standardOptions.withUnit('KBs'), httpRequestServiceTime: - g.panel.timeSeries.new('HTTP request service time') - + g.panel.timeSeries.panelOptions.withDescription('HTTP request service time percentiles.') - + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') - + g.panel.timeSeries.queryOptions.withTargets([ - signals.overview.httpRequestsAll50.asTarget(), - signals.overview.httpRequestsAll75.asTarget(), - signals.overview.httpRequestsAll95.asTarget(), - ]) - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) - + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + commonlib.panels.generic.timeSeries.base.new( + 'HTTP request service time', + targets=[ + signals.overview.httpRequestsAll50.asTarget(), + signals.overview.httpRequestsAll75.asTarget(), + signals.overview.httpRequestsAll95.asTarget(), + ], + description='HTTP request service time percentiles.' + ) + g.panel.timeSeries.standardOptions.withUnit('s'), cacheHitServiceTime: - g.panel.timeSeries.new('Cache hit service time') - + g.panel.timeSeries.panelOptions.withDescription('Cache hits service time percentiles.') - + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') - + g.panel.timeSeries.queryOptions.withTargets([ - signals.overview.cacheHits50.asTarget() - + g.query.prometheus.withIntervalFactor(2), - signals.overview.cacheHits75.asTarget() - + g.query.prometheus.withIntervalFactor(2), - signals.overview.cacheHits95.asTarget() - + g.query.prometheus.withIntervalFactor(2), - ]) - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) - + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + commonlib.panels.generic.timeSeries.base.new( + 'Cache hit service time', + targets=[ + signals.overview.cacheHits50.asTarget() { intervalFactor: 2 }, + signals.overview.cacheHits75.asTarget() { intervalFactor: 2 }, + signals.overview.cacheHits95.asTarget() { intervalFactor: 2 }, + ], + description='Cache hits service time percentiles.' + ) + g.panel.timeSeries.standardOptions.withUnit('s'), cacheMissesServiceTime: - g.panel.timeSeries.new('Cache misses service time') - + g.panel.timeSeries.panelOptions.withDescription('Cache misses service time percentiles.') - + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') - + g.panel.timeSeries.queryOptions.withTargets([ - signals.overview.cacheMisses50.asTarget() - + g.query.prometheus.withIntervalFactor(2), - signals.overview.cacheMisses75.asTarget() - + g.query.prometheus.withIntervalFactor(2), - signals.overview.cacheMisses95.asTarget() - + g.query.prometheus.withIntervalFactor(2), - ]) - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) - + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + commonlib.panels.generic.timeSeries.base.new( + 'Cache misses service time', + targets=[ + signals.overview.cacheMisses50.asTarget() { intervalFactor: 2 }, + signals.overview.cacheMisses75.asTarget() { intervalFactor: 2 }, + signals.overview.cacheMisses95.asTarget() { intervalFactor: 2 }, + ], + description='Cache misses service time percentiles.' + ) + g.panel.timeSeries.standardOptions.withUnit('s'), // Server panels serverRequests: - g.panel.timeSeries.new('Server requests') - + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server requests.') - + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') - + g.panel.timeSeries.queryOptions.withTargets([ - signals.overview.serverFTPRequests.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - signals.overview.serverHTTPRequests.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - signals.overview.serverOtherRequests.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - ]) - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) - + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + commonlib.panels.generic.timeSeries.base.new( + 'Server requests', + targets=[ + signals.overview.serverFTPRequests.asTarget() { interval: '2m', intervalFactor: 2 }, + signals.overview.serverHTTPRequests.asTarget() { interval: '2m', intervalFactor: 2 }, + signals.overview.serverOtherRequests.asTarget() { interval: '2m', intervalFactor: 2 }, + ], + description='The number of HTTP, FTP, and other server requests.' + ) + g.panel.timeSeries.standardOptions.withUnit('reqps') + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), serverRequestErrors: - g.panel.timeSeries.new('Server request errors') - + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server request errors.') - + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') - + g.panel.timeSeries.queryOptions.withTargets([ - signals.overview.serverFTPErrors.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - signals.overview.serverHTTPErrors.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - signals.overview.serverOtherErrors.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - ]) - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) - + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + commonlib.panels.generic.timeSeries.base.new( + 'Server request errors', + targets=[ + signals.overview.serverFTPErrors.asTarget() { interval: '2m', intervalFactor: 2 }, + signals.overview.serverHTTPErrors.asTarget() { interval: '2m', intervalFactor: 2 }, + signals.overview.serverOtherErrors.asTarget() { interval: '2m', intervalFactor: 2 }, + ], + description='The number of HTTP, FTP, and other server request errors.' + ) + g.panel.timeSeries.standardOptions.withUnit('errors/s') + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), serverRequestSentThroughput: - g.panel.timeSeries.new('Server request sent throughput') - + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server sent throughput.') - + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') - + g.panel.timeSeries.queryOptions.withTargets([ - signals.overview.serverFTPSentThroughput.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - signals.overview.serverHTTPSentThroughput.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - signals.overview.serverOtherSentThroughput.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - ]) - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) - + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + commonlib.panels.generic.timeSeries.base.new( + 'Server request sent throughput', + targets=[ + signals.overview.serverFTPSentThroughput.asTarget() { interval: '2m', intervalFactor: 2 }, + signals.overview.serverHTTPSentThroughput.asTarget() { interval: '2m', intervalFactor: 2 }, + signals.overview.serverOtherSentThroughput.asTarget() { interval: '2m', intervalFactor: 2 }, + ], + description='The number of HTTP, FTP, and other server sent throughput.' + ) + g.panel.timeSeries.standardOptions.withUnit('KBs') + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), serverObjectSwap: - g.panel.timeSeries.new('Server object swap') - + g.panel.timeSeries.panelOptions.withDescription('The number of objects read from disk and the number of objects saved to disk.') - + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') - + g.panel.timeSeries.queryOptions.withTargets([ - signals.overview.swapIns.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - signals.overview.swapOuts.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - ]) - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) - + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + commonlib.panels.generic.timeSeries.base.new( + 'Server object swap', + targets=[ + signals.overview.swapIns.asTarget() { interval: '2m', intervalFactor: 2 }, + signals.overview.swapOuts.asTarget() { interval: '2m', intervalFactor: 2 }, + ], + description='The number of objects read from disk and the number of objects saved to disk.' + ) + g.panel.timeSeries.standardOptions.withUnit('cps') + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), dnsLookupServiceTime: - g.panel.timeSeries.new('DNS lookup service time') - + g.panel.timeSeries.panelOptions.withDescription('DNS lookup service time percentiles') - + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') - + g.panel.timeSeries.queryOptions.withTargets([ - signals.overview.dnsLookups50.asTarget() - + g.query.prometheus.withIntervalFactor(2), - signals.overview.dnsLookups75.asTarget() - + g.query.prometheus.withIntervalFactor(2), - signals.overview.dnsLookups95.asTarget() - + g.query.prometheus.withIntervalFactor(2), - ]) - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) - + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') - + g.panel.timeSeries.standardOptions.withUnit('s') - + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), + commonlib.panels.generic.timeSeries.base.new( + 'DNS lookup service time', + targets=[ + signals.overview.dnsLookups50.asTarget() { intervalFactor: 2 }, + signals.overview.dnsLookups75.asTarget() { intervalFactor: 2 }, + signals.overview.dnsLookups95.asTarget() { intervalFactor: 2 }, + ], + description='DNS lookup service time percentiles' + ) + + g.panel.timeSeries.standardOptions.withUnit('s'), + // NOTE: Removed stacking.withMode('normal') - percentiles should not be stacked! serverReceivedThroughput: - g.panel.timeSeries.new('Server received throughput') - + g.panel.timeSeries.panelOptions.withDescription('The number of HTTP, FTP, and other server throughput.') - + g.panel.timeSeries.queryOptions.withDatasource('prometheus', '${prometheus_datasource}') - + g.panel.timeSeries.queryOptions.withTargets([ - signals.overview.serverFTPReceivedThroughput.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - signals.overview.serverHTTPReceivedThroughput.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - signals.overview.serverOtherReceivedThroughput.asTarget() - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2), - ]) - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineInterpolation('smooth') - + g.panel.timeSeries.fieldConfig.defaults.custom.withLineWidth(2) - + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('never') + commonlib.panels.generic.timeSeries.base.new( + 'Server received throughput', + targets=[ + signals.overview.serverFTPReceivedThroughput.asTarget() { interval: '2m', intervalFactor: 2 }, + signals.overview.serverHTTPReceivedThroughput.asTarget() { interval: '2m', intervalFactor: 2 }, + signals.overview.serverOtherReceivedThroughput.asTarget() { interval: '2m', intervalFactor: 2 }, + ], + description='The number of HTTP, FTP, and other server throughput.' + ) + g.panel.timeSeries.standardOptions.withUnit('KBs') + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), }, From 7921f9a53de4611f2917769e01de4f745d98a951 Mon Sep 17 00:00:00 2001 From: Greg Pattison Date: Fri, 21 Nov 2025 13:51:42 -0500 Subject: [PATCH 09/10] Final dashboard output --- squid-mixin/dashboards_out/squid-overview.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/squid-mixin/dashboards_out/squid-overview.json b/squid-mixin/dashboards_out/squid-overview.json index b0fce6970..b35a02586 100644 --- a/squid-mixin/dashboards_out/squid-overview.json +++ b/squid-mixin/dashboards_out/squid-overview.json @@ -36,7 +36,7 @@ "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 30, + "fillOpacity": 0, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, From c0ad3b445a63f4cd2f44e84f997771a3a26c741a Mon Sep 17 00:00:00 2001 From: Greg Pattison Date: Mon, 24 Nov 2025 14:31:34 -0500 Subject: [PATCH 10/10] Updated README to match modernization changes. --- squid-mixin/README.md | 10 +++------- squid-mixin/panels.libsonnet | 1 - 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/squid-mixin/README.md b/squid-mixin/README.md index dc170f662..9574b7755 100644 --- a/squid-mixin/README.md +++ b/squid-mixin/README.md @@ -24,9 +24,7 @@ Squid logs are enabled by default in the `config.libsonnet` and can be removed b ``` { - _config+:: { - enableLokiLogs: false, - }, + enableLokiLogs: false, } ``` @@ -64,10 +62,8 @@ Default thresholds can be configured in `config.libsonnet` ```js { - _config+:: { - alertsCriticalHighPercentageRequestErrors: 5, - alertsWarningLowCacheHitRatio: 85, - }, + alertsCriticalHighPercentageRequestErrors: 5, + alertsWarningLowCacheHitRatio: 85, } ``` diff --git a/squid-mixin/panels.libsonnet b/squid-mixin/panels.libsonnet index 4bc7d8c7a..75feea59a 100644 --- a/squid-mixin/panels.libsonnet +++ b/squid-mixin/panels.libsonnet @@ -13,7 +13,6 @@ local commonlib = import 'common-lib/common/main.libsonnet'; targets=[signals.overview.clientHTTPRequests.asTarget() { interval: '2m', intervalFactor: 2 }], description='The request rate of client.' ) - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0) + g.panel.timeSeries.standardOptions.withUnit('reqps'), clientRequestErrors: