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%%', + }, + }, + }, + }, + }