From 3fa993ee8cabbd0141caf8fe13581a6f3083db08 Mon Sep 17 00:00:00 2001 From: schmikei Date: Mon, 18 Aug 2025 17:44:03 -0400 Subject: [PATCH 1/8] wip --- .../{alerts => }/alerts.libsonnet | 47 +- cloudflare-mixin/config.libsonnet | 39 +- cloudflare-mixin/dashboards.libsonnet | 95 ++ .../cloudflare-geomap-overview.libsonnet | 373 ----- .../cloudflare-worker-overview.libsonnet | 402 ----- .../cloudflare-zone-overview.libsonnet | 1096 ------------- .../dashboards/dashboards.libsonnet | 3 - .../cloudflare-geomap-overview.json | 463 ++---- .../cloudflare-worker-overview.json | 474 ++---- .../cloudflare-zone-overview.json | 1355 ++++++----------- cloudflare-mixin/g.libsonnet | 1 + cloudflare-mixin/jsonnetfile.json | 42 +- cloudflare-mixin/links.libsonnet | 21 + cloudflare-mixin/main.libsonnet | 64 + cloudflare-mixin/mixin.libsonnet | 31 +- cloudflare-mixin/panels.libsonnet | 194 +++ .../prometheus_alerts.yaml | 8 +- cloudflare-mixin/rows.libsonnet | 70 + cloudflare-mixin/signals/geomap.libsonnet | 39 + cloudflare-mixin/signals/pool.libsonnet | 40 + cloudflare-mixin/signals/worker.libsonnet | 67 + cloudflare-mixin/signals/zone.libsonnet | 225 +++ 22 files changed, 1657 insertions(+), 3492 deletions(-) rename cloudflare-mixin/{alerts => }/alerts.libsonnet (54%) create mode 100644 cloudflare-mixin/dashboards.libsonnet delete mode 100644 cloudflare-mixin/dashboards/cloudflare-geomap-overview.libsonnet delete mode 100644 cloudflare-mixin/dashboards/cloudflare-worker-overview.libsonnet delete mode 100644 cloudflare-mixin/dashboards/cloudflare-zone-overview.libsonnet delete mode 100644 cloudflare-mixin/dashboards/dashboards.libsonnet create mode 100644 cloudflare-mixin/g.libsonnet create mode 100644 cloudflare-mixin/links.libsonnet create mode 100644 cloudflare-mixin/main.libsonnet create mode 100644 cloudflare-mixin/panels.libsonnet create mode 100644 cloudflare-mixin/rows.libsonnet create mode 100644 cloudflare-mixin/signals/geomap.libsonnet create mode 100644 cloudflare-mixin/signals/pool.libsonnet create mode 100644 cloudflare-mixin/signals/worker.libsonnet create mode 100644 cloudflare-mixin/signals/zone.libsonnet diff --git a/cloudflare-mixin/alerts/alerts.libsonnet b/cloudflare-mixin/alerts.libsonnet similarity index 54% rename from cloudflare-mixin/alerts/alerts.libsonnet rename to cloudflare-mixin/alerts.libsonnet index cabd2d76d..5ff70cafb 100644 --- a/cloudflare-mixin/alerts/alerts.libsonnet +++ b/cloudflare-mixin/alerts.libsonnet @@ -1,92 +1,77 @@ { - prometheusAlerts+:: { - groups+: [ + new(this): { + groups: [ { name: 'cloudflare-alerts', rules: [ { alert: 'CloudflareHighThreatCount', expr: ||| - sum without (instance) (increase(cloudflare_zone_threats_total[5m])) > %(alertsHighThreatCount)s - ||| % $._config, + sum without (instance) (increase(cloudflare_zone_threats_total{%(filteringSelector)s}[5m])) > %(alertsHighThreatCount)s + ||| % this.config, 'for': '5m', labels: { severity: 'critical', }, annotations: { summary: 'There are detected threats targeting the zone.', - description: - ( - 'The number of detected threats targeting the zone {{$labels.zone}} is {{ printf "%%.0f" $value }} which is greater than the threshold of %(alertsHighThreatCount)s.' - ) % $._config, + description: 'The number of detected threats targeting the zone {{$labels.zone}} is {{ printf "%%.0f" $value }} which is greater than the threshold of %(alertsHighThreatCount)s.' % this.config, }, }, { alert: 'CloudflareHighRequestRate', expr: ||| - sum without (instance) (100 * (rate(cloudflare_zone_requests_total[10m]) / clamp_min(rate(cloudflare_zone_requests_total[50m] offset 10m), 1))) > %(alertsHighRequestRate)s - ||| % $._config, + sum without (instance) (100 * (rate(cloudflare_zone_requests_total{%(filteringSelector)s}[10m]) / clamp_min(rate(cloudflare_zone_requests_total{%(filteringSelector)s}[50m] offset 10m), 1))) > %(alertsHighRequestRate)s + ||| % this.config, 'for': '5m', labels: { severity: 'warning', }, annotations: { summary: 'A high spike in requests is occurring which may indicate an attack or unexpected load.', - description: - ( - 'The rate of requests to {{$labels.zone}} is {{ printf "%%.0f" $value }}%% of the prior 50 minute baseline which is above the threshold of %(alertsHighRequestRate)s%%.' - ) % $._config, + description: 'The rate of requests to {{$labels.zone}} is {{ printf "%%.0f" $value }}%% of the prior 50 minute baseline which is above the threshold of %(alertsHighRequestRate)s%%.' % this.config, }, }, { alert: 'CloudflareHighHTTPErrorCodes', expr: ||| - sum without (instance) (increase(cloudflare_zone_requests_status{status=~"4.*|5.*"}[5m])) > %(alertsHighHTTPErrorCodeCount)s - ||| % $._config, + sum without (instance) (increase(cloudflare_zone_requests_status{%(filteringSelector)s,status=~"4.*|5.*"}[5m])) > %(alertsHighHTTPErrorCodeCount)s + ||| % this.config, 'for': '5m', labels: { severity: 'warning', }, annotations: { summary: 'A high number of 4xx or 5xx HTTP status codes are occurring.', - description: - ( - 'The number of {{$labels.status}} HTTP status codes occurring in the zone {{$labels.zone}} is {{ printf "%%.0f" $value }} which is greater than the threshold of %(alertsHighHTTPErrorCodeCount)s.' - ) % $._config, + description: 'The number of {{$labels.status}} HTTP status codes occurring in the zone {{$labels.zone}} is {{ printf "%%.0f" $value }} which is greater than the threshold of %(alertsHighHTTPErrorCodeCount)s.' % this.config, }, }, { alert: 'CloudflareUnhealthyPools', expr: ||| - sum without (instance, load_balancer_name) (cloudflare_zone_pool_health_status) == 0 - ||| % $._config, + sum without (instance, load_balancer_name) (cloudflare_zone_pool_health_status{%(filteringSelector)s}) == 0 + ||| % this.config, 'for': '5m', labels: { severity: 'critical', }, annotations: { summary: 'There are unhealthy pools.', - description: - ( - 'The pool {{$labels.pool_name}} in zone {{$labels.zone}} is currently down and unhealthy.' - ) % $._config, + description: 'The pool {{$labels.pool_name}} in zone {{$labels.zone}} is currently down and unhealthy.', }, }, { alert: 'CloudflareMetricsDown', expr: ||| up{job="%(alertsMetricsDownJobName)s"} == 0 - ||| % $._config, + ||| % this.config, 'for': '5m', labels: { severity: 'critical', }, annotations: { summary: 'Cloudflare metrics are down.', - description: - ( - 'Grafana is no longer receiving metrics for the Cloudflare integration from instance {{$labels.instance}}.' - ) % $._config, + description: 'Grafana is no longer receiving metrics for the Cloudflare integration from instance {{$labels.instance}}.', }, }, ], diff --git a/cloudflare-mixin/config.libsonnet b/cloudflare-mixin/config.libsonnet index c1911f950..dd1632e4f 100644 --- a/cloudflare-mixin/config.libsonnet +++ b/cloudflare-mixin/config.libsonnet @@ -1,16 +1,33 @@ { - _config+:: { - dashboardTags: ['cloudflare-mixin'], - dashboardPeriod: 'now-30m', - dashboardTimezone: 'default', - dashboardRefresh: '1m', + local this = self, + enableMultiCluster: false, + filteringSelector: 'job=~"integrations/cloudflare"', + groupLabels: ['job', 'cluster', 'zone', 'script_name'], + instanceLabels: ['instance'], - // CloudflareMetricsDown alert filter variable - alertsMetricsDownJobName: 'integrations/cloudflare', + dashboardTags: [self.uid], + legendLabels: ['instance'], + uid: 'cloudflare', + dashboardNamePrefix: 'Cloudflare', - // alerts thresholds - alertsHighThreatCount: 3, // count - alertsHighRequestRate: 150, // percentage - alertsHighHTTPErrorCodeCount: 100, // count + // additional params + dashboardPeriod: 'now-30m', + dashboardTimezone: 'default', + dashboardRefresh: '1m', + metricsSource: 'prometheus', + + // CloudflareMetricsDown alert filter variable + alertsMetricsDownJobName: 'integrations/cloudflare', + + // alerts thresholds + alertsHighThreatCount: 3, // count + alertsHighRequestRate: 150, // percentage + alertsHighHTTPErrorCodeCount: 100, // count + + signals+: { + geomap: (import './signals/geomap.libsonnet')(this), + zone: (import './signals/zone.libsonnet')(this), + worker: (import './signals/worker.libsonnet')(this), + pool: (import './signals/pool.libsonnet')(this), }, } diff --git a/cloudflare-mixin/dashboards.libsonnet b/cloudflare-mixin/dashboards.libsonnet new file mode 100644 index 000000000..a91f79ef5 --- /dev/null +++ b/cloudflare-mixin/dashboards.libsonnet @@ -0,0 +1,95 @@ +local g = import './g.libsonnet'; + +{ + local root = self, + new(this):: + local prefix = this.config.dashboardNamePrefix; + local tags = this.config.dashboardTags; + local uid = this.config.uid; + local vars = this.grafana.variables; + local refresh = this.config.dashboardRefresh; + local period = this.config.dashboardPeriod; + local timezone = this.config.dashboardTimezone; + local links = this.grafana.links; + local annotations = this.grafana.annotations; + + { + 'cloudflare-zone-overview.json': + g.dashboard.new(prefix + ' zone overview') + + g.dashboard.withPanels( + g.util.panel.resolveCollapsedFlagOnRows( + g.util.grid.wrapPanels( + [ + this.grafana.rows.zoneOverview + g.panel.row.withCollapsed(false), + this.grafana.rows.zoneBandwidth + g.panel.row.withCollapsed(false), + this.grafana.rows.zoneVisitors + g.panel.row.withCollapsed(false), + this.grafana.rows.zoneStatusLocation + g.panel.row.withCollapsed(false), + this.grafana.rows.pools + g.panel.row.withCollapsed(false), + ] + ) + ) + ) + + root.applyCommon( + vars.multiInstance + [vars.geoMetric], + uid + '_cloudflare_zone_overview', + tags, + links { cloudflareZoneOverview+:: {} }, + annotations, + timezone, + refresh, + period + ), + + 'cloudflare-worker-overview.json': + g.dashboard.new(prefix + ' worker overview') + + g.dashboard.withPanels( + g.util.panel.resolveCollapsedFlagOnRows( + g.util.grid.wrapPanels( + [ + this.grafana.rows.workers + g.panel.row.withCollapsed(false), + ] + ) + ) + ) + + root.applyCommon( + vars.multiInstance, + uid + '_cloudflare_worker_overview', + tags, + links { cloudflareWorkerOverview+:: {} }, + annotations, + timezone, + refresh, + period + ), + + 'cloudflare-geomap-overview.json': + g.dashboard.new(prefix + ' Geomap overview') + + g.dashboard.withPanels( + g.util.grid.wrapPanels( + [ + this.grafana.panels.geoMetricsByCountryTablePanel + g.panel.table.gridPos.withW(24) + g.panel.table.gridPos.withH(7), + this.grafana.panels.geoMetricByCountryGeomapPanel + g.panel.geomap.gridPos.withW(24) + g.panel.geomap.gridPos.withH(12), + ] + ) + ) + + root.applyCommon( + vars.multiInstance + [vars.geoMetric], + uid + '_cloudflare_geomap_overview', + tags, + links { cloudflareGeomapOverview+:: {} }, + annotations, + timezone, + refresh, + period + ), + }, + applyCommon(vars, uid, tags, links, annotations, timezone, refresh, period): + g.dashboard.withTags(tags) + + g.dashboard.withUid(uid) + + g.dashboard.withLinks(std.objectValues(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/cloudflare-mixin/dashboards/cloudflare-geomap-overview.libsonnet b/cloudflare-mixin/dashboards/cloudflare-geomap-overview.libsonnet deleted file mode 100644 index dfdefcc21..000000000 --- a/cloudflare-mixin/dashboards/cloudflare-geomap-overview.libsonnet +++ /dev/null @@ -1,373 +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 = 'cloudflare-geomap-overview'; - -local promDatasourceName = 'prometheus_datasource'; - -local promDatasource = { - uid: '${%s}' % promDatasourceName, -}; - -local GeoMetricByCountryGeomapPanel = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'increase($geo_metric{job=~"$job", instance=~"$instance", zone=~"$zone"}[$__interval:] offset -$__interval)', - datasource=promDatasource, - legendFormat='', - format='table', - interval='1m', - ), - ], - type: 'geomap', - title: '$geo_metric by country', - id: 3, - description: 'Geomap panel currently showing $geo_metric for the zone.', - fieldConfig: { - defaults: { - color: { - mode: 'continuous-BlPu', - }, - custom: { - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - }, - overrides: [], - }, - options: { - basemap: { - config: {}, - name: 'Layer 0', - type: 'default', - }, - controls: { - mouseWheelZoom: true, - showAttribution: true, - showDebug: false, - showMeasure: false, - showScale: false, - showZoom: true, - }, - layers: [ - { - config: { - showLegend: true, - style: { - color: { - field: 'Total', - fixed: 'dark-green', - }, - opacity: 0.4, - rotation: { - fixed: 0, - max: 360, - min: -360, - mode: 'mod', - }, - size: { - field: 'Total', - fixed: 5, - max: 15, - min: 7, - }, - symbol: { - fixed: 'img/icons/marker/circle.svg', - mode: 'fixed', - }, - symbolAlign: { - horizontal: 'center', - vertical: 'center', - }, - textConfig: { - fontSize: 12, - offsetX: 0, - offsetY: 0, - textAlign: 'center', - textBaseline: 'middle', - }, - }, - }, - location: { - gazetteer: 'public/gazetteer/countries.json', - lookup: 'country', - mode: 'lookup', - }, - name: 'Total', - tooltip: true, - type: 'markers', - }, - ], - tooltip: { - mode: 'multi', - }, - - view: { - allLayers: true, - id: 'zero', - lat: 0, - lon: 0, - zoom: 1, - }, - }, - pluginVersion: '10.2.0-62263', - transformations: [ - { - id: 'groupBy', - options: { - fields: { - Value: { - aggregations: [ - 'sum', - 'mean', - 'lastNotNull', - ], - operation: 'aggregate', - }, - country: { - aggregations: [], - operation: 'groupby', - }, - host: { - aggregations: [], - }, - instance: { - aggregations: [], - operation: 'groupby', - }, - job: { - aggregations: [], - operation: 'groupby', - }, - region: { - aggregations: [], - operation: 'groupby', - }, - status: { - aggregations: [], - operation: 'groupby', - }, - zone: { - aggregations: [], - }, - }, - }, - }, - { - id: 'organize', - options: { - excludeByName: {}, - indexByName: {}, - renameByName: { - 'Value (lastNotNull)': 'Last', - 'Value (mean)': 'Mean', - 'Value (sum)': 'Total', - country: 'Country', - instance: 'Instance', - job: 'Job', - region: 'Region', - status: 'Status', - zone: 'Zone', - }, - }, - }, - ], -}; - -local GeoMetricByCountryTablePanel = { - datasource: { - type: 'datasource', - uid: '-- Dashboard --', - }, - targets: [ - { - datasource: { - type: 'datasource', - uid: '-- Dashboard --', - }, - panelId: GeoMetricByCountryGeomapPanel.id, - refId: 'A', - withTransforms: true, - }, - ], - type: 'table', - title: '$geo_metric by country', - description: 'Table currently showing $geo_metric for the zone.', - fieldConfig: { - defaults: { - color: { - mode: 'thresholds', - }, - custom: { - align: 'auto', - cellOptions: { - type: 'auto', - }, - inspect: false, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - { - color: 'red', - value: 80, - }, - ], - }, - }, - overrides: [ - { - matcher: { - id: 'byRegexp', - options: '/Total|Mean|Last/', - }, - properties: [ - { - id: 'custom.cellOptions', - value: { - mode: 'basic', - type: 'gauge', - valueDisplayMode: 'text', - }, - }, - { - id: 'color', - value: { - mode: 'continuous-BlPu', - }, - }, - ], - }, - ], - }, - options: { - cellHeight: 'sm', - footer: { - countRows: false, - fields: '', - reducer: [ - 'sum', - ], - show: false, - }, - showHeader: true, - sortBy: [ - { - desc: true, - displayName: 'Total', - }, - ], - }, - pluginVersion: '10.2.0-62263', -}; - -{ - grafanaDashboards+:: { - 'cloudflare-geomap-overview.json': - dashboard.new( - 'Cloudflare Geomap overview', - time_from='%s' % $._config.dashboardPeriod, - tags=($._config.dashboardTags), - timezone='%s' % $._config.dashboardTimezone, - refresh='%s' % $._config.dashboardRefresh, - description='', - uid=dashboardUid, - ) - - .addLink(grafana.link.dashboards( - asDropdown=false, - title='Other Cloudflare dashboards', - includeVars=true, - keepTime=true, - tags=($._config.dashboardTags), - )) - - .addTemplates( - [ - template.datasource( - promDatasourceName, - 'prometheus', - null, - label='Data Source', - refresh='load' - ), - template.new( - 'job', - promDatasource, - 'label_values(cloudflare_zone_requests_total,job)', - label='Job', - refresh=2, - includeAll=false, - multi=false, - allValues='', - sort=0 - ), - template.new( - 'instance', - promDatasource, - 'label_values(cloudflare_zone_requests_total{job="$job"},instance)', - label='Instance', - refresh=2, - includeAll=false, - multi=true, - allValues='', - sort=0 - ), - template.new( - 'zone', - promDatasource, - 'label_values(cloudflare_zone_requests_total{job=~"$job", instance=~"$instance"},zone)', - label='Zone', - refresh=2, - includeAll=true, - multi=true, - allValues='.+', - sort=0 - ), - template.custom( - 'geo_metric', - query='cloudflare_zone_requests_country,cloudflare_zone_bandwidth_country,cloudflare_zone_threats_country', - current='cloudflare_zone_requests_country', - refresh='never', - label='Geomap metric', - valuelabels={}, - includeAll=false, - multi=false, - allValues='', - ), - ] - ) - .addPanels( - [ - GeoMetricByCountryTablePanel { gridPos: { h: 7, w: 24, x: 0, y: 0 } }, - GeoMetricByCountryGeomapPanel { gridPos: { h: 24, w: 24, x: 0, y: 7 } }, - ] - ), - }, -} diff --git a/cloudflare-mixin/dashboards/cloudflare-worker-overview.libsonnet b/cloudflare-mixin/dashboards/cloudflare-worker-overview.libsonnet deleted file mode 100644 index 4b1e27711..000000000 --- a/cloudflare-mixin/dashboards/cloudflare-worker-overview.libsonnet +++ /dev/null @@ -1,402 +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 = 'cloudflare-worker-overview'; - -local promDatasourceName = 'prometheus_datasource'; - -local promDatasource = { - uid: '${%s}' % promDatasourceName, -}; - -local workerCPUTimeQuantilesPanel = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'cloudflare_worker_cpu_time{job=~"$job", instance=~"$instance", script_name=~"$script_name"}', - datasource=promDatasource, - legendFormat='{{script_name}} - {{quantile}}', - format='time_series', - ), - ], - type: 'timeseries', - title: 'Worker CPU time quantiles', - description: 'The P50, P75, P99, P999 quantiles for worker CPU time.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisBorderShow: false, - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 10, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - insertNulls: false, - lineInterpolation: 'linear', - lineWidth: 2, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'never', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - ], - }, - unit: 'ms', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'right', - showLegend: true, - }, - tooltip: { - mode: 'multi', - sort: 'desc', - }, - }, -}; - -local workerDurationQuantilesPanel = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'cloudflare_worker_duration{job=~"$job", instance=~"$instance", script_name=~"$script_name"}', - datasource=promDatasource, - legendFormat='{{script_name}} - {{quantile}}', - format='time_series', - ), - ], - type: 'timeseries', - title: 'Worker duration quantiles', - description: 'The P50, P75, P99, P999 quantiles for worker duration.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisBorderShow: false, - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 10, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - insertNulls: false, - lineInterpolation: 'linear', - lineWidth: 2, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'never', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - ], - }, - unit: 's', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'right', - showLegend: true, - }, - tooltip: { - mode: 'multi', - sort: 'desc', - }, - }, -}; - -local workerRequestsPanel = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'rate(cloudflare_worker_requests_count{job=~"$job", instance=~"$instance", script_name=~"$script_name"}[$__rate_interval])', - datasource=promDatasource, - legendFormat='{{script_name}}', - format='time_series', - ), - ], - type: 'timeseries', - title: 'Worker requests', - description: 'The rate of worker requests.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisBorderShow: false, - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 10, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - insertNulls: false, - lineInterpolation: 'linear', - lineWidth: 2, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'never', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - ], - }, - unit: 'reqps', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'multi', - sort: 'desc', - }, - }, -}; - -local workerErrorsPanel = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'increase(cloudflare_worker_errors_count{job=~"$job", instance=~"$instance", script_name=~"$script_name"}[$__interval:])', - datasource=promDatasource, - legendFormat='{{script_name}}', - format='time_series', - interval='1m', - ), - ], - type: 'timeseries', - title: 'Worker errors / $__interval', - description: 'The number of worker errors.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisBorderShow: false, - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 10, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - insertNulls: false, - lineInterpolation: 'linear', - lineWidth: 2, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'never', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - ], - }, - unit: 'none', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'multi', - sort: 'desc', - }, - }, -}; - -{ - grafanaDashboards+:: { - 'cloudflare-worker-overview.json': - dashboard.new( - 'Cloudflare worker overview', - time_from='%s' % $._config.dashboardPeriod, - tags=($._config.dashboardTags), - timezone='%s' % $._config.dashboardTimezone, - refresh='%s' % $._config.dashboardRefresh, - description='', - uid=dashboardUid, - ) - - .addLink(grafana.link.dashboards( - asDropdown=false, - title='Other Cloudflare dashboards', - includeVars=true, - keepTime=true, - tags=($._config.dashboardTags), - )) - - .addTemplates( - [ - template.datasource( - promDatasourceName, - 'prometheus', - null, - label='Data Source', - refresh='load' - ), - template.new( - 'job', - promDatasource, - 'label_values(cloudflare_zone_requests_total,job)', - label='Job', - refresh=2, - includeAll=true, - multi=true, - allValues='.+', - sort=0 - ), - template.new( - 'instance', - promDatasource, - 'label_values(cloudflare_zone_requests_total{job=~"$job"},instance)', - label='Instance', - refresh=2, - includeAll=true, - multi=true, - allValues='.+', - sort=0 - ), - template.new( - 'script_name', - promDatasource, - 'label_values(cloudflare_worker_requests_count{job=~"$job", instance=~"$instance"},script_name)', - label='Script', - refresh=2, - includeAll=true, - multi=true, - allValues='.+', - sort=0 - ), - ] - ) - .addPanels( - [ - workerCPUTimeQuantilesPanel { gridPos: { h: 8, w: 24, x: 0, y: 0 } }, - workerDurationQuantilesPanel { gridPos: { h: 8, w: 24, x: 0, y: 8 } }, - workerRequestsPanel { gridPos: { h: 8, w: 12, x: 0, y: 16 } }, - workerErrorsPanel { gridPos: { h: 8, w: 12, x: 12, y: 16 } }, - ] - ), - }, -} diff --git a/cloudflare-mixin/dashboards/cloudflare-zone-overview.libsonnet b/cloudflare-mixin/dashboards/cloudflare-zone-overview.libsonnet deleted file mode 100644 index f7dc99cde..000000000 --- a/cloudflare-mixin/dashboards/cloudflare-zone-overview.libsonnet +++ /dev/null @@ -1,1096 +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 = 'cloudflare-zone-overview'; - -local promDatasourceName = 'prometheus_datasource'; - -local promDatasource = { - uid: '${%s}' % promDatasourceName, -}; - -local alertsPanel = { - datasource: promDatasource, - targets: [], - type: 'alertlist', - title: 'Alerts', - options: { - alertInstanceLabelFilter: '{job=~"${job:regex}", instance=~"${instance:regex}"}', - alertName: '', - dashboardAlerts: false, - groupBy: [], - groupMode: 'default', - maxItems: 5, - sortOrder: 1, - stateFilter: { - 'error': true, - firing: true, - noData: true, - normal: true, - pending: true, - }, - viewMode: 'list', - }, -}; - -local poolStatusPanel = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'cloudflare_zone_pool_health_status{job=~"$job", instance=~"$instance", zone=~"$zone"}', - datasource=promDatasource, - format='table', - ), - prometheus.target( - 'rate(cloudflare_zone_pool_requests_total{job=~"$job", instance=~"$instance", zone=~"$zone"}[$__rate_interval])', - datasource=promDatasource, - format='table', - ), - ], - type: 'table', - title: 'Pool status', - description: 'A table view of the pools in your zone showing their health and rate of requests.', - fieldConfig: { - defaults: { - color: { - mode: 'thresholds', - }, - custom: { - align: 'left', - cellOptions: { - type: 'auto', - }, - inspect: false, - }, - mappings: [ - { - options: { - 'Health=1': { - index: 0, - text: 'Healthy', - }, - }, - type: 'value', - }, - ], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - ], - }, - unit: 'reqps', - }, - overrides: [ - { - matcher: { - id: 'byName', - options: 'Health', - }, - properties: [ - { - id: 'custom.cellOptions', - value: { - type: 'color-text', - }, - }, - { - id: 'mappings', - value: [ - { - options: { - '0': { - color: 'red', - index: 1, - text: 'Unhealthy', - }, - '1': { - color: 'green', - index: 0, - text: 'Healthy', - }, - }, - type: 'value', - }, - ], - }, - ], - }, - ], - }, - options: { - cellHeight: 'sm', - footer: { - countRows: false, - fields: '', - reducer: [ - 'sum', - ], - show: false, - }, - frameIndex: 0, - showHeader: true, - sortBy: [], - }, - pluginVersion: '10.2.0-61719', - transformations: [ - { - id: 'joinByField', - options: { - byField: 'pool_name', - mode: 'outer', - }, - }, - { - id: 'filterFieldsByName', - options: { - include: { - names: [ - 'pool_name', - 'Value #A', - 'load_balancer_name 2', - 'origin_name', - 'Value #B', - 'zone 2', - ], - }, - }, - }, - { - id: 'organize', - options: { - excludeByName: {}, - indexByName: { - 'Value #A': 5, - 'Value #B': 4, - 'load_balancer_name 2': 1, - origin_name: 2, - pool_name: 0, - 'zone 2': 3, - }, - renameByName: { - 'Value #A': 'Health', - 'Value #B': 'Requests', - 'load_balancer_name 2': 'Load balancer', - origin_name: 'Origin', - pool_name: 'Pool', - 'zone 2': 'Zone', - }, - }, - }, - ], -}; - -local requestRatePanel = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'rate(cloudflare_zone_requests_total{job=~"$job", instance=~"$instance", zone=~"$zone"}[$__rate_interval])', - datasource=promDatasource, - legendFormat='{{zone}}', - ), - ], - type: 'timeseries', - title: 'Request rate', - description: 'The rate at which requests to the zone occur.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisBorderShow: false, - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 10, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - insertNulls: false, - lineInterpolation: 'linear', - lineWidth: 2, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'never', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - ], - }, - unit: 'reqps', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'multi', - sort: 'desc', - }, - }, -}; - -local cachedRequestsPanel = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'increase(cloudflare_zone_requests_cached{job=~"$job", instance=~"$instance", zone=~"$zone"}[$__interval:]) / increase(cloudflare_zone_requests_total{job=~"$job", instance=~"$instance", zone=~"$zone"}[$__interval:])', - datasource=promDatasource, - legendFormat='{{zone}}', - interval='1m', - ), - ], - type: 'timeseries', - title: 'Cached requests / $__interval', - description: 'The percentage of requests to the zone that are cached.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisBorderShow: false, - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 10, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - insertNulls: false, - lineInterpolation: 'linear', - lineWidth: 2, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'never', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'area', - }, - }, - mappings: [], - max: 1, - min: 0, - thresholds: { - mode: 'percentage', - steps: [ - { - color: 'red', - value: null, - }, - { - color: '#EAB839', - value: 50, - }, - { - color: 'green', - value: 80, - }, - ], - }, - unit: 'percentunit', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'multi', - sort: 'desc', - }, - }, -}; - -local threatsPanel = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'increase(cloudflare_zone_threats_total{job=~"$job", instance=~"$instance", zone=~"$zone"}[$__interval:])', - datasource=promDatasource, - legendFormat='{{zone}}', - interval='1m', - ), - ], - type: 'timeseries', - title: 'Threats / $__interval', - description: 'The number of threats that have targeted the zone.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisBorderShow: false, - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 10, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - insertNulls: false, - lineInterpolation: 'linear', - lineWidth: 2, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'never', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - ], - }, - unit: 'none', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'multi', - sort: 'desc', - }, - }, -}; - -local bandwidthRatePanel = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'rate(cloudflare_zone_bandwidth_total{job=~"$job", instance=~"$instance", zone=~"$zone"}[$__rate_interval])', - datasource=promDatasource, - legendFormat='{{zone}}', - ), - ], - type: 'timeseries', - title: 'Bandwidth rate', - description: 'The rate at which all bandwidth in the zone occurs.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisBorderShow: false, - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 10, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - insertNulls: false, - lineInterpolation: 'linear', - lineWidth: 2, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'never', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - ], - }, - unit: 'Bps', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'multi', - sort: 'desc', - }, - }, -}; - -local bandwidthTypePanel = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'increase(cloudflare_zone_bandwidth_ssl_encrypted{job=~"$job", instance=~"$instance", zone=~"$zone"}[$__interval:])', - datasource=promDatasource, - legendFormat='{{zone}} - encrypted', - interval='1m', - ), - prometheus.target( - 'increase(cloudflare_zone_bandwidth_cached{job=~"$job", instance=~"$instance", zone=~"$zone"}[$__interval:])', - datasource=promDatasource, - legendFormat='{{zone}} - cached', - interval='1m', - ), - ], - type: 'timeseries', - title: 'Bandwidth type / $__interval', - description: 'The amount of cached and encrypted bandwidth that occurs in the zone.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisBorderShow: false, - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'bars', - fillOpacity: 10, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - insertNulls: false, - lineInterpolation: 'linear', - lineWidth: 2, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'never', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - ], - }, - unit: 'bytes', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'multi', - sort: 'desc', - }, - }, -}; - -local bandwidthContentTypePanel = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'increase(cloudflare_zone_bandwidth_content_type{job=~"$job", instance=~"$instance", zone=~"$zone"}[$__interval:])', - datasource=promDatasource, - legendFormat='{{zone}} - {{content_type}}', - interval='1m', - ), - ], - type: 'timeseries', - title: 'Bandwidth content type / $__interval', - description: 'The content types that bandwidth is being used for in the zone.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisBorderShow: false, - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'bars', - fillOpacity: 10, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - insertNulls: false, - lineInterpolation: 'linear', - lineWidth: 2, - 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: 'bytes', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'multi', - sort: 'desc', - }, - }, -}; - -local browserPageViewsPanel = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'increase(cloudflare_zone_requests_browser_map_page_views_count{job=~"$job", instance=~"$instance", zone=~"$zone"}[$__interval:])', - datasource=promDatasource, - legendFormat='{{zone}} - {{family}}', - interval='1m', - ), - ], - type: 'timeseries', - title: 'Browser page views / $__interval', - description: 'The number of zone views by browser family.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisBorderShow: false, - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 10, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - insertNulls: false, - lineInterpolation: 'linear', - lineWidth: 2, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'never', - spanNulls: false, - stacking: { - group: 'A', - mode: 'none', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - ], - }, - unit: 'none', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'multi', - sort: 'desc', - }, - }, -}; - -local uniquePageViewsPanel = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'increase(cloudflare_zone_uniques_total{job=~"$job", instance=~"$instance", zone=~"$zone"}[$__interval:])', - datasource=promDatasource, - legendFormat='{{zone}} - unique', - interval='1m', - ), - prometheus.target( - 'increase(cloudflare_zone_pageviews_total{job=~"$job", instance=~"$instance", zone=~"$zone"}[$__interval:]) - increase(cloudflare_zone_uniques_total{job=~"$job", instance=~"$instance", zone=~"$zone"}[$__interval:])', - datasource=promDatasource, - legendFormat='{{zone}} - non-unique', - interval='1m', - ), - ], - type: 'timeseries', - title: 'Unique page views / $__interval', - description: 'The number of unique and total page views.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisBorderShow: false, - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 10, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - insertNulls: false, - lineInterpolation: 'linear', - lineWidth: 2, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'never', - spanNulls: false, - stacking: { - group: 'A', - mode: 'normal', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - ], - }, - unit: 'none', - }, - overrides: [], - }, - options: { - legend: { - calcs: [], - displayMode: 'list', - placement: 'bottom', - showLegend: true, - }, - tooltip: { - mode: 'multi', - sort: 'desc', - }, - }, -}; - -local requestHTTPStatusPanel = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'increase(cloudflare_zone_requests_status{job=~"$job", instance=~"$instance", zone=~"$zone"}[$__interval:])', - datasource=promDatasource, - legendFormat='{{zone}} - {{status}}', - interval='1m', - ), - ], - type: 'timeseries', - title: 'Request HTTP status / $__interval', - description: 'The number of different HTTP status codes used for requests in the zone.', - fieldConfig: { - defaults: { - color: { - mode: 'palette-classic', - }, - custom: { - axisBorderShow: false, - axisCenteredZero: false, - axisColorMode: 'text', - axisLabel: '', - axisPlacement: 'auto', - barAlignment: 0, - drawStyle: 'line', - fillOpacity: 10, - gradientMode: 'none', - hideFrom: { - legend: false, - tooltip: false, - viz: false, - }, - insertNulls: false, - lineInterpolation: 'linear', - lineWidth: 2, - pointSize: 5, - scaleDistribution: { - type: 'linear', - }, - showPoints: 'never', - spanNulls: false, - stacking: { - group: 'A', - mode: 'normal', - }, - thresholdsStyle: { - mode: 'off', - }, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - ], - }, - unit: 'none', - }, - overrides: [], - }, - options: { - legend: { - calcs: [ - 'min', - 'max', - 'mean', - ], - displayMode: 'table', - placement: 'right', - showLegend: true, - }, - tooltip: { - mode: 'multi', - sort: 'desc', - }, - }, -}; - -local colocationRequestsPanel = { - datasource: promDatasource, - targets: [ - prometheus.target( - 'rate(cloudflare_zone_colocation_requests_total{job=~"$job", instance=~"$instance", zone=~"$zone"}[$__rate_interval])', - datasource=promDatasource, - ), - ], - type: 'table', - title: 'Colocation requests', - description: 'The different colocations being used by the zone and their request rates.', - fieldConfig: { - defaults: { - color: { - mode: 'thresholds', - }, - custom: { - align: 'left', - cellOptions: { - type: 'auto', - }, - inspect: false, - }, - mappings: [], - thresholds: { - mode: 'absolute', - steps: [ - { - color: 'green', - value: null, - }, - ], - }, - unit: 'reqps', - }, - overrides: [], - }, - options: { - cellHeight: 'sm', - footer: { - countRows: false, - fields: '', - reducer: [ - 'sum', - ], - show: false, - }, - showHeader: true, - }, - pluginVersion: '10.2.0-61719', - transformations: [ - { - id: 'reduce', - options: { - reducers: [ - 'lastNotNull', - ], - }, - }, - { - id: 'extractFields', - options: { - format: 'auto', - source: 'Field', - }, - }, - { - id: 'organize', - options: { - excludeByName: { - Field: true, - host: true, - instance: true, - job: true, - }, - indexByName: { - Field: 3, - 'Last *': 2, - colocation: 1, - host: 4, - instance: 5, - job: 6, - zone: 0, - }, - renameByName: { - 'Last *': 'Requests', - colocation: 'Colocation', - zone: 'Zone', - }, - }, - }, - ], -}; - -{ - grafanaDashboards+:: { - 'cloudflare-zone-overview.json': - dashboard.new( - 'Cloudflare zone overview', - time_from='%s' % $._config.dashboardPeriod, - tags=($._config.dashboardTags), - timezone='%s' % $._config.dashboardTimezone, - refresh='%s' % $._config.dashboardRefresh, - description='', - uid=dashboardUid, - ) - - .addLink(grafana.link.dashboards( - asDropdown=false, - title='Other Cloudflare dashboards', - includeVars=true, - keepTime=true, - tags=($._config.dashboardTags), - )) - - .addTemplates( - [ - template.datasource( - promDatasourceName, - 'prometheus', - null, - label='Data Source', - refresh='load' - ), - template.new( - 'job', - promDatasource, - 'label_values(cloudflare_zone_requests_total,job)', - label='Job', - refresh=2, - includeAll=true, - multi=true, - allValues='.+', - sort=0 - ), - template.new( - 'instance', - promDatasource, - 'label_values(cloudflare_zone_requests_total{job=~"$job"},instance)', - label='Instance', - refresh=2, - includeAll=true, - multi=true, - allValues='.+', - sort=0 - ), - template.new( - 'zone', - promDatasource, - 'label_values(cloudflare_zone_requests_total{job=~"$job", instance=~"$instance"},zone)', - label='Zone', - refresh=2, - includeAll=true, - multi=true, - allValues='.+', - sort=0 - ), - ] - ) - .addPanels( - [ - alertsPanel { gridPos: { h: 8, w: 12, x: 0, y: 0 } }, - poolStatusPanel { gridPos: { h: 8, w: 12, x: 12, y: 0 } }, - requestRatePanel { gridPos: { h: 8, w: 12, x: 0, y: 8 } }, - cachedRequestsPanel { gridPos: { h: 8, w: 12, x: 12, y: 8 } }, - threatsPanel { gridPos: { h: 8, w: 12, x: 0, y: 16 } }, - bandwidthRatePanel { gridPos: { h: 8, w: 12, x: 12, y: 16 } }, - bandwidthTypePanel { gridPos: { h: 8, w: 12, x: 0, y: 24 } }, - bandwidthContentTypePanel { gridPos: { h: 8, w: 12, x: 12, y: 24 } }, - browserPageViewsPanel { gridPos: { h: 8, w: 12, x: 0, y: 32 } }, - uniquePageViewsPanel { gridPos: { h: 8, w: 12, x: 12, y: 32 } }, - requestHTTPStatusPanel { gridPos: { h: 8, w: 24, x: 0, y: 40 } }, - colocationRequestsPanel { gridPos: { h: 8, w: 24, x: 0, y: 48 } }, - ] - ), - }, -} diff --git a/cloudflare-mixin/dashboards/dashboards.libsonnet b/cloudflare-mixin/dashboards/dashboards.libsonnet deleted file mode 100644 index 38d7fe8f0..000000000 --- a/cloudflare-mixin/dashboards/dashboards.libsonnet +++ /dev/null @@ -1,3 +0,0 @@ -(import 'cloudflare-zone-overview.libsonnet') + -(import 'cloudflare-geomap-overview.libsonnet') + -(import 'cloudflare-worker-overview.libsonnet') diff --git a/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json b/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json index f544f5b4d..374fa6169 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json @@ -1,88 +1,42 @@ { - "__inputs": [ ], - "__requires": [ ], "annotations": { "list": [ ] }, - "description": "", - "editable": false, - "gnetId": null, - "graphTooltip": 0, - "hideControls": false, - "id": null, "links": [ { - "asDropdown": false, - "icon": "external link", + "keepTime": true, + "title": "Geographic overview", + "type": "link", + "url": "/d/cloudflare_cloudflare_geomap_overview" + }, + { + "keepTime": true, + "title": "Worker overview", + "type": "link", + "url": "/d/cloudflare_cloudflare_worker_overview" + }, + { + "keepTime": true, + "title": "Zone overview", + "type": "link", + "url": "/d/cloudflare_cloudflare_zone_overview" + }, + { + "asDropdown": true, "includeVars": true, "keepTime": true, "tags": [ - "cloudflare-mixin" + "cloudflare" ], - "targetBlank": false, - "title": "Other Cloudflare dashboards", - "type": "dashboards", - "url": "" + "title": "All dashboards", + "type": "dashboards" } ], "panels": [ { "datasource": { "type": "datasource", - "uid": "-- Dashboard --" - }, - "description": "Table currently showing $geo_metric for the zone.", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "auto", - "cellOptions": { - "type": "auto" - }, - "inspect": false - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byRegexp", - "options": "/Total|Mean|Last/" - }, - "properties": [ - { - "id": "custom.cellOptions", - "value": { - "mode": "basic", - "type": "gauge", - "valueDisplayMode": "text" - } - }, - { - "id": "color", - "value": { - "mode": "continuous-BlPu" - } - } - ] - } - ] + "uid": "-- Mixed --" }, "gridPos": { "h": 7, @@ -90,346 +44,173 @@ "x": 0, "y": 0 }, - "id": 2, - "options": { - "cellHeight": "sm", - "footer": { - "countRows": false, - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true, - "sortBy": [ - { - "desc": true, - "displayName": "Total" - } - ] - }, - "pluginVersion": "10.2.0-62263", + "id": 1, + "pluginVersion": "v11.4.0", "targets": [ { "datasource": { - "type": "datasource", - "uid": "-- Dashboard --" + "type": "prometheus", + "uid": "${datasource}" }, - "panelId": 3, - "refId": "A", - "withTransforms": true + "expr": "increase(${geo_metric}{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", + "format": "table", + "instant": false, + "interval": "1m", + "legendFormat": "", + "refId": "$geo_metric Distribution" } ], - "title": "$geo_metric by country", + "title": "Geographic Distribution", "type": "table" }, { "datasource": { - "uid": "${prometheus_datasource}" - }, - "description": "Geomap panel currently showing $geo_metric for the zone.", - "fieldConfig": { - "defaults": { - "color": { - "mode": "continuous-BlPu" - }, - "custom": { - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [ ] + "type": "datasource", + "uid": "-- Mixed --" }, "gridPos": { - "h": 24, + "h": 12, "w": 24, "x": 0, - "y": 7 + "y": 12 }, - "id": 3, - "options": { - "basemap": { - "config": { }, - "name": "Layer 0", - "type": "default" - }, - "controls": { - "mouseWheelZoom": true, - "showAttribution": true, - "showDebug": false, - "showMeasure": false, - "showScale": false, - "showZoom": true - }, - "layers": [ - { - "config": { - "showLegend": true, - "style": { - "color": { - "field": "Total", - "fixed": "dark-green" - }, - "opacity": 0.40000000000000002, - "rotation": { - "fixed": 0, - "max": 360, - "min": -360, - "mode": "mod" - }, - "size": { - "field": "Total", - "fixed": 5, - "max": 15, - "min": 7 - }, - "symbol": { - "fixed": "img/icons/marker/circle.svg", - "mode": "fixed" - }, - "symbolAlign": { - "horizontal": "center", - "vertical": "center" - }, - "textConfig": { - "fontSize": 12, - "offsetX": 0, - "offsetY": 0, - "textAlign": "center", - "textBaseline": "middle" - } - } - }, - "location": { - "gazetteer": "public/gazetteer/countries.json", - "lookup": "country", - "mode": "lookup" - }, - "name": "Total", - "tooltip": true, - "type": "markers" - } - ], - "tooltip": { - "mode": "multi" - }, - "view": { - "allLayers": true, - "id": "zero", - "lat": 0, - "lon": 0, - "zoom": 1 - } - }, - "pluginVersion": "10.2.0-62263", + "id": 2, + "pluginVersion": "v11.4.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "increase($geo_metric{job=~\"$job\", instance=~\"$instance\", zone=~\"$zone\"}[$__interval:] offset -$__interval)", + "expr": "increase(${geo_metric}{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "table", + "instant": false, "interval": "1m", - "intervalFactor": 2, - "legendFormat": "" - } - ], - "title": "$geo_metric by country", - "transformations": [ - { - "id": "groupBy", - "options": { - "fields": { - "Value": { - "aggregations": [ - "sum", - "mean", - "lastNotNull" - ], - "operation": "aggregate" - }, - "country": { - "aggregations": [ ], - "operation": "groupby" - }, - "host": { - "aggregations": [ ] - }, - "instance": { - "aggregations": [ ], - "operation": "groupby" - }, - "job": { - "aggregations": [ ], - "operation": "groupby" - }, - "region": { - "aggregations": [ ], - "operation": "groupby" - }, - "status": { - "aggregations": [ ], - "operation": "groupby" - }, - "zone": { - "aggregations": [ ] - } - } - } - }, - { - "id": "organize", - "options": { - "excludeByName": { }, - "indexByName": { }, - "renameByName": { - "Value (lastNotNull)": "Last", - "Value (mean)": "Mean", - "Value (sum)": "Total", - "country": "Country", - "instance": "Instance", - "job": "Job", - "region": "Region", - "status": "Status", - "zone": "Zone" - } - } + "legendFormat": "", + "refId": "$geo_metric Distribution" } ], + "title": "Geographic Distribution", "type": "geomap" } ], "refresh": "1m", - "rows": [ ], - "schemaVersion": 14, - "style": "dark", + "schemaVersion": 39, "tags": [ - "cloudflare-mixin" + "cloudflare" ], "templating": { "list": [ { - "current": { }, - "hide": 0, - "label": "Data Source", - "name": "prometheus_datasource", - "options": [ ], + "label": "Data source", + "name": "datasource", "query": "prometheus", - "refresh": 1, "regex": "", "type": "datasource" }, { - "allValue": "", - "current": { }, + "allValue": ".+", "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "hide": 0, - "includeAll": false, + "includeAll": true, "label": "Job", - "multi": false, + "multi": true, "name": "job", - "options": [ ], - "query": "label_values(cloudflare_zone_requests_total,job)", + "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\"}, job)", "refresh": 2, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "sort": 1, + "type": "query" }, { - "allValue": "", - "current": { }, + "allValue": ".+", "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "hide": 0, - "includeAll": false, - "label": "Instance", + "includeAll": true, + "label": "Cluster", "multi": true, - "name": "instance", - "options": [ ], - "query": "label_values(cloudflare_zone_requests_total{job=\"$job\"},instance)", + "name": "cluster", + "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\"}, cluster)", "refresh": 2, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "sort": 1, + "type": "query" }, { "allValue": ".+", - "current": { }, "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "hide": 0, "includeAll": true, "label": "Zone", "multi": true, "name": "zone", - "options": [ ], - "query": "label_values(cloudflare_zone_requests_total{job=~\"$job\", instance=~\"$instance\"},zone)", + "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\"}, zone)", "refresh": 2, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "sort": 1, + "type": "query" + }, + { + "allValue": ".*", + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "includeAll": true, + "label": "Script", + "multi": true, + "name": "script_name", + "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\"}, script_name)", + "refresh": 2, + "sort": 1, + "type": "query" + }, + { + "allValue": ".+", + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "includeAll": true, + "label": "Instance", + "multi": true, + "name": "instance", + "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\"}, instance)", + "refresh": 2, + "sort": 1, + "type": "query" }, { - "allValue": "", "current": { + "selected": false, "text": "cloudflare_zone_requests_country", "value": "cloudflare_zone_requests_country" }, - "hide": 0, "includeAll": false, "label": "Geomap metric", "multi": false, "name": "geo_metric", "options": [ { + "selected": true, "text": "cloudflare_zone_requests_country", "value": "cloudflare_zone_requests_country" }, { + "selected": false, "text": "cloudflare_zone_bandwidth_country", "value": "cloudflare_zone_bandwidth_country" }, { + "selected": false, "text": "cloudflare_zone_threats_country", "value": "cloudflare_zone_threats_country" } ], - "query": "cloudflare_zone_requests_country,cloudflare_zone_bandwidth_country,cloudflare_zone_threats_country", - "refresh": 0, + "query": "cloudflare_zone_requests_country : cloudflare_zone_requests_country,cloudflare_zone_bandwidth_country : cloudflare_zone_bandwidth_country,cloudflare_zone_threats_country : cloudflare_zone_threats_country", "type": "custom" } ] @@ -438,33 +219,7 @@ "from": "now-30m", "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": "Cloudflare Geomap overview", - "uid": "cloudflare-geomap-overview", - "version": 0 + "uid": "cloudflare_cloudflare_geomap_overview" } \ No newline at end of file diff --git a/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json b/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json index 92b6c8ef2..4ab1ee1e9 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json @@ -1,293 +1,205 @@ { - "__inputs": [ ], - "__requires": [ ], "annotations": { "list": [ ] }, - "description": "", - "editable": false, - "gnetId": null, - "graphTooltip": 0, - "hideControls": false, - "id": null, "links": [ { - "asDropdown": false, - "icon": "external link", + "keepTime": true, + "title": "Geographic overview", + "type": "link", + "url": "/d/cloudflare_cloudflare_geomap_overview" + }, + { + "keepTime": true, + "title": "Worker overview", + "type": "link", + "url": "/d/cloudflare_cloudflare_worker_overview" + }, + { + "keepTime": true, + "title": "Zone overview", + "type": "link", + "url": "/d/cloudflare_cloudflare_zone_overview" + }, + { + "asDropdown": true, "includeVars": true, "keepTime": true, "tags": [ - "cloudflare-mixin" + "cloudflare" ], - "targetBlank": false, - "title": "Other Cloudflare dashboards", - "type": "dashboards", - "url": "" + "title": "All dashboards", + "type": "dashboards" } ], "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 0, + "x": 0, + "y": 0 + }, + "id": 1, + "panels": [ ], + "title": "Workers", + "type": "row" + }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "description": "The P50, P75, P99, P999 quantiles for worker CPU time.", + "description": "CPU time consumed by the worker.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", + "fillOpacity": 54, + "gradientMode": "opacity", + "lineInterpolation": "smooth", "lineWidth": 2, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } + "spanNulls": false }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "ms" - }, - "overrides": [ ] + "unit": "s" + } }, "gridPos": { "h": 8, - "w": 24, + "w": 12, "x": 0, - "y": 0 + "y": 1 }, "id": 2, "options": { "legend": { "calcs": [ ], - "displayMode": "list", - "placement": "right", - "showLegend": true + "displayMode": "list" }, "tooltip": { "mode": "multi", "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "cloudflare_worker_cpu_time{job=~\"$job\", instance=~\"$instance\", script_name=~\"$script_name\"}", + "expr": "cloudflare_worker_cpu_time{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{script_name}} - {{quantile}}" + "instant": false, + "legendFormat": "{{ script_name }} - {{ quantile }}", + "refId": "Worker CPU time" } ], - "title": "Worker CPU time quantiles", + "title": "Worker CPU time", "type": "timeseries" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "description": "The P50, P75, P99, P999 quantiles for worker duration.", + "description": "Duration of worker execution.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", + "fillOpacity": 54, + "gradientMode": "opacity", + "lineInterpolation": "smooth", "lineWidth": 2, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] + "spanNulls": false }, "unit": "s" - }, - "overrides": [ ] + } }, "gridPos": { "h": 8, - "w": 24, - "x": 0, - "y": 8 + "w": 12, + "x": 12, + "y": 1 }, "id": 3, "options": { "legend": { "calcs": [ ], - "displayMode": "list", - "placement": "right", - "showLegend": true + "displayMode": "list" }, "tooltip": { "mode": "multi", "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "cloudflare_worker_duration{job=~\"$job\", instance=~\"$instance\", script_name=~\"$script_name\"}", + "expr": "cloudflare_worker_duration{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{script_name}} - {{quantile}}" + "instant": false, + "legendFormat": "{{ script_name }} - {{ quantile }}", + "refId": "Worker duration" } ], - "title": "Worker duration quantiles", + "title": "Worker duration", "type": "timeseries" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "description": "The rate of worker requests.", + "description": "Rate of requests to the worker.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", + "fillOpacity": 0, + "gradientMode": "opacity", + "lineInterpolation": "smooth", "lineWidth": 2, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] + "spanNulls": false }, "unit": "reqps" - }, - "overrides": [ ] + } }, "gridPos": { "h": 8, "w": 12, "x": 0, - "y": 16 + "y": 9 }, "id": 4, "options": { "legend": { "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "displayMode": "list" }, "tooltip": { "mode": "multi", "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(cloudflare_worker_requests_count{job=~\"$job\", instance=~\"$instance\", script_name=~\"$script_name\"}[$__rate_interval])", + "expr": "rate(cloudflare_worker_requests_count{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{script_name}}" + "instant": false, + "legendFormat": "{{ script_name }}", + "refId": "Worker requests" } ], "title": "Worker requests", @@ -295,180 +207,146 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "description": "The number of worker errors.", + "description": "Number of errors from the worker.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", + "fillOpacity": 0, + "gradientMode": "opacity", + "lineInterpolation": "smooth", "lineWidth": 2, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] + "spanNulls": false }, - "unit": "none" - }, - "overrides": [ ] + "unit": "short" + } }, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 16 + "y": 9 }, "id": 5, "options": { "legend": { "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "displayMode": "list" }, "tooltip": { "mode": "multi", "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "increase(cloudflare_worker_errors_count{job=~\"$job\", instance=~\"$instance\", script_name=~\"$script_name\"}[$__interval:])", + "expr": "increase(cloudflare_worker_errors_count{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{script_name}}" + "instant": false, + "legendFormat": "{{ script_name }}", + "refId": "Worker errors" } ], - "title": "Worker errors / $__interval", + "title": "Worker errors", "type": "timeseries" } ], "refresh": "1m", - "rows": [ ], - "schemaVersion": 14, - "style": "dark", + "schemaVersion": 39, "tags": [ - "cloudflare-mixin" + "cloudflare" ], "templating": { "list": [ { - "current": { }, - "hide": 0, - "label": "Data Source", - "name": "prometheus_datasource", - "options": [ ], + "label": "Data source", + "name": "datasource", "query": "prometheus", - "refresh": 1, "regex": "", "type": "datasource" }, { "allValue": ".+", - "current": { }, "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "hide": 0, "includeAll": true, "label": "Job", "multi": true, "name": "job", - "options": [ ], - "query": "label_values(cloudflare_zone_requests_total,job)", + "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\"}, job)", "refresh": 2, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "sort": 1, + "type": "query" }, { "allValue": ".+", - "current": { }, "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "hide": 0, "includeAll": true, - "label": "Instance", + "label": "Cluster", "multi": true, - "name": "instance", - "options": [ ], - "query": "label_values(cloudflare_zone_requests_total{job=~\"$job\"},instance)", + "name": "cluster", + "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\"}, cluster)", "refresh": 2, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "sort": 1, + "type": "query" }, { "allValue": ".+", - "current": { }, "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" + }, + "includeAll": true, + "label": "Zone", + "multi": true, + "name": "zone", + "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\"}, zone)", + "refresh": 2, + "sort": 1, + "type": "query" + }, + { + "allValue": ".*", + "datasource": { + "type": "prometheus", + "uid": "${datasource}" }, - "hide": 0, "includeAll": true, "label": "Script", "multi": true, "name": "script_name", - "options": [ ], - "query": "label_values(cloudflare_worker_requests_count{job=~\"$job\", instance=~\"$instance\"},script_name)", + "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\"}, script_name)", "refresh": 2, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "sort": 1, + "type": "query" + }, + { + "allValue": ".+", + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "includeAll": true, + "label": "Instance", + "multi": true, + "name": "instance", + "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\"}, instance)", + "refresh": 2, + "sort": 1, + "type": "query" } ] }, @@ -476,33 +354,7 @@ "from": "now-30m", "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": "Cloudflare worker overview", - "uid": "cloudflare-worker-overview", - "version": 0 + "uid": "cloudflare_cloudflare_worker_overview" } \ No newline at end of file diff --git a/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json b/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json index 93d977e14..ee57c6efe 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json @@ -1,1269 +1,866 @@ { - "__inputs": [ ], - "__requires": [ ], "annotations": { "list": [ ] }, - "description": "", - "editable": false, - "gnetId": null, - "graphTooltip": 0, - "hideControls": false, - "id": null, "links": [ { - "asDropdown": false, - "icon": "external link", + "keepTime": true, + "title": "Geographic overview", + "type": "link", + "url": "/d/cloudflare_cloudflare_geomap_overview" + }, + { + "keepTime": true, + "title": "Worker overview", + "type": "link", + "url": "/d/cloudflare_cloudflare_worker_overview" + }, + { + "keepTime": true, + "title": "Zone overview", + "type": "link", + "url": "/d/cloudflare_cloudflare_zone_overview" + }, + { + "asDropdown": true, "includeVars": true, "keepTime": true, "tags": [ - "cloudflare-mixin" + "cloudflare" ], - "targetBlank": false, - "title": "Other Cloudflare dashboards", - "type": "dashboards", - "url": "" + "title": "All dashboards", + "type": "dashboards" } ], "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 0, + "x": 0, + "y": 0 + }, + "id": 1, + "panels": [ ], + "title": "Zone overview", + "type": "row" + }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" + }, + "description": "Rate of requests to the zone.", + "fieldConfig": { + "defaults": { + "custom": { + "fillOpacity": 0, + "gradientMode": "opacity", + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never", + "spanNulls": false + }, + "unit": "reqps" + } }, "gridPos": { "h": 8, "w": 12, "x": 0, - "y": 0 + "y": 1 }, "id": 2, "options": { - "alertInstanceLabelFilter": "{job=~\"${job:regex}\", instance=~\"${instance:regex}\"}", - "alertName": "", - "dashboardAlerts": false, - "groupBy": [ ], - "groupMode": "default", - "maxItems": 5, - "sortOrder": 1, - "stateFilter": { - "error": true, - "firing": true, - "noData": true, - "normal": true, - "pending": true + "legend": { + "calcs": [ ], + "displayMode": "list" }, - "viewMode": "list" + "tooltip": { + "mode": "multi", + "sort": "desc" + } }, - "targets": [ ], - "title": "Alerts", - "type": "alertlist" + "pluginVersion": "v11.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "expr": "rate(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "format": "time_series", + "instant": false, + "legendFormat": "{{ zone }}", + "refId": "Zone requests total" + } + ], + "title": "Requests", + "type": "timeseries" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "description": "A table view of the pools in your zone showing their health and rate of requests.", + "description": "Percentage of cached requests.", "fieldConfig": { "defaults": { - "color": { - "mode": "thresholds" - }, "custom": { - "align": "left", - "cellOptions": { - "type": "auto" - }, - "inspect": false - }, - "mappings": [ - { - "options": { - "Health=1": { - "index": 0, - "text": "Healthy" - } - }, - "type": "value" - } - ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] + "fillOpacity": 0, + "gradientMode": "opacity", + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never", + "spanNulls": false }, - "unit": "reqps" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Health" - }, - "properties": [ - { - "id": "custom.cellOptions", - "value": { - "type": "color-text" - } - }, - { - "id": "mappings", - "value": [ - { - "options": { - "0": { - "color": "red", - "index": 1, - "text": "Unhealthy" - }, - "1": { - "color": "green", - "index": 0, - "text": "Healthy" - } - }, - "type": "value" - } - ] - } - ] - } - ] + "unit": "percent" + } }, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 0 + "y": 1 }, "id": 3, "options": { - "cellHeight": "sm", - "footer": { - "countRows": false, - "fields": "", - "reducer": [ - "sum" - ], - "show": false + "legend": { + "calcs": [ ], + "displayMode": "list" }, - "frameIndex": 0, - "showHeader": true, - "sortBy": [ ] + "tooltip": { + "mode": "multi", + "sort": "desc" + } }, - "pluginVersion": "10.2.0-61719", + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "cloudflare_zone_pool_health_status{job=~\"$job\", instance=~\"$instance\", zone=~\"$zone\"}", - "format": "table", - "intervalFactor": 2, - "legendFormat": "" - }, - { - "datasource": { - "uid": "${prometheus_datasource}" - }, - "expr": "rate(cloudflare_zone_pool_requests_total{job=~\"$job\", instance=~\"$instance\", zone=~\"$zone\"}[$__rate_interval])", - "format": "table", - "intervalFactor": 2, - "legendFormat": "" - } - ], - "title": "Pool status", - "transformations": [ - { - "id": "joinByField", - "options": { - "byField": "pool_name", - "mode": "outer" - } - }, - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "pool_name", - "Value #A", - "load_balancer_name 2", - "origin_name", - "Value #B", - "zone 2" - ] - } - } - }, - { - "id": "organize", - "options": { - "excludeByName": { }, - "indexByName": { - "Value #A": 5, - "Value #B": 4, - "load_balancer_name 2": 1, - "origin_name": 2, - "pool_name": 0, - "zone 2": 3 - }, - "renameByName": { - "Value #A": "Health", - "Value #B": "Requests", - "load_balancer_name 2": "Load balancer", - "origin_name": "Origin", - "pool_name": "Pool", - "zone 2": "Zone" - } - } + "expr": "increase(cloudflare_zone_requests_cached{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:]) / increase(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:])", + "format": "time_series", + "instant": false, + "legendFormat": "{{ zone }}", + "refId": "Zone cached requests" } ], - "type": "table" + "title": "Cached requests", + "type": "timeseries" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "description": "The rate at which requests to the zone occur.", + "description": "Number of threats blocked.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", + "fillOpacity": 0, + "gradientMode": "opacity", + "lineInterpolation": "smooth", "lineWidth": 2, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] + "spanNulls": false }, - "unit": "reqps" - }, - "overrides": [ ] + "unit": "short" + } }, "gridPos": { "h": 8, "w": 12, "x": 0, - "y": 8 + "y": 9 }, "id": 4, "options": { "legend": { "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "displayMode": "list" }, "tooltip": { "mode": "multi", "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_requests_total{job=~\"$job\", instance=~\"$instance\", zone=~\"$zone\"}[$__rate_interval])", + "expr": "rate(cloudflare_zone_threats_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{zone}}" + "instant": false, + "legendFormat": "{{ zone }}", + "refId": "Zone threats" } ], - "title": "Request rate", + "title": "Threats", "type": "timeseries" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "description": "The percentage of requests to the zone that are cached.", + "description": "Total bandwidth usage.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", + "fillOpacity": 54, + "gradientMode": "opacity", + "lineInterpolation": "smooth", "lineWidth": 2, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "area" - } + "spanNulls": false }, - "mappings": [ ], - "max": 1, - "min": 0, - "thresholds": { - "mode": "percentage", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "#EAB839", - "value": 50 - }, - { - "color": "green", - "value": 80 - } - ] - }, - "unit": "percentunit" - }, - "overrides": [ ] + "unit": "bytes" + } }, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 8 + "y": 9 }, "id": 5, "options": { "legend": { "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "displayMode": "list" }, "tooltip": { "mode": "multi", "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "increase(cloudflare_zone_requests_cached{job=~\"$job\", instance=~\"$instance\", zone=~\"$zone\"}[$__interval:]) / increase(cloudflare_zone_requests_total{job=~\"$job\", instance=~\"$instance\", zone=~\"$zone\"}[$__interval:])", + "expr": "rate(cloudflare_zone_bandwidth_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{zone}}" + "instant": false, + "legendFormat": "{{ zone }}", + "refId": "Zone bandwidth" } ], - "title": "Cached requests / $__interval", + "title": "Bandwidth", "type": "timeseries" }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 0, + "x": 0, + "y": 17 + }, + "id": 6, + "panels": [ ], + "title": "Zone bandwidth", + "type": "row" + }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "description": "The number of threats that have targeted the zone.", + "description": "SSL encrypted and cached bandwidth.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", + "fillOpacity": 54, + "gradientMode": "opacity", + "lineInterpolation": "smooth", "lineWidth": 2, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] + "spanNulls": false }, - "unit": "none" - }, - "overrides": [ ] + "unit": "bytes" + } }, "gridPos": { "h": 8, "w": 12, "x": 0, - "y": 16 + "y": 18 }, - "id": 6, + "id": 7, "options": { "legend": { "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "displayMode": "list" }, "tooltip": { "mode": "multi", "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "increase(cloudflare_zone_threats_total{job=~\"$job\", instance=~\"$instance\", zone=~\"$zone\"}[$__interval:])", + "expr": "rate(cloudflare_zone_bandwidth_ssl_encrypted{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{zone}}" + "instant": false, + "legendFormat": "{{ zone }}", + "refId": "Zone SSL encrypted bandwidth" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "expr": "rate(cloudflare_zone_bandwidth_cached{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "format": "time_series", + "instant": false, + "legendFormat": "{{ zone }}", + "refId": "Zone cached bandwidth" } ], - "title": "Threats / $__interval", + "title": "SSL encrypted bandwidth", "type": "timeseries" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "description": "The rate at which all bandwidth in the zone occurs.", + "description": "Bandwidth usage by content type.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", + "fillOpacity": 54, + "gradientMode": "opacity", + "lineInterpolation": "smooth", "lineWidth": 2, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] + "spanNulls": false }, - "unit": "Bps" - }, - "overrides": [ ] + "unit": "bytes" + } }, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 16 + "y": 18 }, - "id": 7, + "id": 8, "options": { "legend": { "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "displayMode": "list" }, "tooltip": { "mode": "multi", "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_bandwidth_total{job=~\"$job\", instance=~\"$instance\", zone=~\"$zone\"}[$__rate_interval])", + "expr": "rate(cloudflare_zone_bandwidth_content_type{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "{{zone}}" + "instant": false, + "legendFormat": "{{ content_type }}", + "refId": "Zone bandwidth by content type" } ], - "title": "Bandwidth rate", + "title": "Bandwidth by content type", "type": "timeseries" }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 0, + "x": 0, + "y": 26 + }, + "id": 9, + "panels": [ ], + "title": "Zone visitors", + "type": "row" + }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "description": "The amount of cached and encrypted bandwidth that occurs in the zone.", + "description": "Unique and repeat visitors.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "bars", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", + "fillOpacity": 54, + "gradientMode": "opacity", + "lineInterpolation": "smooth", "lineWidth": 2, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] + "spanNulls": false }, - "unit": "bytes" - }, - "overrides": [ ] + "unit": "short" + } }, "gridPos": { "h": 8, "w": 12, "x": 0, - "y": 24 + "y": 27 }, - "id": 8, + "id": 10, "options": { "legend": { "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "displayMode": "list" }, "tooltip": { "mode": "multi", "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "increase(cloudflare_zone_bandwidth_ssl_encrypted{job=~\"$job\", instance=~\"$instance\", zone=~\"$zone\"}[$__interval:])", + "expr": "rate(cloudflare_zone_uniques_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{zone}} - encrypted" + "instant": false, + "legendFormat": "{{ zone }}", + "refId": "Zone unique visitors" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "increase(cloudflare_zone_bandwidth_cached{job=~\"$job\", instance=~\"$instance\", zone=~\"$zone\"}[$__interval:])", + "expr": "cloudflare_zone_pageviews_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"} - cloudflare_zone_uniques_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{zone}} - cached" + "instant": false, + "legendFormat": "{{ zone }}", + "refId": "Zone repeat visitors" } ], - "title": "Bandwidth type / $__interval", + "title": "Unique visitors", "type": "timeseries" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "description": "The content types that bandwidth is being used for in the zone.", + "description": "Browser map pageviews count.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "bars", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", + "fillOpacity": 54, + "gradientMode": "opacity", + "lineInterpolation": "smooth", "lineWidth": 2, - "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 - } - ] + "showPoints": "never", + "spanNulls": false }, - "unit": "bytes" - }, - "overrides": [ ] + "unit": "short" + } }, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 24 + "y": 27 }, - "id": 9, + "id": 11, "options": { "legend": { "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "displayMode": "list" }, "tooltip": { "mode": "multi", "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "increase(cloudflare_zone_bandwidth_content_type{job=~\"$job\", instance=~\"$instance\", zone=~\"$zone\"}[$__interval:])", + "expr": "rate(cloudflare_zone_requests_browser_map_page_views_count{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{zone}} - {{content_type}}" + "instant": false, + "legendFormat": "{{ zone }}", + "refId": "Zone browser map pageviews" } ], - "title": "Bandwidth content type / $__interval", + "title": "Browser map pageviews", "type": "timeseries" }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 0, + "x": 0, + "y": 35 + }, + "id": 12, + "panels": [ ], + "title": "Zone status and location", + "type": "row" + }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "description": "The number of zone views by browser family.", + "description": "Requests broken down by HTTP status code.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", + "fillOpacity": 54, + "gradientMode": "opacity", + "lineInterpolation": "smooth", "lineWidth": 2, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] + "spanNulls": false }, - "unit": "none" - }, - "overrides": [ ] + "unit": "short" + } }, "gridPos": { "h": 8, "w": 12, "x": 0, - "y": 32 + "y": 36 }, - "id": 10, + "id": 13, "options": { "legend": { "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "displayMode": "list" }, "tooltip": { "mode": "multi", "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "increase(cloudflare_zone_requests_browser_map_page_views_count{job=~\"$job\", instance=~\"$instance\", zone=~\"$zone\"}[$__interval:])", + "expr": "rate(cloudflare_zone_requests_status{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{zone}} - {{family}}" + "instant": false, + "legendFormat": "{{ status }}", + "refId": "Zone requests by status" } ], - "title": "Browser page views / $__interval", + "title": "Requests by status", "type": "timeseries" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "description": "The number of unique and total page views.", + "description": "Requests by colocation center.", "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", + "fillOpacity": 0, + "gradientMode": "opacity", + "lineInterpolation": "smooth", "lineWidth": 2, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "normal" - }, - "thresholdsStyle": { - "mode": "off" - } + "spanNulls": false }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] - }, - "unit": "none" - }, - "overrides": [ ] + "unit": "reqps" + } }, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 32 + "y": 36 }, - "id": 11, + "id": 14, "options": { "legend": { "calcs": [ ], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "displayMode": "list" }, "tooltip": { "mode": "multi", "sort": "desc" } }, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" - }, - "expr": "increase(cloudflare_zone_uniques_total{job=~\"$job\", instance=~\"$instance\", zone=~\"$zone\"}[$__interval:])", - "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{zone}} - unique" - }, - { - "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "increase(cloudflare_zone_pageviews_total{job=~\"$job\", instance=~\"$instance\", zone=~\"$zone\"}[$__interval:]) - increase(cloudflare_zone_uniques_total{job=~\"$job\", instance=~\"$instance\", zone=~\"$zone\"}[$__interval:])", + "expr": "rate(cloudflare_zone_colocation_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{zone}} - non-unique" + "instant": false, + "legendFormat": "{{ colo_code }}", + "refId": "Zone colocation requests" } ], - "title": "Unique page views / $__interval", + "title": "Requests by colocation", "type": "timeseries" }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 0, + "x": 0, + "y": 44 + }, + "id": 15, + "panels": [ ], + "title": "Load balancer pools", + "type": "row" + }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "description": "The number of different HTTP status codes used for requests in the zone.", + "description": "Health status of the pool (0=unhealthy, 1=healthy).", "fieldConfig": { "defaults": { "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 2, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "normal" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] + "fixedColor": "text", + "mode": "fixed" }, - "unit": "none" - }, - "overrides": [ ] + "unit": "short" + } }, "gridPos": { "h": 8, - "w": 24, + "w": 12, "x": 0, - "y": 40 - }, - "id": 12, - "options": { - "legend": { - "calcs": [ - "min", - "max", - "mean" - ], - "displayMode": "table", - "placement": "right", - "showLegend": true - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } + "y": 45 }, + "id": 16, + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "increase(cloudflare_zone_requests_status{job=~\"$job\", instance=~\"$instance\", zone=~\"$zone\"}[$__interval:])", + "expr": "cloudflare_zone_pool_health_status{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}", "format": "time_series", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{zone}} - {{status}}" + "instant": false, + "legendFormat": "{{ pool_name }}", + "refId": "Pool status" } ], - "title": "Request HTTP status / $__interval", - "type": "timeseries" + "title": "Pool health status", + "type": "stat" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "description": "The different colocations being used by the zone and their request rates.", + "description": "Rate of requests to the pool.", "fieldConfig": { "defaults": { - "color": { - "mode": "thresholds" - }, "custom": { - "align": "left", - "cellOptions": { - "type": "auto" - }, - "inspect": false - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] + "fillOpacity": 0, + "gradientMode": "opacity", + "lineInterpolation": "smooth", + "lineWidth": 2, + "showPoints": "never", + "spanNulls": false }, "unit": "reqps" - }, - "overrides": [ ] + } }, "gridPos": { "h": 8, - "w": 24, - "x": 0, - "y": 48 + "w": 12, + "x": 12, + "y": 45 }, - "id": 13, + "id": 17, "options": { - "cellHeight": "sm", - "footer": { - "countRows": false, - "fields": "", - "reducer": [ - "sum" - ], - "show": false + "legend": { + "calcs": [ ], + "displayMode": "list" }, - "showHeader": true + "tooltip": { + "mode": "multi", + "sort": "desc" + } }, - "pluginVersion": "10.2.0-61719", + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_colocation_requests_total{job=~\"$job\", instance=~\"$instance\", zone=~\"$zone\"}[$__rate_interval])", + "expr": "rate(cloudflare_zone_pool_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", - "intervalFactor": 2, - "legendFormat": "" + "instant": false, + "legendFormat": "{{ pool_name }}", + "refId": "Request rate" } ], - "title": "Colocation requests", - "transformations": [ - { - "id": "reduce", - "options": { - "reducers": [ - "lastNotNull" - ] - } - }, - { - "id": "extractFields", - "options": { - "format": "auto", - "source": "Field" - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Field": true, - "host": true, - "instance": true, - "job": true - }, - "indexByName": { - "Field": 3, - "Last *": 2, - "colocation": 1, - "host": 4, - "instance": 5, - "job": 6, - "zone": 0 - }, - "renameByName": { - "Last *": "Requests", - "colocation": "Colocation", - "zone": "Zone" - } - } - } - ], - "type": "table" + "title": "Pool requests", + "type": "timeseries" } ], "refresh": "1m", - "rows": [ ], - "schemaVersion": 14, - "style": "dark", + "schemaVersion": 39, "tags": [ - "cloudflare-mixin" + "cloudflare" ], "templating": { "list": [ { - "current": { }, - "hide": 0, - "label": "Data Source", - "name": "prometheus_datasource", - "options": [ ], + "label": "Data source", + "name": "datasource", "query": "prometheus", - "refresh": 1, "regex": "", "type": "datasource" }, { "allValue": ".+", - "current": { }, "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "hide": 0, "includeAll": true, "label": "Job", "multi": true, "name": "job", - "options": [ ], - "query": "label_values(cloudflare_zone_requests_total,job)", + "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\"}, job)", "refresh": 2, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "sort": 1, + "type": "query" }, { "allValue": ".+", - "current": { }, "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "hide": 0, "includeAll": true, - "label": "Instance", + "label": "Cluster", "multi": true, - "name": "instance", - "options": [ ], - "query": "label_values(cloudflare_zone_requests_total{job=~\"$job\"},instance)", + "name": "cluster", + "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\"}, cluster)", "refresh": 2, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "sort": 1, + "type": "query" }, { "allValue": ".+", - "current": { }, "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "hide": 0, "includeAll": true, "label": "Zone", "multi": true, "name": "zone", - "options": [ ], - "query": "label_values(cloudflare_zone_requests_total{job=~\"$job\", instance=~\"$instance\"},zone)", + "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\"}, zone)", "refresh": 2, - "regex": "", - "sort": 0, - "tagValuesQuery": "", - "tags": [ ], - "tagsQuery": "", - "type": "query", - "useTags": false + "sort": 1, + "type": "query" + }, + { + "allValue": ".*", + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "includeAll": true, + "label": "Script", + "multi": true, + "name": "script_name", + "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\"}, script_name)", + "refresh": 2, + "sort": 1, + "type": "query" + }, + { + "allValue": ".+", + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "includeAll": true, + "label": "Instance", + "multi": true, + "name": "instance", + "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\"}, instance)", + "refresh": 2, + "sort": 1, + "type": "query" + }, + { + "current": { + "selected": false, + "text": "cloudflare_zone_requests_country", + "value": "cloudflare_zone_requests_country" + }, + "includeAll": false, + "label": "Geomap metric", + "multi": false, + "name": "geo_metric", + "options": [ + { + "selected": true, + "text": "cloudflare_zone_requests_country", + "value": "cloudflare_zone_requests_country" + }, + { + "selected": false, + "text": "cloudflare_zone_bandwidth_country", + "value": "cloudflare_zone_bandwidth_country" + }, + { + "selected": false, + "text": "cloudflare_zone_threats_country", + "value": "cloudflare_zone_threats_country" + } + ], + "query": "cloudflare_zone_requests_country : cloudflare_zone_requests_country,cloudflare_zone_bandwidth_country : cloudflare_zone_bandwidth_country,cloudflare_zone_threats_country : cloudflare_zone_threats_country", + "type": "custom" } ] }, @@ -1271,33 +868,7 @@ "from": "now-30m", "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": "Cloudflare zone overview", - "uid": "cloudflare-zone-overview", - "version": 0 + "uid": "cloudflare_cloudflare_zone_overview" } \ No newline at end of file diff --git a/cloudflare-mixin/g.libsonnet b/cloudflare-mixin/g.libsonnet new file mode 100644 index 000000000..e6a2060ee --- /dev/null +++ b/cloudflare-mixin/g.libsonnet @@ -0,0 +1 @@ +import 'github.com/grafana/grafonnet/gen/grafonnet-v11.4.0/main.libsonnet' diff --git a/cloudflare-mixin/jsonnetfile.json b/cloudflare-mixin/jsonnetfile.json index 65cebf84b..ed5d20a29 100644 --- a/cloudflare-mixin/jsonnetfile.json +++ b/cloudflare-mixin/jsonnetfile.json @@ -1,15 +1,33 @@ { - "version": 1, - "dependencies": [ - { - "source": { - "git": { - "remote": "https://github.com/grafana/grafonnet-lib.git", - "subdir": "grafonnet" - } - }, - "version": "master" + "version": 1, + "dependencies": [ + { + "source": { + "git": { + "remote": "https://github.com/grafana/jsonnet-libs.git", + "subdir": "common-lib" } - ], - "legacyImports": true + }, + "version": "master" + }, + { + "source": { + "git": { + "remote": "https://github.com/grafana/grafonnet.git", + "subdir": "gen/grafonnet-v11.4.0" + } + }, + "version": "main" + }, + { + "source": { + "git": { + "remote": "https://github.com/grafana/jsonnet-libs.git", + "subdir": "grafana-cloud-integration-utils" + } + }, + "version": "master" + } + ], + "legacyImports": true } diff --git a/cloudflare-mixin/links.libsonnet b/cloudflare-mixin/links.libsonnet new file mode 100644 index 000000000..b35cb1f9a --- /dev/null +++ b/cloudflare-mixin/links.libsonnet @@ -0,0 +1,21 @@ +local g = import './g.libsonnet'; + +{ + local link = g.dashboard.link, + new(this): { + cloudflareZone: + link.link.new('Zone overview', '/d/' + this.grafana.dashboards['cloudflare-zone-overview.json'].uid) + + link.link.options.withKeepTime(true), + cloudflareWorker: + link.link.new('Worker overview', '/d/' + this.grafana.dashboards['cloudflare-worker-overview.json'].uid) + + link.link.options.withKeepTime(true), + cloudflareGeomap: + link.link.new('Geographic overview', '/d/' + this.grafana.dashboards['cloudflare-geomap-overview.json'].uid) + + link.link.options.withKeepTime(true), + otherDashboards: + link.dashboards.new('All dashboards', this.config.dashboardTags) + + link.dashboards.options.withIncludeVars(true) + + link.dashboards.options.withKeepTime(true) + + link.dashboards.options.withAsDropdown(true), + }, +} diff --git a/cloudflare-mixin/main.libsonnet b/cloudflare-mixin/main.libsonnet new file mode 100644 index 000000000..47e8da523 --- /dev/null +++ b/cloudflare-mixin/main.libsonnet @@ -0,0 +1,64 @@ +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'; + +{ + withConfigMixin(config): { + config+: config, + }, + + new(): { + + local this = self, + config: config, + + signals: + { + [sig]: commonlib.signals.unmarshallJsonMulti( + this.config.signals[sig], + type=this.config.metricsSource + ) + for sig in std.objectFields(this.config.signals) + }, + + grafana: { + variables: commonlib.variables.new( + filteringSelector=this.config.filteringSelector, + groupLabels=this.config.groupLabels, + instanceLabels=this.config.instanceLabels, + varMetric='cloudflare_zone_requests_total', + customAllValue='.+', + enableLokiLogs=false, + ) + { + // Custom variable for geomap metric selection + geoMetric: g.dashboard.variable.custom.new( + 'geo_metric', + values=[ + 'cloudflare_zone_requests_country', + 'cloudflare_zone_bandwidth_country', + 'cloudflare_zone_threats_country', + ] + ) + + g.dashboard.variable.custom.generalOptions.withLabel('Geomap metric') + + g.dashboard.variable.custom.generalOptions.withCurrent('cloudflare_zone_requests_country') + + g.dashboard.variable.custom.selectionOptions.withMulti(false) + + g.dashboard.variable.custom.selectionOptions.withIncludeAll(false), + }, + annotations: {}, + links: links.new(this), + panels: panels.new(this), + dashboards: dashboards.new(this), + rows: rows.new(this), + }, + + prometheus: { + alerts: alerts.new(this), + recordingRules: {}, + }, + }, +} diff --git a/cloudflare-mixin/mixin.libsonnet b/cloudflare-mixin/mixin.libsonnet index 4d987cf31..4710559be 100644 --- a/cloudflare-mixin/mixin.libsonnet +++ b/cloudflare-mixin/mixin.libsonnet @@ -1,3 +1,28 @@ -(import 'dashboards/dashboards.libsonnet') + -(import 'alerts/alerts.libsonnet') + -(import 'config.libsonnet') +local cloudflarelib = import './main.libsonnet'; +local util = import 'grafana-cloud-integration-utils/util.libsonnet'; + +local cloudflare = + cloudflarelib.new() + + cloudflarelib.withConfigMixin({ + filteringSelector: 'job=~"integrations/cloudflare"', + uid: 'cloudflare', + }); + +local optional_labels = { + script_name+: { + allValue: '.*', + label: 'Script', + }, +}; + +{ + grafanaDashboards+:: { + [fname]: + local dashboard = cloudflare.grafana.dashboards[fname]; + dashboard + util.patch_variables(dashboard, optional_labels) + + for fname in std.objectFields(cloudflare.grafana.dashboards) + }, + prometheusAlerts+:: cloudflare.prometheus.alerts, + prometheusRules+:: cloudflare.prometheus.recordingRules, +} diff --git a/cloudflare-mixin/panels.libsonnet b/cloudflare-mixin/panels.libsonnet new file mode 100644 index 000000000..ab18511dd --- /dev/null +++ b/cloudflare-mixin/panels.libsonnet @@ -0,0 +1,194 @@ +local g = import './g.libsonnet'; +local commonlib = import 'common-lib/common/main.libsonnet'; +local utils = commonlib.utils; + +{ + new(this):: + { + local signals = this.signals, + + // Zone panels + requestsPanel: + commonlib.panels.generic.timeSeries.base.new( + 'Requests', + targets=[signals.zone.requestsTotal.asTarget()], + description='Rate of requests to the zone.' + ) + + g.panel.timeSeries.standardOptions.withUnit('reqps') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + cachedRequestsPanel: + commonlib.panels.generic.timeSeries.base.new( + 'Cached requests', + targets=[signals.zone.requestsCached.asTarget()], + description='Percentage of cached requests.' + ) + + g.panel.timeSeries.standardOptions.withUnit('percent') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + threatsPanel: + commonlib.panels.generic.timeSeries.base.new( + 'Threats', + targets=[signals.zone.threatsTotal.asTarget()], + description='Number of threats blocked.' + ) + + g.panel.timeSeries.standardOptions.withUnit('short') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + bandwidthPanel: + commonlib.panels.generic.timeSeries.base.new( + 'Bandwidth', + targets=[signals.zone.bandwidthTotal.asTarget()], + description='Total bandwidth usage.' + ) + + g.panel.timeSeries.standardOptions.withUnit('bytes') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(54) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + sslBandwidthPanel: + commonlib.panels.generic.timeSeries.base.new( + 'SSL encrypted bandwidth', + targets=[ + signals.zone.bandwidthSslEncrypted.asTarget(), + signals.zone.bandwidthCached.asTarget(), + ], + description='SSL encrypted and cached bandwidth.' + ) + + g.panel.timeSeries.standardOptions.withUnit('bytes') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(54) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + bandwidthContentTypePanel: + commonlib.panels.generic.timeSeries.base.new( + 'Bandwidth by content type', + targets=[signals.zone.bandwidthContentType.asTarget()], + description='Bandwidth usage by content type.' + ) + + g.panel.timeSeries.standardOptions.withUnit('bytes') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(54) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + uniqueVisitorsPanel: + commonlib.panels.generic.timeSeries.base.new( + 'Unique visitors', + targets=[ + signals.zone.uniquesTotal.asTarget(), + signals.zone.repeatVisitors.asTarget(), + ], + description='Unique and repeat visitors.' + ) + + g.panel.timeSeries.standardOptions.withUnit('short') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(54) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + requestsStatusPanel: + commonlib.panels.generic.timeSeries.base.new( + 'Requests by status', + targets=[signals.zone.requestsStatus.asTarget()], + description='Requests broken down by HTTP status code.' + ) + + g.panel.timeSeries.standardOptions.withUnit('short') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(54) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + browserMapPanel: + commonlib.panels.generic.timeSeries.base.new( + 'Browser map pageviews', + targets=[signals.zone.requestsBrowserMap.asTarget()], + description='Browser map pageviews count.' + ) + + g.panel.timeSeries.standardOptions.withUnit('short') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(54) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + colocationRequestsPanel: + commonlib.panels.generic.timeSeries.base.new( + 'Requests by colocation', + targets=[signals.zone.colocationRequests.asTarget()], + description='Requests by colocation center.' + ) + + g.panel.timeSeries.standardOptions.withUnit('reqps') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + // Pool panels + poolStatusPanel: + commonlib.panels.generic.stat.base.new( + 'Pool health status', + targets=[signals.pool.poolStatus.asTarget()], + description='Health status of the pool (0=unhealthy, 1=healthy).' + ) + + g.panel.stat.standardOptions.withUnit('short'), + + poolRequestsPanel: + commonlib.panels.generic.timeSeries.base.new( + 'Pool requests', + targets=[signals.pool.requests.asTarget()], + description='Rate of requests to the pool.' + ) + + g.panel.timeSeries.standardOptions.withUnit('reqps') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + // Worker panels + workerCpuTimePanel: + commonlib.panels.generic.timeSeries.base.new( + 'Worker CPU time', + targets=[signals.worker.cpuTime.asTarget()], + description='CPU time consumed by the worker.' + ) + + g.panel.timeSeries.standardOptions.withUnit('s') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(54) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + workerDurationPanel: + commonlib.panels.generic.timeSeries.base.new( + 'Worker duration', + targets=[signals.worker.duration.asTarget()], + description='Duration of worker execution.' + ) + + g.panel.timeSeries.standardOptions.withUnit('s') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(54) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + workerRequestsPanel: + commonlib.panels.generic.timeSeries.base.new( + 'Worker requests', + targets=[signals.worker.requestsCount.asTarget()], + description='Rate of requests to the worker.' + ) + + g.panel.timeSeries.standardOptions.withUnit('reqps') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + workerErrorsPanel: + commonlib.panels.generic.timeSeries.base.new( + 'Worker errors', + targets=[signals.worker.errorsCount.asTarget()], + description='Number of errors from the worker.' + ) + + g.panel.timeSeries.standardOptions.withUnit('short') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + geoMetricByCountryGeomapPanel: + g.panel.geomap.new('Geographic Distribution') + + g.panel.geomap.queryOptions.withTargets([ + signals.geomap.geoMapByCountry.asTarget() + + g.query.prometheus.withFormat('table') + + g.query.prometheus.withInterval('1m') + + g.query.prometheus.withLegendFormat(''), + ]), + geoMetricsByCountryTablePanel: + g.panel.table.new('Geographic Distribution') + + g.panel.table.queryOptions.withTargets([ + signals.geomap.geoMetricsByCountryTable.asTarget() + + g.query.prometheus.withFormat('table') + + g.query.prometheus.withInterval('1m') + + g.query.prometheus.withLegendFormat(''), + ]), + }, +} diff --git a/cloudflare-mixin/prometheus_rules_out/prometheus_alerts.yaml b/cloudflare-mixin/prometheus_rules_out/prometheus_alerts.yaml index b0ecee7cd..a57091911 100644 --- a/cloudflare-mixin/prometheus_rules_out/prometheus_alerts.yaml +++ b/cloudflare-mixin/prometheus_rules_out/prometheus_alerts.yaml @@ -6,7 +6,7 @@ groups: description: The number of detected threats targeting the zone {{$labels.zone}} is {{ printf "%.0f" $value }} which is greater than the threshold of 3. summary: There are detected threats targeting the zone. expr: | - sum without (instance) (increase(cloudflare_zone_threats_total[5m])) > 3 + sum without (instance) (increase(cloudflare_zone_threats_total{job=~"integrations/cloudflare"}[5m])) > 3 for: 5m labels: severity: critical @@ -15,7 +15,7 @@ groups: description: The rate of requests to {{$labels.zone}} is {{ printf "%.0f" $value }}% of the prior 50 minute baseline which is above the threshold of 150%. summary: A high spike in requests is occurring which may indicate an attack or unexpected load. expr: | - sum without (instance) (100 * (rate(cloudflare_zone_requests_total[10m]) / clamp_min(rate(cloudflare_zone_requests_total[50m] offset 10m), 1))) > 150 + sum without (instance) (100 * (rate(cloudflare_zone_requests_total{job=~"integrations/cloudflare"}[10m]) / clamp_min(rate(cloudflare_zone_requests_total{job=~"integrations/cloudflare"}[50m] offset 10m), 1))) > 150 for: 5m labels: severity: warning @@ -24,7 +24,7 @@ groups: description: The number of {{$labels.status}} HTTP status codes occurring in the zone {{$labels.zone}} is {{ printf "%.0f" $value }} which is greater than the threshold of 100. summary: A high number of 4xx or 5xx HTTP status codes are occurring. expr: | - sum without (instance) (increase(cloudflare_zone_requests_status{status=~"4.*|5.*"}[5m])) > 100 + sum without (instance) (increase(cloudflare_zone_requests_status{job=~"integrations/cloudflare",status=~"4.*|5.*"}[5m])) > 100 for: 5m labels: severity: warning @@ -33,7 +33,7 @@ groups: description: The pool {{$labels.pool_name}} in zone {{$labels.zone}} is currently down and unhealthy. summary: There are unhealthy pools. expr: | - sum without (instance, load_balancer_name) (cloudflare_zone_pool_health_status) == 0 + sum without (instance, load_balancer_name) (cloudflare_zone_pool_health_status{job=~"integrations/cloudflare"}) == 0 for: 5m labels: severity: critical diff --git a/cloudflare-mixin/rows.libsonnet b/cloudflare-mixin/rows.libsonnet new file mode 100644 index 000000000..9e5122a17 --- /dev/null +++ b/cloudflare-mixin/rows.libsonnet @@ -0,0 +1,70 @@ +local g = import './g.libsonnet'; + +// Use g.util.grid.wrapPanels() to import into custom dashboard +{ + new(this): { + // Zone overview metrics + zoneOverview: + g.panel.row.new('Zone overview') + + g.panel.row.withPanels( + [ + this.grafana.panels.requestsPanel + g.panel.timeSeries.gridPos.withW(12), + this.grafana.panels.cachedRequestsPanel + g.panel.timeSeries.gridPos.withW(12), + this.grafana.panels.threatsPanel + g.panel.timeSeries.gridPos.withW(12), + this.grafana.panels.bandwidthPanel + g.panel.timeSeries.gridPos.withW(12), + ] + ), + + // Zone bandwidth metrics + zoneBandwidth: + g.panel.row.new('Zone bandwidth') + + g.panel.row.withPanels( + [ + this.grafana.panels.sslBandwidthPanel + g.panel.timeSeries.gridPos.withW(12), + this.grafana.panels.bandwidthContentTypePanel + g.panel.timeSeries.gridPos.withW(12), + ] + ), + + // Zone visitors metrics + zoneVisitors: + g.panel.row.new('Zone visitors') + + g.panel.row.withPanels( + [ + this.grafana.panels.uniqueVisitorsPanel + g.panel.timeSeries.gridPos.withW(12), + this.grafana.panels.browserMapPanel + g.panel.timeSeries.gridPos.withW(12), + ] + ), + + // Zone status and location metrics + zoneStatusLocation: + g.panel.row.new('Zone status and location') + + g.panel.row.withPanels( + [ + this.grafana.panels.requestsStatusPanel + g.panel.timeSeries.gridPos.withW(12), + this.grafana.panels.colocationRequestsPanel + g.panel.timeSeries.gridPos.withW(12), + ] + ), + + // Pool metrics + pools: + g.panel.row.new('Load balancer pools') + + g.panel.row.withPanels( + [ + this.grafana.panels.poolStatusPanel + g.panel.stat.gridPos.withW(12), + this.grafana.panels.poolRequestsPanel + g.panel.timeSeries.gridPos.withW(12), + ] + ), + + // Worker metrics + workers: + g.panel.row.new('Workers') + + g.panel.row.withPanels( + [ + this.grafana.panels.workerCpuTimePanel + g.panel.timeSeries.gridPos.withW(12), + this.grafana.panels.workerDurationPanel + g.panel.timeSeries.gridPos.withW(12), + this.grafana.panels.workerRequestsPanel + g.panel.timeSeries.gridPos.withW(12), + this.grafana.panels.workerErrorsPanel + g.panel.timeSeries.gridPos.withW(12), + ] + ), + }, +} diff --git a/cloudflare-mixin/signals/geomap.libsonnet b/cloudflare-mixin/signals/geomap.libsonnet new file mode 100644 index 000000000..96f461357 --- /dev/null +++ b/cloudflare-mixin/signals/geomap.libsonnet @@ -0,0 +1,39 @@ +function(this) { + filteringSelector: this.filteringSelector, + groupLabels: this.groupLabels, + instanceLabels: this.instanceLabels, + aggLevel: 'none', + aggFunction: 'avg', + alertsInterval: '2m', + discoveryMetric: { + prometheus: 'cloudflare_zone_requests_country', + }, + signals: { + geoMapByCountry: { + name: '$geo_metric Distribution', + nameShort: 'Distribution', + type: 'counter', + description: 'Distribution of the selected metric by country.', + unit: 'short', + sources: { + prometheus: { + expr: '${geo_metric}{%(queriesSelector)s}', + rangeFunction: 'increase', + }, + }, + }, + geoMetricsByCountryTable: { + name: '$geo_metric Distribution', + nameShort: 'Distribution', + type: 'counter', + description: 'Distribution of the selected metric by country.', + unit: 'short', + sources: { + prometheus: { + expr: '${geo_metric}{%(queriesSelector)s}', + rangeFunction: 'increase', + }, + }, + }, + }, +} diff --git a/cloudflare-mixin/signals/pool.libsonnet b/cloudflare-mixin/signals/pool.libsonnet new file mode 100644 index 000000000..be63198f9 --- /dev/null +++ b/cloudflare-mixin/signals/pool.libsonnet @@ -0,0 +1,40 @@ +function(this) + { + filteringSelector: this.filteringSelector, + groupLabels: this.groupLabels, + instanceLabels: this.instanceLabels, + aggLevel: 'none', + aggFunction: 'avg', + alertsInterval: '2m', + discoveryMetric: { + prometheus: 'cloudflare_zone_pool_health_status', + }, + signals: { + poolStatus: { + name: 'Pool status', + nameShort: 'Status', + type: 'gauge', + description: 'Status of the pool (0=unhealthy, 1=healthy).', + unit: 'short', + sources: { + prometheus: { + expr: 'cloudflare_zone_pool_health_status{%(queriesSelector)s}', + legendCustomTemplate: '{{ pool_name }}', + }, + }, + }, + requests: { + name: 'Request rate', + nameShort: 'Rate', + type: 'counter', + description: 'Rate of requests to the pool.', + unit: '/ sec', + sources: { + prometheus: { + expr: 'cloudflare_zone_pool_requests_total{%(queriesSelector)s}', + legendCustomTemplate: '{{ pool_name }}', + }, + }, + }, + }, + } diff --git a/cloudflare-mixin/signals/worker.libsonnet b/cloudflare-mixin/signals/worker.libsonnet new file mode 100644 index 000000000..9e3e4c32f --- /dev/null +++ b/cloudflare-mixin/signals/worker.libsonnet @@ -0,0 +1,67 @@ +function(this) + { + filteringSelector: this.filteringSelector, + groupLabels: this.groupLabels, + instanceLabels: this.instanceLabels, + aggLevel: 'none', + aggFunction: 'avg', + alertsInterval: '2m', + discoveryMetric: { + prometheus: 'cloudflare_worker_requests_count', + }, + signals: { + cpuTime: { + name: 'Worker CPU time', + nameShort: 'CPU time', + type: 'gauge', + description: 'CPU time consumed by the worker.', + unit: 's', + sources: { + prometheus: { + expr: 'cloudflare_worker_cpu_time{%(queriesSelector)s}', + legendCustomTemplate: '{{ script_name }} - {{ quantile }}', + }, + }, + }, + duration: { + name: 'Worker duration', + nameShort: 'Duration', + type: 'gauge', + description: 'Duration of worker execution.', + unit: 's', + sources: { + prometheus: { + expr: 'cloudflare_worker_duration{%(queriesSelector)s}', + legendCustomTemplate: '{{ script_name }} - {{ quantile }}', + }, + }, + }, + requestsCount: { + name: 'Worker requests', + nameShort: 'Requests', + type: 'counter', + description: 'Number of requests to the worker.', + unit: '/ sec', + sources: { + prometheus: { + expr: 'cloudflare_worker_requests_count{%(queriesSelector)s}', + legendCustomTemplate: '{{ script_name }}', + }, + }, + }, + errorsCount: { + name: 'Worker errors', + nameShort: 'Errors', + type: 'counter', + description: 'Number of errors from the worker.', + unit: 'short', + sources: { + prometheus: { + expr: 'cloudflare_worker_errors_count{%(queriesSelector)s}', + legendCustomTemplate: '{{ script_name }}', + rangeFunction: 'increase', + }, + }, + }, + }, + } diff --git a/cloudflare-mixin/signals/zone.libsonnet b/cloudflare-mixin/signals/zone.libsonnet new file mode 100644 index 000000000..34478b821 --- /dev/null +++ b/cloudflare-mixin/signals/zone.libsonnet @@ -0,0 +1,225 @@ +local commonlib = import 'common-lib/common/main.libsonnet'; + +function(this) + { + filteringSelector: this.filteringSelector, + groupLabels: this.groupLabels, + instanceLabels: this.instanceLabels, + aggLevel: 'none', + aggFunction: 'avg', + alertsInterval: '2m', + discoveryMetric: { + prometheus: 'cloudflare_zone_requests_total', + }, + signals: { + requestsTotal: { + name: 'Zone requests total', + nameShort: 'Requests', + type: 'counter', + description: 'Total number of requests to the zone.', + unit: '/ sec', + sources: { + prometheus: { + expr: 'cloudflare_zone_requests_total{%(queriesSelector)s}', + legendCustomTemplate: '{{ zone }}', + }, + }, + }, + requestsCached: { + name: 'Zone cached requests', + nameShort: 'Cached requests', + type: 'raw', + description: 'Number of cached requests to the zone.', + unit: 'percent', + sources: { + prometheus: { + expr: 'increase(cloudflare_zone_requests_cached{%(queriesSelector)s}[$__interval:]) / increase(cloudflare_zone_requests_total{%(queriesSelector)s}[$__interval:])', + legendCustomTemplate: '{{ zone }}', + }, + }, + }, + threatsTotal: { + name: 'Zone threats', + nameShort: 'Threats', + type: 'counter', + description: 'Number of threats blocked for the zone.', + unit: 'short', + sources: { + prometheus: { + expr: 'cloudflare_zone_threats_total{%(queriesSelector)s}', + legendCustomTemplate: '{{ zone }}', + }, + }, + }, + bandwidthTotal: { + name: 'Zone bandwidth', + nameShort: 'Bandwidth', + type: 'counter', + description: 'Total bandwidth usage for the zone.', + unit: 'bytes', + sources: { + prometheus: { + expr: 'cloudflare_zone_bandwidth_total{%(queriesSelector)s}', + legendCustomTemplate: '{{ zone }}', + }, + }, + }, + bandwidthSslEncrypted: { + name: 'Zone SSL encrypted bandwidth', + nameShort: 'SSL bandwidth', + type: 'counter', + description: 'SSL encrypted bandwidth for the zone.', + unit: 'bytes', + sources: { + prometheus: { + expr: 'cloudflare_zone_bandwidth_ssl_encrypted{%(queriesSelector)s}', + legendCustomTemplate: '{{ zone }}', + }, + }, + }, + bandwidthCached: { + name: 'Zone cached bandwidth', + nameShort: 'Cached bandwidth', + type: 'counter', + description: 'Cached bandwidth for the zone.', + unit: 'bytes', + sources: { + prometheus: { + expr: 'cloudflare_zone_bandwidth_cached{%(queriesSelector)s}', + legendCustomTemplate: '{{ zone }}', + }, + }, + }, + bandwidthContentType: { + name: 'Zone bandwidth by content type', + nameShort: 'Bandwidth by type', + type: 'counter', + description: 'Bandwidth usage broken down by content type.', + unit: 'bytes', + sources: { + prometheus: { + expr: 'cloudflare_zone_bandwidth_content_type{%(queriesSelector)s}', + legendCustomTemplate: '{{ content_type }}', + }, + }, + }, + uniquesTotal: { + name: 'Zone unique visitors', + nameShort: 'Unique visitors', + type: 'counter', + description: 'Number of unique visitors to the zone.', + unit: 'short', + sources: { + prometheus: { + expr: 'cloudflare_zone_uniques_total{%(queriesSelector)s}', + legendCustomTemplate: '{{ zone }}', + }, + }, + }, + pageviewsTotal: { + name: 'Zone pageviews', + nameShort: 'Pageviews', + type: 'counter', + description: 'Total pageviews for the zone.', + unit: 'short', + sources: { + prometheus: { + expr: 'cloudflare_zone_pageviews_total{%(queriesSelector)s}', + legendCustomTemplate: '{{ zone }}', + }, + }, + }, + repeatVisitors: { + name: 'Zone repeat visitors', + nameShort: 'Repeat visitors', + type: 'raw', + description: 'Number of repeat visitors (pageviews - uniques).', + unit: 'short', + sources: { + prometheus: { + expr: 'cloudflare_zone_pageviews_total{%(queriesSelector)s} - cloudflare_zone_uniques_total{%(queriesSelector)s}', + legendCustomTemplate: '{{ zone }}', + }, + }, + }, + requestsStatus: { + name: 'Zone requests by status', + nameShort: 'Requests by status', + type: 'counter', + description: 'Requests broken down by HTTP status code.', + unit: 'short', + sources: { + prometheus: { + expr: 'cloudflare_zone_requests_status{%(queriesSelector)s}', + legendCustomTemplate: '{{ status }}', + }, + }, + }, + requestsBrowserMap: { + name: 'Zone browser map pageviews', + nameShort: 'Browser map', + type: 'counter', + description: 'Browser map pageviews count.', + unit: 'short', + sources: { + prometheus: { + expr: 'cloudflare_zone_requests_browser_map_page_views_count{%(queriesSelector)s}', + legendCustomTemplate: '{{ zone }}', + }, + }, + }, + colocationRequests: { + name: 'Zone colocation requests', + nameShort: 'Colocation requests', + type: 'counter', + description: 'Requests by colocation center.', + unit: '/ sec', + sources: { + prometheus: { + expr: 'cloudflare_zone_colocation_requests_total{%(queriesSelector)s}', + legendCustomTemplate: '{{ colo_code }}', + }, + }, + }, + // Country-based metrics for geomap visualization + requestsByCountry: { + name: 'Zone requests by country', + nameShort: 'Requests by country', + type: 'counter', + description: 'Number of requests to the zone by country.', + unit: 'short', + sources: { + prometheus: { + expr: 'cloudflare_zone_requests_country{%(queriesSelector)s}', + legendCustomTemplate: '{{ country_code }}', + }, + }, + }, + bandwidthByCountry: { + name: 'Zone bandwidth by country', + nameShort: 'Bandwidth by country', + type: 'counter', + description: 'Amount of bandwidth used by requests to the zone by country.', + unit: 'bytes', + sources: { + prometheus: { + expr: 'cloudflare_zone_bandwidth_country{%(queriesSelector)s}', + legendCustomTemplate: '{{ country_code }}', + }, + }, + }, + threatsByCountry: { + name: 'Zone threats by country', + nameShort: 'Threats by country', + type: 'counter', + description: 'Number of threats blocked for the zone by country.', + unit: 'short', + sources: { + prometheus: { + expr: 'cloudflare_zone_threats_country{%(queriesSelector)s}', + legendCustomTemplate: '{{ country_code }}', + }, + }, + }, + }, + } From 7386d9e0e6beb4f3391f3049e7502606f644dae4 Mon Sep 17 00:00:00 2001 From: schmikei Date: Wed, 20 Aug 2025 10:52:28 -0400 Subject: [PATCH 2/8] fix lint --- cloudflare-mixin/alerts.libsonnet | 8 ++++---- cloudflare-mixin/config.libsonnet | 2 +- .../dashboards_out/cloudflare-geomap-overview.json | 5 +++-- cloudflare-mixin/panels.libsonnet | 7 +++---- .../prometheus_rules_out/prometheus_alerts.yaml | 8 ++++---- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cloudflare-mixin/alerts.libsonnet b/cloudflare-mixin/alerts.libsonnet index 5ff70cafb..d0199666e 100644 --- a/cloudflare-mixin/alerts.libsonnet +++ b/cloudflare-mixin/alerts.libsonnet @@ -7,7 +7,7 @@ { alert: 'CloudflareHighThreatCount', expr: ||| - sum without (instance) (increase(cloudflare_zone_threats_total{%(filteringSelector)s}[5m])) > %(alertsHighThreatCount)s + sum without (instance) (increase(cloudflare_zone_threats_total[5m])) > %(alertsHighThreatCount)s ||| % this.config, 'for': '5m', labels: { @@ -21,7 +21,7 @@ { alert: 'CloudflareHighRequestRate', expr: ||| - sum without (instance) (100 * (rate(cloudflare_zone_requests_total{%(filteringSelector)s}[10m]) / clamp_min(rate(cloudflare_zone_requests_total{%(filteringSelector)s}[50m] offset 10m), 1))) > %(alertsHighRequestRate)s + sum without (instance) (100 * (rate(cloudflare_zone_requests_total[10m]) / clamp_min(rate(cloudflare_zone_requests_total[50m] offset 10m), 1))) > %(alertsHighRequestRate)s ||| % this.config, 'for': '5m', labels: { @@ -35,7 +35,7 @@ { alert: 'CloudflareHighHTTPErrorCodes', expr: ||| - sum without (instance) (increase(cloudflare_zone_requests_status{%(filteringSelector)s,status=~"4.*|5.*"}[5m])) > %(alertsHighHTTPErrorCodeCount)s + sum without (instance) (increase(cloudflare_zone_requests_status{status=~"4.*|5.*"}[5m])) > %(alertsHighHTTPErrorCodeCount)s ||| % this.config, 'for': '5m', labels: { @@ -49,7 +49,7 @@ { alert: 'CloudflareUnhealthyPools', expr: ||| - sum without (instance, load_balancer_name) (cloudflare_zone_pool_health_status{%(filteringSelector)s}) == 0 + sum without (instance, load_balancer_name) (cloudflare_zone_pool_health_status) == 0 ||| % this.config, 'for': '5m', labels: { diff --git a/cloudflare-mixin/config.libsonnet b/cloudflare-mixin/config.libsonnet index dd1632e4f..f0c98657e 100644 --- a/cloudflare-mixin/config.libsonnet +++ b/cloudflare-mixin/config.libsonnet @@ -1,7 +1,7 @@ { local this = self, enableMultiCluster: false, - filteringSelector: 'job=~"integrations/cloudflare"', + filteringSelector: 'job="integrations/cloudflare"', groupLabels: ['job', 'cluster', 'zone', 'script_name'], instanceLabels: ['instance'], diff --git a/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json b/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json index 374fa6169..dd9fe1ad6 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json @@ -38,6 +38,7 @@ "type": "datasource", "uid": "-- Mixed --" }, + "description": "Table currently showing $geo_metric for the zone.", "gridPos": { "h": 7, "w": 24, @@ -55,7 +56,6 @@ "expr": "increase(${geo_metric}{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "table", "instant": false, - "interval": "1m", "legendFormat": "", "refId": "$geo_metric Distribution" } @@ -68,6 +68,7 @@ "type": "datasource", "uid": "-- Mixed --" }, + "description": "Geomap panel currently showing $geo_metric for the zone.", "gridPos": { "h": 12, "w": 24, @@ -83,7 +84,7 @@ "uid": "${datasource}" }, "expr": "increase(${geo_metric}{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", - "format": "table", + "format": "time_series", "instant": false, "interval": "1m", "legendFormat": "", diff --git a/cloudflare-mixin/panels.libsonnet b/cloudflare-mixin/panels.libsonnet index ab18511dd..c98decdf4 100644 --- a/cloudflare-mixin/panels.libsonnet +++ b/cloudflare-mixin/panels.libsonnet @@ -176,18 +176,17 @@ local utils = commonlib.utils; geoMetricByCountryGeomapPanel: g.panel.geomap.new('Geographic Distribution') + + g.panel.geomap.panelOptions.withDescription('Geomap panel currently showing $geo_metric for the zone.') + g.panel.geomap.queryOptions.withTargets([ - signals.geomap.geoMapByCountry.asTarget() - + g.query.prometheus.withFormat('table') - + g.query.prometheus.withInterval('1m') + signals.geomap.geoMapByCountry.asTarget() { interval: '1m' } + g.query.prometheus.withLegendFormat(''), ]), geoMetricsByCountryTablePanel: g.panel.table.new('Geographic Distribution') + + g.panel.table.panelOptions.withDescription('Table currently showing $geo_metric for the zone.') + g.panel.table.queryOptions.withTargets([ signals.geomap.geoMetricsByCountryTable.asTarget() + g.query.prometheus.withFormat('table') - + g.query.prometheus.withInterval('1m') + g.query.prometheus.withLegendFormat(''), ]), }, diff --git a/cloudflare-mixin/prometheus_rules_out/prometheus_alerts.yaml b/cloudflare-mixin/prometheus_rules_out/prometheus_alerts.yaml index a57091911..b0ecee7cd 100644 --- a/cloudflare-mixin/prometheus_rules_out/prometheus_alerts.yaml +++ b/cloudflare-mixin/prometheus_rules_out/prometheus_alerts.yaml @@ -6,7 +6,7 @@ groups: description: The number of detected threats targeting the zone {{$labels.zone}} is {{ printf "%.0f" $value }} which is greater than the threshold of 3. summary: There are detected threats targeting the zone. expr: | - sum without (instance) (increase(cloudflare_zone_threats_total{job=~"integrations/cloudflare"}[5m])) > 3 + sum without (instance) (increase(cloudflare_zone_threats_total[5m])) > 3 for: 5m labels: severity: critical @@ -15,7 +15,7 @@ groups: description: The rate of requests to {{$labels.zone}} is {{ printf "%.0f" $value }}% of the prior 50 minute baseline which is above the threshold of 150%. summary: A high spike in requests is occurring which may indicate an attack or unexpected load. expr: | - sum without (instance) (100 * (rate(cloudflare_zone_requests_total{job=~"integrations/cloudflare"}[10m]) / clamp_min(rate(cloudflare_zone_requests_total{job=~"integrations/cloudflare"}[50m] offset 10m), 1))) > 150 + sum without (instance) (100 * (rate(cloudflare_zone_requests_total[10m]) / clamp_min(rate(cloudflare_zone_requests_total[50m] offset 10m), 1))) > 150 for: 5m labels: severity: warning @@ -24,7 +24,7 @@ groups: description: The number of {{$labels.status}} HTTP status codes occurring in the zone {{$labels.zone}} is {{ printf "%.0f" $value }} which is greater than the threshold of 100. summary: A high number of 4xx or 5xx HTTP status codes are occurring. expr: | - sum without (instance) (increase(cloudflare_zone_requests_status{job=~"integrations/cloudflare",status=~"4.*|5.*"}[5m])) > 100 + sum without (instance) (increase(cloudflare_zone_requests_status{status=~"4.*|5.*"}[5m])) > 100 for: 5m labels: severity: warning @@ -33,7 +33,7 @@ groups: description: The pool {{$labels.pool_name}} in zone {{$labels.zone}} is currently down and unhealthy. summary: There are unhealthy pools. expr: | - sum without (instance, load_balancer_name) (cloudflare_zone_pool_health_status{job=~"integrations/cloudflare"}) == 0 + sum without (instance, load_balancer_name) (cloudflare_zone_pool_health_status) == 0 for: 5m labels: severity: critical From 8deafd82b116e6bb89591efa1625ecb0c6397f0b Mon Sep 17 00:00:00 2001 From: schmikei Date: Fri, 22 Aug 2025 14:54:46 -0400 Subject: [PATCH 3/8] some formatting --- cloudflare-mixin/dashboards.libsonnet | 4 - .../cloudflare-worker-overview.json | 16 +- .../cloudflare-zone-overview.json | 424 ++++++++---------- cloudflare-mixin/panels.libsonnet | 150 ++++--- cloudflare-mixin/rows.libsonnet | 67 +-- 5 files changed, 307 insertions(+), 354 deletions(-) diff --git a/cloudflare-mixin/dashboards.libsonnet b/cloudflare-mixin/dashboards.libsonnet index a91f79ef5..63aa57308 100644 --- a/cloudflare-mixin/dashboards.libsonnet +++ b/cloudflare-mixin/dashboards.libsonnet @@ -21,10 +21,6 @@ local g = import './g.libsonnet'; g.util.grid.wrapPanels( [ this.grafana.rows.zoneOverview + g.panel.row.withCollapsed(false), - this.grafana.rows.zoneBandwidth + g.panel.row.withCollapsed(false), - this.grafana.rows.zoneVisitors + g.panel.row.withCollapsed(false), - this.grafana.rows.zoneStatusLocation + g.panel.row.withCollapsed(false), - this.grafana.rows.pools + g.panel.row.withCollapsed(false), ] ) ) diff --git a/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json b/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json index 4ab1ee1e9..e53e47dc5 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json @@ -67,7 +67,7 @@ }, "gridPos": { "h": 8, - "w": 12, + "w": 24, "x": 0, "y": 1 }, @@ -96,7 +96,7 @@ "refId": "Worker CPU time" } ], - "title": "Worker CPU time", + "title": "Worker CPU time quantiles", "type": "timeseries" }, { @@ -120,9 +120,9 @@ }, "gridPos": { "h": 8, - "w": 12, - "x": 12, - "y": 1 + "w": 24, + "x": 0, + "y": 9 }, "id": 3, "options": { @@ -149,7 +149,7 @@ "refId": "Worker duration" } ], - "title": "Worker duration", + "title": "Worker duration quantiles", "type": "timeseries" }, { @@ -175,7 +175,7 @@ "h": 8, "w": 12, "x": 0, - "y": 9 + "y": 17 }, "id": 4, "options": { @@ -228,7 +228,7 @@ "h": 8, "w": 12, "x": 12, - "y": 9 + "y": 17 }, "id": 5, "options": { diff --git a/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json b/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json index ee57c6efe..e4737c63d 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json @@ -46,16 +46,89 @@ "title": "Zone overview", "type": "row" }, + { + "datasource": { + "uid": "prometheus" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 1 + }, + "id": 2, + "options": { + "alertInstanceLabelFilter": "{job=~\"${job:regex}\", instance=~\"${instance:regex}\"}", + "alertName": "", + "dashboardAlerts": false, + "groupBy": [ ], + "groupMode": "default", + "maxItems": 5, + "sortOrder": 1, + "stateFilter": { + "error": true, + "firing": true, + "noData": true, + "normal": true, + "pending": true + }, + "viewMode": "list" + }, + "targets": [ ], + "title": "Alerts", + "type": "alertlist" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "description": "A table view of the pools in your zone showing their health and rate of requests.", + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 1 + }, + "id": 3, + "pluginVersion": "v11.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "expr": "cloudflare_zone_pool_health_status{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}", + "format": "table", + "instant": false, + "legendFormat": "{{ pool_name }}", + "refId": "Pool status" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "expr": "rate(cloudflare_zone_pool_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "format": "table", + "instant": false, + "legendFormat": "{{ pool_name }}", + "refId": "Request rate" + } + ], + "title": "Pool status", + "type": "table" + }, { "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "description": "Rate of requests to the zone.", + "description": "The rate at which requests to the zone occur.", "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 0, + "fillOpacity": 10, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, @@ -69,9 +142,9 @@ "h": 8, "w": 12, "x": 0, - "y": 1 + "y": 9 }, - "id": 2, + "id": 4, "options": { "legend": { "calcs": [ ], @@ -96,7 +169,7 @@ "refId": "Zone requests total" } ], - "title": "Requests", + "title": "Request rate", "type": "timeseries" }, { @@ -104,27 +177,49 @@ "type": "prometheus", "uid": "${datasource}" }, - "description": "Percentage of cached requests.", + "description": "The percentage of requests to the zone that are cached.", "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 0, + "fillOpacity": 10, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never", - "spanNulls": false + "spanNulls": false, + "thresholdsStyle": { + "mode": "area" + } + }, + "max": 1, + "min": 0, + "thresholds": { + "mode": "percentage", + "steps": [ + { + "color": "red", + "value": null + }, + { + "color": "#EAB839", + "value": 50 + }, + { + "color": "green", + "value": 80 + } + ] }, - "unit": "percent" + "unit": "percentunit" } }, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 1 + "y": 9 }, - "id": 3, + "id": 5, "options": { "legend": { "calcs": [ ], @@ -149,7 +244,7 @@ "refId": "Zone cached requests" } ], - "title": "Cached requests", + "title": "Cached requests / $__interval", "type": "timeseries" }, { @@ -157,27 +252,27 @@ "type": "prometheus", "uid": "${datasource}" }, - "description": "Number of threats blocked.", + "description": "The number of threats that have targeted the zone.", "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 0, + "fillOpacity": 10, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never", "spanNulls": false }, - "unit": "short" + "unit": "none" } }, "gridPos": { "h": 8, "w": 12, "x": 0, - "y": 9 + "y": 17 }, - "id": 4, + "id": 6, "options": { "legend": { "calcs": [ ], @@ -202,7 +297,7 @@ "refId": "Zone threats" } ], - "title": "Threats", + "title": "Threats / $__interval", "type": "timeseries" }, { @@ -210,27 +305,27 @@ "type": "prometheus", "uid": "${datasource}" }, - "description": "Total bandwidth usage.", + "description": "The rate at which all bandwidth in the zone occurs.", "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 54, + "fillOpacity": 10, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never", "spanNulls": false }, - "unit": "bytes" + "unit": "Bps" } }, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 9 + "y": 17 }, - "id": 5, + "id": 7, "options": { "legend": { "calcs": [ ], @@ -255,32 +350,20 @@ "refId": "Zone bandwidth" } ], - "title": "Bandwidth", + "title": "Bandwidth rate", "type": "timeseries" }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 0, - "x": 0, - "y": 17 - }, - "id": 6, - "panels": [ ], - "title": "Zone bandwidth", - "type": "row" - }, { "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "description": "SSL encrypted and cached bandwidth.", + "description": "The amount of cached and encrypted bandwidth that occurs in the zone.", "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 54, + "drawStyle": "bars", + "fillOpacity": 10, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, @@ -294,9 +377,9 @@ "h": 8, "w": 12, "x": 0, - "y": 18 + "y": 25 }, - "id": 7, + "id": 8, "options": { "legend": { "calcs": [ ], @@ -332,7 +415,7 @@ "refId": "Zone cached bandwidth" } ], - "title": "SSL encrypted bandwidth", + "title": "Bandwidth type / $__interval", "type": "timeseries" }, { @@ -340,15 +423,16 @@ "type": "prometheus", "uid": "${datasource}" }, - "description": "Bandwidth usage by content type.", + "description": "The content types that bandwidth is being used for in the zone.", "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 54, + "drawStyle": "bars", + "fillOpacity": 10, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, - "showPoints": "never", + "showPoints": "auto", "spanNulls": false }, "unit": "bytes" @@ -358,9 +442,9 @@ "h": 8, "w": 12, "x": 12, - "y": 18 + "y": 25 }, - "id": 8, + "id": 9, "options": { "legend": { "calcs": [ ], @@ -385,46 +469,33 @@ "refId": "Zone bandwidth by content type" } ], - "title": "Bandwidth by content type", + "title": "Bandwidth content type / $__interval", "type": "timeseries" }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 0, - "x": 0, - "y": 26 - }, - "id": 9, - "panels": [ ], - "title": "Zone visitors", - "type": "row" - }, { "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "description": "Unique and repeat visitors.", + "description": "The number of zone views by browser family.", "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 54, + "fillOpacity": 10, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never", "spanNulls": false }, - "unit": "short" + "unit": "none" } }, "gridPos": { "h": 8, "w": 12, "x": 0, - "y": 27 + "y": 33 }, "id": 10, "options": { @@ -444,25 +515,14 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_uniques_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", - "format": "time_series", - "instant": false, - "legendFormat": "{{ zone }}", - "refId": "Zone unique visitors" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "expr": "cloudflare_zone_pageviews_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"} - cloudflare_zone_uniques_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}", + "expr": "rate(cloudflare_zone_requests_browser_map_page_views_count{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "legendFormat": "{{ zone }}", - "refId": "Zone repeat visitors" + "refId": "Zone browser map pageviews" } ], - "title": "Unique visitors", + "title": "Browser page views / $__interval", "type": "timeseries" }, { @@ -470,25 +530,28 @@ "type": "prometheus", "uid": "${datasource}" }, - "description": "Browser map pageviews count.", + "description": "The number of unique and total page views.", "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 54, + "fillOpacity": 10, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never", - "spanNulls": false + "spanNulls": false, + "stacking": { + "mode": "normal" + } }, - "unit": "short" + "unit": "none" } }, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 27 + "y": 33 }, "id": 11, "options": { @@ -508,80 +571,25 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_requests_browser_map_page_views_count{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(cloudflare_zone_uniques_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "legendFormat": "{{ zone }}", - "refId": "Zone browser map pageviews" - } - ], - "title": "Browser map pageviews", - "type": "timeseries" - }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 0, - "x": 0, - "y": 35 - }, - "id": 12, - "panels": [ ], - "title": "Zone status and location", - "type": "row" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "description": "Requests broken down by HTTP status code.", - "fieldConfig": { - "defaults": { - "custom": { - "fillOpacity": 54, - "gradientMode": "opacity", - "lineInterpolation": "smooth", - "lineWidth": 2, - "showPoints": "never", - "spanNulls": false - }, - "unit": "short" - } - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 36 - }, - "id": 13, - "options": { - "legend": { - "calcs": [ ], - "displayMode": "list" + "refId": "Zone unique visitors" }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } - }, - "pluginVersion": "v11.0.0", - "targets": [ { "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_requests_status{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "cloudflare_zone_pageviews_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"} - cloudflare_zone_uniques_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}", "format": "time_series", "instant": false, - "legendFormat": "{{ status }}", - "refId": "Zone requests by status" + "legendFormat": "{{ zone }}", + "refId": "Zone repeat visitors" } ], - "title": "Requests by status", + "title": "Unique page views / $__interval", "type": "timeseries" }, { @@ -589,31 +597,39 @@ "type": "prometheus", "uid": "${datasource}" }, - "description": "Requests by colocation center.", + "description": "The number of different HTTP status codes used for requests in the zone.", "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 0, + "fillOpacity": 10, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, "showPoints": "never", - "spanNulls": false + "spanNulls": false, + "stacking": { + "mode": "normal" + } }, - "unit": "reqps" + "unit": "none" } }, "gridPos": { "h": 8, - "w": 12, - "x": 12, - "y": 36 + "w": 24, + "x": 0, + "y": 41 }, - "id": 14, + "id": 12, "options": { "legend": { - "calcs": [ ], - "displayMode": "list" + "calcs": [ + "min", + "max", + "mean" + ], + "displayMode": "table", + "placement": "right" }, "tooltip": { "mode": "multi", @@ -627,104 +643,34 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_colocation_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(cloudflare_zone_requests_status{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, - "legendFormat": "{{ colo_code }}", - "refId": "Zone colocation requests" + "legendFormat": "{{ status }}", + "refId": "Zone requests by status" } ], - "title": "Requests by colocation", + "title": "Request HTTP status / $__interval", "type": "timeseries" }, - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 0, - "x": 0, - "y": 44 - }, - "id": 15, - "panels": [ ], - "title": "Load balancer pools", - "type": "row" - }, { "datasource": { "type": "prometheus", "uid": "${datasource}" }, - "description": "Health status of the pool (0=unhealthy, 1=healthy).", + "description": "The different colocations being used by the zone and their request rates.", "fieldConfig": { "defaults": { - "color": { - "fixedColor": "text", - "mode": "fixed" - }, - "unit": "short" - } - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 45 - }, - "id": 16, - "pluginVersion": "v11.0.0", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "expr": "cloudflare_zone_pool_health_status{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}", - "format": "time_series", - "instant": false, - "legendFormat": "{{ pool_name }}", - "refId": "Pool status" - } - ], - "title": "Pool health status", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "description": "Rate of requests to the pool.", - "fieldConfig": { - "defaults": { - "custom": { - "fillOpacity": 0, - "gradientMode": "opacity", - "lineInterpolation": "smooth", - "lineWidth": 2, - "showPoints": "never", - "spanNulls": false - }, "unit": "reqps" } }, "gridPos": { "h": 8, - "w": 12, - "x": 12, - "y": 45 - }, - "id": 17, - "options": { - "legend": { - "calcs": [ ], - "displayMode": "list" - }, - "tooltip": { - "mode": "multi", - "sort": "desc" - } + "w": 24, + "x": 0, + "y": 49 }, + "id": 13, "pluginVersion": "v11.0.0", "targets": [ { @@ -732,15 +678,15 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_pool_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(cloudflare_zone_colocation_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, - "legendFormat": "{{ pool_name }}", - "refId": "Request rate" + "legendFormat": "{{ colo_code }}", + "refId": "Zone colocation requests" } ], - "title": "Pool requests", - "type": "timeseries" + "title": "Colocation requests", + "type": "table" } ], "refresh": "1m", diff --git a/cloudflare-mixin/panels.libsonnet b/cloudflare-mixin/panels.libsonnet index c98decdf4..064bef035 100644 --- a/cloudflare-mixin/panels.libsonnet +++ b/cloudflare-mixin/panels.libsonnet @@ -8,120 +8,164 @@ local utils = commonlib.utils; local signals = this.signals, // Zone panels + + alertsPanel: { + datasource: { + uid: 'prometheus', + }, + targets: [], + type: 'alertlist', + title: 'Alerts', + options: { + alertInstanceLabelFilter: '{job=~"${job:regex}", instance=~"${instance:regex}"}', + alertName: '', + dashboardAlerts: false, + groupBy: [], + groupMode: 'default', + maxItems: 5, + sortOrder: 1, + stateFilter: { + 'error': true, + firing: true, + noData: true, + normal: true, + pending: true, + }, + viewMode: 'list', + }, + }, + requestsPanel: commonlib.panels.generic.timeSeries.base.new( - 'Requests', + 'Request rate', targets=[signals.zone.requestsTotal.asTarget()], - description='Rate of requests to the zone.' + description='The rate at which requests to the zone occur.' ) + g.panel.timeSeries.standardOptions.withUnit('reqps') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0) + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), cachedRequestsPanel: commonlib.panels.generic.timeSeries.base.new( - 'Cached requests', + 'Cached requests / $__interval', targets=[signals.zone.requestsCached.asTarget()], - description='Percentage of cached requests.' - ) - + g.panel.timeSeries.standardOptions.withUnit('percent') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0) - + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + description='The percentage of requests to the zone that are cached.' + ) + + g.panel.timeSeries.standardOptions.withUnit('percentunit') + + g.panel.timeSeries.standardOptions.withMin(0) + + g.panel.timeSeries.standardOptions.withMax(1) + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false) + + g.panel.timeSeries.fieldConfig.defaults.custom.thresholdsStyle.withMode('area') + + g.panel.timeSeries.standardOptions.thresholds.withMode('percentage') + + g.panel.timeSeries.standardOptions.thresholds.withSteps([ + { color: 'red', value: null }, + { color: '#EAB839', value: 50 }, + { color: 'green', value: 80 }, + ]), threatsPanel: commonlib.panels.generic.timeSeries.base.new( - 'Threats', + 'Threats / $__interval', targets=[signals.zone.threatsTotal.asTarget()], - description='Number of threats blocked.' + description='The number of threats that have targeted the zone.' ) - + g.panel.timeSeries.standardOptions.withUnit('short') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0) + + g.panel.timeSeries.standardOptions.withUnit('none') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), bandwidthPanel: commonlib.panels.generic.timeSeries.base.new( - 'Bandwidth', + 'Bandwidth rate', targets=[signals.zone.bandwidthTotal.asTarget()], - description='Total bandwidth usage.' + description='The rate at which all bandwidth in the zone occurs.' ) - + g.panel.timeSeries.standardOptions.withUnit('bytes') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(54) + + g.panel.timeSeries.standardOptions.withUnit('Bps') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), sslBandwidthPanel: commonlib.panels.generic.timeSeries.base.new( - 'SSL encrypted bandwidth', + 'Bandwidth type / $__interval', targets=[ signals.zone.bandwidthSslEncrypted.asTarget(), signals.zone.bandwidthCached.asTarget(), ], - description='SSL encrypted and cached bandwidth.' + description='The amount of cached and encrypted bandwidth that occurs in the zone.' ) + g.panel.timeSeries.standardOptions.withUnit('bytes') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(54) - + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false) + + g.panel.timeSeries.fieldConfig.defaults.custom.withDrawStyle('bars'), bandwidthContentTypePanel: commonlib.panels.generic.timeSeries.base.new( - 'Bandwidth by content type', + 'Bandwidth content type / $__interval', targets=[signals.zone.bandwidthContentType.asTarget()], - description='Bandwidth usage by content type.' + description='The content types that bandwidth is being used for in the zone.' ) + g.panel.timeSeries.standardOptions.withUnit('bytes') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(54) - + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false) + + g.panel.timeSeries.fieldConfig.defaults.custom.withDrawStyle('bars') + + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('auto'), uniqueVisitorsPanel: commonlib.panels.generic.timeSeries.base.new( - 'Unique visitors', + 'Unique page views / $__interval', targets=[ signals.zone.uniquesTotal.asTarget(), signals.zone.repeatVisitors.asTarget(), ], - description='Unique and repeat visitors.' + description='The number of unique and total page views.' ) - + g.panel.timeSeries.standardOptions.withUnit('short') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(54) - + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + g.panel.timeSeries.standardOptions.withUnit('none') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false) + + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), requestsStatusPanel: commonlib.panels.generic.timeSeries.base.new( - 'Requests by status', + 'Request HTTP status / $__interval', targets=[signals.zone.requestsStatus.asTarget()], - description='Requests broken down by HTTP status code.' + description='The number of different HTTP status codes used for requests in the zone.' ) - + g.panel.timeSeries.standardOptions.withUnit('short') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(54) - + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + g.panel.timeSeries.standardOptions.withUnit('none') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false) + + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal') + + g.panel.timeSeries.options.legend.withCalcs(['min', 'max', 'mean']) + + g.panel.timeSeries.options.legend.withDisplayMode('table') + + g.panel.timeSeries.options.legend.withPlacement('right'), browserMapPanel: commonlib.panels.generic.timeSeries.base.new( - 'Browser map pageviews', + 'Browser page views / $__interval', targets=[signals.zone.requestsBrowserMap.asTarget()], - description='Browser map pageviews count.' + description='The number of zone views by browser family.' ) - + g.panel.timeSeries.standardOptions.withUnit('short') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(54) + + g.panel.timeSeries.standardOptions.withUnit('none') + + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), colocationRequestsPanel: - commonlib.panels.generic.timeSeries.base.new( - 'Requests by colocation', + commonlib.panels.generic.table.base.new( + 'Colocation requests', targets=[signals.zone.colocationRequests.asTarget()], - description='Requests by colocation center.' + description='The different colocations being used by the zone and their request rates.' ) - + g.panel.timeSeries.standardOptions.withUnit('reqps') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0) - + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + g.panel.table.standardOptions.withUnit('reqps'), // Pool panels poolStatusPanel: - commonlib.panels.generic.stat.base.new( - 'Pool health status', - targets=[signals.pool.poolStatus.asTarget()], - description='Health status of the pool (0=unhealthy, 1=healthy).' - ) - + g.panel.stat.standardOptions.withUnit('short'), + commonlib.panels.generic.table.base.new( + 'Pool status', + targets=[ + signals.pool.poolStatus.asTarget() { format: 'table' }, + signals.pool.requests.asTarget() { format: 'table' }, + ], + description='A table view of the pools in your zone showing their health and rate of requests.' + ), poolRequestsPanel: commonlib.panels.generic.timeSeries.base.new( @@ -136,7 +180,7 @@ local utils = commonlib.utils; // Worker panels workerCpuTimePanel: commonlib.panels.generic.timeSeries.base.new( - 'Worker CPU time', + 'Worker CPU time quantiles', targets=[signals.worker.cpuTime.asTarget()], description='CPU time consumed by the worker.' ) @@ -146,7 +190,7 @@ local utils = commonlib.utils; workerDurationPanel: commonlib.panels.generic.timeSeries.base.new( - 'Worker duration', + 'Worker duration quantiles', targets=[signals.worker.duration.asTarget()], description='Duration of worker execution.' ) diff --git a/cloudflare-mixin/rows.libsonnet b/cloudflare-mixin/rows.libsonnet index 9e5122a17..caa2ff02d 100644 --- a/cloudflare-mixin/rows.libsonnet +++ b/cloudflare-mixin/rows.libsonnet @@ -1,57 +1,24 @@ local g = import './g.libsonnet'; -// Use g.util.grid.wrapPanels() to import into custom dashboard { new(this): { - // Zone overview metrics + // Zone overview main metrics zoneOverview: g.panel.row.new('Zone overview') + g.panel.row.withPanels( [ - this.grafana.panels.requestsPanel + g.panel.timeSeries.gridPos.withW(12), - this.grafana.panels.cachedRequestsPanel + g.panel.timeSeries.gridPos.withW(12), - this.grafana.panels.threatsPanel + g.panel.timeSeries.gridPos.withW(12), - this.grafana.panels.bandwidthPanel + g.panel.timeSeries.gridPos.withW(12), - ] - ), - - // Zone bandwidth metrics - zoneBandwidth: - g.panel.row.new('Zone bandwidth') - + g.panel.row.withPanels( - [ - this.grafana.panels.sslBandwidthPanel + g.panel.timeSeries.gridPos.withW(12), - this.grafana.panels.bandwidthContentTypePanel + g.panel.timeSeries.gridPos.withW(12), - ] - ), - - // Zone visitors metrics - zoneVisitors: - g.panel.row.new('Zone visitors') - + g.panel.row.withPanels( - [ - this.grafana.panels.uniqueVisitorsPanel + g.panel.timeSeries.gridPos.withW(12), - this.grafana.panels.browserMapPanel + g.panel.timeSeries.gridPos.withW(12), - ] - ), - - // Zone status and location metrics - zoneStatusLocation: - g.panel.row.new('Zone status and location') - + g.panel.row.withPanels( - [ - this.grafana.panels.requestsStatusPanel + g.panel.timeSeries.gridPos.withW(12), - this.grafana.panels.colocationRequestsPanel + g.panel.timeSeries.gridPos.withW(12), - ] - ), - - // Pool metrics - pools: - g.panel.row.new('Load balancer pools') - + g.panel.row.withPanels( - [ - this.grafana.panels.poolStatusPanel + g.panel.stat.gridPos.withW(12), - this.grafana.panels.poolRequestsPanel + g.panel.timeSeries.gridPos.withW(12), + this.grafana.panels.alertsPanel + g.panel.table.gridPos.withW(12) + g.panel.table.gridPos.withH(8), + this.grafana.panels.poolStatusPanel + g.panel.table.gridPos.withW(12) + g.panel.table.gridPos.withH(8), + this.grafana.panels.requestsPanel + g.panel.timeSeries.gridPos.withW(12) + g.panel.timeSeries.gridPos.withH(8), + this.grafana.panels.cachedRequestsPanel + g.panel.timeSeries.gridPos.withW(12) + g.panel.timeSeries.gridPos.withH(8), + this.grafana.panels.threatsPanel + g.panel.timeSeries.gridPos.withW(12) + g.panel.timeSeries.gridPos.withH(8), + this.grafana.panels.bandwidthPanel + g.panel.timeSeries.gridPos.withW(12) + g.panel.timeSeries.gridPos.withH(8), + this.grafana.panels.sslBandwidthPanel + g.panel.timeSeries.gridPos.withW(12) + g.panel.timeSeries.gridPos.withH(8), + this.grafana.panels.bandwidthContentTypePanel + g.panel.timeSeries.gridPos.withW(12) + g.panel.timeSeries.gridPos.withH(8), + this.grafana.panels.browserMapPanel + g.panel.timeSeries.gridPos.withW(12) + g.panel.timeSeries.gridPos.withH(8), + this.grafana.panels.uniqueVisitorsPanel + g.panel.timeSeries.gridPos.withW(12) + g.panel.timeSeries.gridPos.withH(8), + this.grafana.panels.requestsStatusPanel + g.panel.timeSeries.gridPos.withW(24) + g.panel.timeSeries.gridPos.withH(8), + this.grafana.panels.colocationRequestsPanel + g.panel.table.gridPos.withW(24) + g.panel.table.gridPos.withH(8), ] ), @@ -60,10 +27,10 @@ local g = import './g.libsonnet'; g.panel.row.new('Workers') + g.panel.row.withPanels( [ - this.grafana.panels.workerCpuTimePanel + g.panel.timeSeries.gridPos.withW(12), - this.grafana.panels.workerDurationPanel + g.panel.timeSeries.gridPos.withW(12), - this.grafana.panels.workerRequestsPanel + g.panel.timeSeries.gridPos.withW(12), - this.grafana.panels.workerErrorsPanel + g.panel.timeSeries.gridPos.withW(12), + this.grafana.panels.workerCpuTimePanel + g.panel.timeSeries.gridPos.withW(24) + g.panel.timeSeries.gridPos.withH(8), + this.grafana.panels.workerDurationPanel + g.panel.timeSeries.gridPos.withW(24) + g.panel.timeSeries.gridPos.withH(8), + this.grafana.panels.workerRequestsPanel + g.panel.timeSeries.gridPos.withW(12) + g.panel.timeSeries.gridPos.withH(8), + this.grafana.panels.workerErrorsPanel + g.panel.timeSeries.gridPos.withW(12) + g.panel.timeSeries.gridPos.withH(8), ] ), }, From 62e4a745d0588678f5f3636a06d2c8ae4275405a Mon Sep 17 00:00:00 2001 From: schmikei Date: Thu, 11 Dec 2025 10:40:07 -0500 Subject: [PATCH 4/8] address PR feedback; offsets, fillOpacity, filteringSelector usage, casing, worker data --- cloudflare-mixin/alerts.libsonnet | 10 +-- cloudflare-mixin/config.libsonnet | 3 - cloudflare-mixin/dashboards.libsonnet | 2 +- .../cloudflare-geomap-overview.json | 27 ++++---- .../cloudflare-worker-overview.json | 33 +++++----- .../cloudflare-zone-overview.json | 61 ++++++++++--------- cloudflare-mixin/links.libsonnet | 10 ++- cloudflare-mixin/mixin.libsonnet | 9 ++- cloudflare-mixin/panels.libsonnet | 17 +----- .../prometheus_alerts.yaml | 8 +-- cloudflare-mixin/signals/zone.libsonnet | 2 +- 11 files changed, 93 insertions(+), 89 deletions(-) diff --git a/cloudflare-mixin/alerts.libsonnet b/cloudflare-mixin/alerts.libsonnet index d0199666e..ffeab4e51 100644 --- a/cloudflare-mixin/alerts.libsonnet +++ b/cloudflare-mixin/alerts.libsonnet @@ -7,7 +7,7 @@ { alert: 'CloudflareHighThreatCount', expr: ||| - sum without (instance) (increase(cloudflare_zone_threats_total[5m])) > %(alertsHighThreatCount)s + sum without (instance) (increase(cloudflare_zone_threats_total{%(filteringSelector)s}[5m])) > %(alertsHighThreatCount)s ||| % this.config, 'for': '5m', labels: { @@ -21,7 +21,7 @@ { alert: 'CloudflareHighRequestRate', expr: ||| - sum without (instance) (100 * (rate(cloudflare_zone_requests_total[10m]) / clamp_min(rate(cloudflare_zone_requests_total[50m] offset 10m), 1))) > %(alertsHighRequestRate)s + sum without (instance) (100 * (rate(cloudflare_zone_requests_total{%(filteringSelector)s}[10m]) / clamp_min(rate(cloudflare_zone_requests_total{%(filteringSelector)s}[50m] offset 10m), 1))) > %(alertsHighRequestRate)s ||| % this.config, 'for': '5m', labels: { @@ -35,7 +35,7 @@ { alert: 'CloudflareHighHTTPErrorCodes', expr: ||| - sum without (instance) (increase(cloudflare_zone_requests_status{status=~"4.*|5.*"}[5m])) > %(alertsHighHTTPErrorCodeCount)s + sum without (instance) (increase(cloudflare_zone_requests_status{%(filteringSelector)s,status=~"4.*|5.*"}[5m])) > %(alertsHighHTTPErrorCodeCount)s ||| % this.config, 'for': '5m', labels: { @@ -49,7 +49,7 @@ { alert: 'CloudflareUnhealthyPools', expr: ||| - sum without (instance, load_balancer_name) (cloudflare_zone_pool_health_status) == 0 + sum without (instance, load_balancer_name) (cloudflare_zone_pool_health_status{%(filteringSelector)s}) == 0 ||| % this.config, 'for': '5m', labels: { @@ -63,7 +63,7 @@ { alert: 'CloudflareMetricsDown', expr: ||| - up{job="%(alertsMetricsDownJobName)s"} == 0 + up{%(filteringSelector)s} == 0 ||| % this.config, 'for': '5m', labels: { diff --git a/cloudflare-mixin/config.libsonnet b/cloudflare-mixin/config.libsonnet index f0c98657e..2d504617f 100644 --- a/cloudflare-mixin/config.libsonnet +++ b/cloudflare-mixin/config.libsonnet @@ -16,9 +16,6 @@ dashboardRefresh: '1m', metricsSource: 'prometheus', - // CloudflareMetricsDown alert filter variable - alertsMetricsDownJobName: 'integrations/cloudflare', - // alerts thresholds alertsHighThreatCount: 3, // count alertsHighRequestRate: 150, // percentage diff --git a/cloudflare-mixin/dashboards.libsonnet b/cloudflare-mixin/dashboards.libsonnet index 63aa57308..831a10b25 100644 --- a/cloudflare-mixin/dashboards.libsonnet +++ b/cloudflare-mixin/dashboards.libsonnet @@ -59,7 +59,7 @@ local g = import './g.libsonnet'; ), 'cloudflare-geomap-overview.json': - g.dashboard.new(prefix + ' Geomap overview') + g.dashboard.new(prefix + ' geomap overview') + g.dashboard.withPanels( g.util.grid.wrapPanels( [ diff --git a/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json b/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json index dd9fe1ad6..621cc83a8 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json @@ -4,18 +4,21 @@ }, "links": [ { + "includeVars": true, "keepTime": true, "title": "Geographic overview", "type": "link", "url": "/d/cloudflare_cloudflare_geomap_overview" }, { + "includeVars": true, "keepTime": true, "title": "Worker overview", "type": "link", "url": "/d/cloudflare_cloudflare_worker_overview" }, { + "includeVars": true, "keepTime": true, "title": "Zone overview", "type": "link", @@ -53,14 +56,14 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "increase(${geo_metric}{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", + "expr": "increase(${geo_metric}{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "table", "instant": false, "legendFormat": "", "refId": "$geo_metric Distribution" } ], - "title": "Geographic Distribution", + "title": "Geographic distribution", "type": "table" }, { @@ -83,7 +86,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "increase(${geo_metric}{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", + "expr": "increase(${geo_metric}{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, "interval": "1m", @@ -91,7 +94,7 @@ "refId": "$geo_metric Distribution" } ], - "title": "Geographic Distribution", + "title": "Geographic distribution", "type": "geomap" } ], @@ -119,13 +122,13 @@ "label": "Job", "multi": true, "name": "job", - "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\"}, job)", + "query": "label_values(cloudflare_zone_requests_total{job=\"integrations/cloudflare\"}, job)", "refresh": 2, "sort": 1, "type": "query" }, { - "allValue": ".+", + "allValue": ".*", "datasource": { "type": "prometheus", "uid": "${datasource}" @@ -134,13 +137,13 @@ "label": "Cluster", "multi": true, "name": "cluster", - "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\"}, cluster)", + "query": "label_values(cloudflare_zone_requests_total{job=\"integrations/cloudflare\",job=~\"$job\"}, cluster)", "refresh": 2, "sort": 1, "type": "query" }, { - "allValue": ".+", + "allValue": ".*", "datasource": { "type": "prometheus", "uid": "${datasource}" @@ -149,7 +152,7 @@ "label": "Zone", "multi": true, "name": "zone", - "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\"}, zone)", + "query": "label_values(cloudflare_zone_requests_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\"}, zone)", "refresh": 2, "sort": 1, "type": "query" @@ -164,7 +167,7 @@ "label": "Script", "multi": true, "name": "script_name", - "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\"}, script_name)", + "query": "label_values(cloudflare_zone_requests_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\"}, script_name)", "refresh": 2, "sort": 1, "type": "query" @@ -179,7 +182,7 @@ "label": "Instance", "multi": true, "name": "instance", - "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\"}, instance)", + "query": "label_values(cloudflare_zone_requests_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\"}, instance)", "refresh": 2, "sort": 1, "type": "query" @@ -221,6 +224,6 @@ "to": "now" }, "timezone": "default", - "title": "Cloudflare Geomap overview", + "title": "Cloudflare geomap overview", "uid": "cloudflare_cloudflare_geomap_overview" } \ No newline at end of file diff --git a/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json b/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json index e53e47dc5..c5a849cb8 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json @@ -4,18 +4,21 @@ }, "links": [ { + "includeVars": true, "keepTime": true, "title": "Geographic overview", "type": "link", "url": "/d/cloudflare_cloudflare_geomap_overview" }, { + "includeVars": true, "keepTime": true, "title": "Worker overview", "type": "link", "url": "/d/cloudflare_cloudflare_worker_overview" }, { + "includeVars": true, "keepTime": true, "title": "Zone overview", "type": "link", @@ -55,7 +58,7 @@ "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 54, + "fillOpacity": 30, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, @@ -89,7 +92,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "cloudflare_worker_cpu_time{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}", + "expr": "cloudflare_worker_cpu_time{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}", "format": "time_series", "instant": false, "legendFormat": "{{ script_name }} - {{ quantile }}", @@ -108,7 +111,7 @@ "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 54, + "fillOpacity": 30, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, @@ -142,7 +145,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "cloudflare_worker_duration{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}", + "expr": "cloudflare_worker_duration{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}", "format": "time_series", "instant": false, "legendFormat": "{{ script_name }} - {{ quantile }}", @@ -161,7 +164,7 @@ "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 0, + "fillOpacity": 30, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, @@ -195,7 +198,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_worker_requests_count{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(cloudflare_worker_requests_count{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "legendFormat": "{{ script_name }}", @@ -214,7 +217,7 @@ "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 0, + "fillOpacity": 30, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, @@ -248,7 +251,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "increase(cloudflare_worker_errors_count{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", + "expr": "increase(cloudflare_worker_errors_count{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, "legendFormat": "{{ script_name }}", @@ -283,13 +286,13 @@ "label": "Job", "multi": true, "name": "job", - "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\"}, job)", + "query": "label_values(cloudflare_zone_requests_total{job=\"integrations/cloudflare\"}, job)", "refresh": 2, "sort": 1, "type": "query" }, { - "allValue": ".+", + "allValue": ".*", "datasource": { "type": "prometheus", "uid": "${datasource}" @@ -298,13 +301,13 @@ "label": "Cluster", "multi": true, "name": "cluster", - "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\"}, cluster)", + "query": "label_values(cloudflare_zone_requests_total{job=\"integrations/cloudflare\",job=~\"$job\"}, cluster)", "refresh": 2, "sort": 1, "type": "query" }, { - "allValue": ".+", + "allValue": ".*", "datasource": { "type": "prometheus", "uid": "${datasource}" @@ -313,7 +316,7 @@ "label": "Zone", "multi": true, "name": "zone", - "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\"}, zone)", + "query": "label_values(cloudflare_zone_requests_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\"}, zone)", "refresh": 2, "sort": 1, "type": "query" @@ -328,7 +331,7 @@ "label": "Script", "multi": true, "name": "script_name", - "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\"}, script_name)", + "query": "label_values(cloudflare_zone_requests_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\"}, script_name)", "refresh": 2, "sort": 1, "type": "query" @@ -343,7 +346,7 @@ "label": "Instance", "multi": true, "name": "instance", - "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\"}, instance)", + "query": "label_values(cloudflare_zone_requests_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\"}, instance)", "refresh": 2, "sort": 1, "type": "query" diff --git a/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json b/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json index e4737c63d..a1c7981b8 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json @@ -4,18 +4,21 @@ }, "links": [ { + "includeVars": true, "keepTime": true, "title": "Geographic overview", "type": "link", "url": "/d/cloudflare_cloudflare_geomap_overview" }, { + "includeVars": true, "keepTime": true, "title": "Worker overview", "type": "link", "url": "/d/cloudflare_cloudflare_worker_overview" }, { + "includeVars": true, "keepTime": true, "title": "Zone overview", "type": "link", @@ -98,7 +101,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "cloudflare_zone_pool_health_status{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}", + "expr": "cloudflare_zone_pool_health_status{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}", "format": "table", "instant": false, "legendFormat": "{{ pool_name }}", @@ -109,7 +112,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_pool_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(cloudflare_zone_pool_requests_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "table", "instant": false, "legendFormat": "{{ pool_name }}", @@ -128,7 +131,7 @@ "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 10, + "fillOpacity": 30, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, @@ -162,7 +165,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(cloudflare_zone_requests_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "legendFormat": "{{ zone }}", @@ -181,7 +184,7 @@ "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 10, + "fillOpacity": 30, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, @@ -237,7 +240,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "increase(cloudflare_zone_requests_cached{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:]) / increase(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:])", + "expr": "increase(cloudflare_zone_requests_cached{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval) / increase(cloudflare_zone_requests_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, "legendFormat": "{{ zone }}", @@ -256,7 +259,7 @@ "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 10, + "fillOpacity": 30, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, @@ -290,7 +293,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_threats_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(cloudflare_zone_threats_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "legendFormat": "{{ zone }}", @@ -343,7 +346,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_bandwidth_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(cloudflare_zone_bandwidth_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "legendFormat": "{{ zone }}", @@ -363,7 +366,7 @@ "defaults": { "custom": { "drawStyle": "bars", - "fillOpacity": 10, + "fillOpacity": 30, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, @@ -397,7 +400,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_bandwidth_ssl_encrypted{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(cloudflare_zone_bandwidth_ssl_encrypted{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "legendFormat": "{{ zone }}", @@ -408,7 +411,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_bandwidth_cached{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(cloudflare_zone_bandwidth_cached{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "legendFormat": "{{ zone }}", @@ -428,7 +431,7 @@ "defaults": { "custom": { "drawStyle": "bars", - "fillOpacity": 10, + "fillOpacity": 30, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, @@ -462,7 +465,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_bandwidth_content_type{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(cloudflare_zone_bandwidth_content_type{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "legendFormat": "{{ content_type }}", @@ -481,7 +484,7 @@ "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 10, + "fillOpacity": 30, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, @@ -515,7 +518,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_requests_browser_map_page_views_count{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(cloudflare_zone_requests_browser_map_page_views_count{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "legendFormat": "{{ zone }}", @@ -534,7 +537,7 @@ "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 10, + "fillOpacity": 30, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, @@ -571,7 +574,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_uniques_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(cloudflare_zone_uniques_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "legendFormat": "{{ zone }}", @@ -582,7 +585,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "cloudflare_zone_pageviews_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"} - cloudflare_zone_uniques_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}", + "expr": "cloudflare_zone_pageviews_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"} - cloudflare_zone_uniques_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}", "format": "time_series", "instant": false, "legendFormat": "{{ zone }}", @@ -601,7 +604,7 @@ "fieldConfig": { "defaults": { "custom": { - "fillOpacity": 10, + "fillOpacity": 30, "gradientMode": "opacity", "lineInterpolation": "smooth", "lineWidth": 2, @@ -643,7 +646,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_requests_status{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(cloudflare_zone_requests_status{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "legendFormat": "{{ status }}", @@ -678,7 +681,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_colocation_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "rate(cloudflare_zone_colocation_requests_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, "legendFormat": "{{ colo_code }}", @@ -713,13 +716,13 @@ "label": "Job", "multi": true, "name": "job", - "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\"}, job)", + "query": "label_values(cloudflare_zone_requests_total{job=\"integrations/cloudflare\"}, job)", "refresh": 2, "sort": 1, "type": "query" }, { - "allValue": ".+", + "allValue": ".*", "datasource": { "type": "prometheus", "uid": "${datasource}" @@ -728,13 +731,13 @@ "label": "Cluster", "multi": true, "name": "cluster", - "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\"}, cluster)", + "query": "label_values(cloudflare_zone_requests_total{job=\"integrations/cloudflare\",job=~\"$job\"}, cluster)", "refresh": 2, "sort": 1, "type": "query" }, { - "allValue": ".+", + "allValue": ".*", "datasource": { "type": "prometheus", "uid": "${datasource}" @@ -743,7 +746,7 @@ "label": "Zone", "multi": true, "name": "zone", - "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\"}, zone)", + "query": "label_values(cloudflare_zone_requests_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\"}, zone)", "refresh": 2, "sort": 1, "type": "query" @@ -758,7 +761,7 @@ "label": "Script", "multi": true, "name": "script_name", - "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\"}, script_name)", + "query": "label_values(cloudflare_zone_requests_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\"}, script_name)", "refresh": 2, "sort": 1, "type": "query" @@ -773,7 +776,7 @@ "label": "Instance", "multi": true, "name": "instance", - "query": "label_values(cloudflare_zone_requests_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\"}, instance)", + "query": "label_values(cloudflare_zone_requests_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\"}, instance)", "refresh": 2, "sort": 1, "type": "query" diff --git a/cloudflare-mixin/links.libsonnet b/cloudflare-mixin/links.libsonnet index b35cb1f9a..509717c63 100644 --- a/cloudflare-mixin/links.libsonnet +++ b/cloudflare-mixin/links.libsonnet @@ -5,13 +5,17 @@ local g = import './g.libsonnet'; new(this): { cloudflareZone: link.link.new('Zone overview', '/d/' + this.grafana.dashboards['cloudflare-zone-overview.json'].uid) - + link.link.options.withKeepTime(true), + + link.link.options.withKeepTime(true) + + link.link.options.withIncludeVars(true), cloudflareWorker: link.link.new('Worker overview', '/d/' + this.grafana.dashboards['cloudflare-worker-overview.json'].uid) - + link.link.options.withKeepTime(true), + + link.link.options.withKeepTime(true) + + link.link.options.withIncludeVars(true), cloudflareGeomap: link.link.new('Geographic overview', '/d/' + this.grafana.dashboards['cloudflare-geomap-overview.json'].uid) - + link.link.options.withKeepTime(true), + + link.link.options.withKeepTime(true) + + link.link.options.withIncludeVars(true), + otherDashboards: link.dashboards.new('All dashboards', this.config.dashboardTags) + link.dashboards.options.withIncludeVars(true) diff --git a/cloudflare-mixin/mixin.libsonnet b/cloudflare-mixin/mixin.libsonnet index 4710559be..1f8ad59ee 100644 --- a/cloudflare-mixin/mixin.libsonnet +++ b/cloudflare-mixin/mixin.libsonnet @@ -4,15 +4,22 @@ local util = import 'grafana-cloud-integration-utils/util.libsonnet'; local cloudflare = cloudflarelib.new() + cloudflarelib.withConfigMixin({ - filteringSelector: 'job=~"integrations/cloudflare"', + filteringSelector: 'job="integrations/cloudflare"', uid: 'cloudflare', }); local optional_labels = { + cluster+: { + allValue: '.*', + }, script_name+: { allValue: '.*', label: 'Script', }, + zone+: { + allValue: '.*', + label: 'Zone', + }, }; { diff --git a/cloudflare-mixin/panels.libsonnet b/cloudflare-mixin/panels.libsonnet index 064bef035..3c6057af7 100644 --- a/cloudflare-mixin/panels.libsonnet +++ b/cloudflare-mixin/panels.libsonnet @@ -42,7 +42,6 @@ local utils = commonlib.utils; description='The rate at which requests to the zone occur.' ) + g.panel.timeSeries.standardOptions.withUnit('reqps') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), cachedRequestsPanel: @@ -54,7 +53,6 @@ local utils = commonlib.utils; + g.panel.timeSeries.standardOptions.withUnit('percentunit') + g.panel.timeSeries.standardOptions.withMin(0) + g.panel.timeSeries.standardOptions.withMax(1) - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false) + g.panel.timeSeries.fieldConfig.defaults.custom.thresholdsStyle.withMode('area') + g.panel.timeSeries.standardOptions.thresholds.withMode('percentage') @@ -71,7 +69,6 @@ local utils = commonlib.utils; description='The number of threats that have targeted the zone.' ) + g.panel.timeSeries.standardOptions.withUnit('none') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), bandwidthPanel: @@ -94,7 +91,6 @@ local utils = commonlib.utils; description='The amount of cached and encrypted bandwidth that occurs in the zone.' ) + g.panel.timeSeries.standardOptions.withUnit('bytes') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false) + g.panel.timeSeries.fieldConfig.defaults.custom.withDrawStyle('bars'), @@ -105,7 +101,6 @@ local utils = commonlib.utils; description='The content types that bandwidth is being used for in the zone.' ) + g.panel.timeSeries.standardOptions.withUnit('bytes') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false) + g.panel.timeSeries.fieldConfig.defaults.custom.withDrawStyle('bars') + g.panel.timeSeries.fieldConfig.defaults.custom.withShowPoints('auto'), @@ -120,7 +115,6 @@ local utils = commonlib.utils; description='The number of unique and total page views.' ) + g.panel.timeSeries.standardOptions.withUnit('none') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false) + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal'), @@ -131,7 +125,6 @@ local utils = commonlib.utils; description='The number of different HTTP status codes used for requests in the zone.' ) + g.panel.timeSeries.standardOptions.withUnit('none') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false) + g.panel.timeSeries.fieldConfig.defaults.custom.stacking.withMode('normal') + g.panel.timeSeries.options.legend.withCalcs(['min', 'max', 'mean']) @@ -145,7 +138,6 @@ local utils = commonlib.utils; description='The number of zone views by browser family.' ) + g.panel.timeSeries.standardOptions.withUnit('none') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(10) + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), colocationRequestsPanel: @@ -174,7 +166,6 @@ local utils = commonlib.utils; description='Rate of requests to the pool.' ) + g.panel.timeSeries.standardOptions.withUnit('reqps') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0) + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), // Worker panels @@ -185,7 +176,6 @@ local utils = commonlib.utils; description='CPU time consumed by the worker.' ) + g.panel.timeSeries.standardOptions.withUnit('s') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(54) + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), workerDurationPanel: @@ -195,7 +185,6 @@ local utils = commonlib.utils; description='Duration of worker execution.' ) + g.panel.timeSeries.standardOptions.withUnit('s') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(54) + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), workerRequestsPanel: @@ -205,7 +194,6 @@ local utils = commonlib.utils; description='Rate of requests to the worker.' ) + g.panel.timeSeries.standardOptions.withUnit('reqps') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0) + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), workerErrorsPanel: @@ -215,18 +203,17 @@ local utils = commonlib.utils; description='Number of errors from the worker.' ) + g.panel.timeSeries.standardOptions.withUnit('short') - + g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0) + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), geoMetricByCountryGeomapPanel: - g.panel.geomap.new('Geographic Distribution') + g.panel.geomap.new('Geographic distribution') + g.panel.geomap.panelOptions.withDescription('Geomap panel currently showing $geo_metric for the zone.') + g.panel.geomap.queryOptions.withTargets([ signals.geomap.geoMapByCountry.asTarget() { interval: '1m' } + g.query.prometheus.withLegendFormat(''), ]), geoMetricsByCountryTablePanel: - g.panel.table.new('Geographic Distribution') + g.panel.table.new('Geographic distribution') + g.panel.table.panelOptions.withDescription('Table currently showing $geo_metric for the zone.') + g.panel.table.queryOptions.withTargets([ signals.geomap.geoMetricsByCountryTable.asTarget() diff --git a/cloudflare-mixin/prometheus_rules_out/prometheus_alerts.yaml b/cloudflare-mixin/prometheus_rules_out/prometheus_alerts.yaml index b0ecee7cd..7721dc6aa 100644 --- a/cloudflare-mixin/prometheus_rules_out/prometheus_alerts.yaml +++ b/cloudflare-mixin/prometheus_rules_out/prometheus_alerts.yaml @@ -6,7 +6,7 @@ groups: description: The number of detected threats targeting the zone {{$labels.zone}} is {{ printf "%.0f" $value }} which is greater than the threshold of 3. summary: There are detected threats targeting the zone. expr: | - sum without (instance) (increase(cloudflare_zone_threats_total[5m])) > 3 + sum without (instance) (increase(cloudflare_zone_threats_total{job="integrations/cloudflare"}[5m])) > 3 for: 5m labels: severity: critical @@ -15,7 +15,7 @@ groups: description: The rate of requests to {{$labels.zone}} is {{ printf "%.0f" $value }}% of the prior 50 minute baseline which is above the threshold of 150%. summary: A high spike in requests is occurring which may indicate an attack or unexpected load. expr: | - sum without (instance) (100 * (rate(cloudflare_zone_requests_total[10m]) / clamp_min(rate(cloudflare_zone_requests_total[50m] offset 10m), 1))) > 150 + sum without (instance) (100 * (rate(cloudflare_zone_requests_total{job="integrations/cloudflare"}[10m]) / clamp_min(rate(cloudflare_zone_requests_total{job="integrations/cloudflare"}[50m] offset 10m), 1))) > 150 for: 5m labels: severity: warning @@ -24,7 +24,7 @@ groups: description: The number of {{$labels.status}} HTTP status codes occurring in the zone {{$labels.zone}} is {{ printf "%.0f" $value }} which is greater than the threshold of 100. summary: A high number of 4xx or 5xx HTTP status codes are occurring. expr: | - sum without (instance) (increase(cloudflare_zone_requests_status{status=~"4.*|5.*"}[5m])) > 100 + sum without (instance) (increase(cloudflare_zone_requests_status{job="integrations/cloudflare",status=~"4.*|5.*"}[5m])) > 100 for: 5m labels: severity: warning @@ -33,7 +33,7 @@ groups: description: The pool {{$labels.pool_name}} in zone {{$labels.zone}} is currently down and unhealthy. summary: There are unhealthy pools. expr: | - sum without (instance, load_balancer_name) (cloudflare_zone_pool_health_status) == 0 + sum without (instance, load_balancer_name) (cloudflare_zone_pool_health_status{job="integrations/cloudflare"}) == 0 for: 5m labels: severity: critical diff --git a/cloudflare-mixin/signals/zone.libsonnet b/cloudflare-mixin/signals/zone.libsonnet index 34478b821..7a35d429f 100644 --- a/cloudflare-mixin/signals/zone.libsonnet +++ b/cloudflare-mixin/signals/zone.libsonnet @@ -33,7 +33,7 @@ function(this) unit: 'percent', sources: { prometheus: { - expr: 'increase(cloudflare_zone_requests_cached{%(queriesSelector)s}[$__interval:]) / increase(cloudflare_zone_requests_total{%(queriesSelector)s}[$__interval:])', + expr: 'increase(cloudflare_zone_requests_cached{%(queriesSelector)s}[$__interval:] offset -$__interval) / increase(cloudflare_zone_requests_total{%(queriesSelector)s}[$__interval:] offset -$__interval)', legendCustomTemplate: '{{ zone }}', }, }, From 0b6c793a542cf9bf1f33e454df14ab3f513eb05a Mon Sep 17 00:00:00 2001 From: schmikei Date: Thu, 11 Dec 2025 10:52:25 -0500 Subject: [PATCH 5/8] make fmt --- cloudflare-mixin/links.libsonnet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudflare-mixin/links.libsonnet b/cloudflare-mixin/links.libsonnet index 509717c63..8021142ab 100644 --- a/cloudflare-mixin/links.libsonnet +++ b/cloudflare-mixin/links.libsonnet @@ -15,7 +15,7 @@ local g = import './g.libsonnet'; link.link.new('Geographic overview', '/d/' + this.grafana.dashboards['cloudflare-geomap-overview.json'].uid) + link.link.options.withKeepTime(true) + link.link.options.withIncludeVars(true), - + otherDashboards: link.dashboards.new('All dashboards', this.config.dashboardTags) + link.dashboards.options.withIncludeVars(true) From f9519e5ffc4d91699e01c2bad7b7bf5eb7968505 Mon Sep 17 00:00:00 2001 From: Greg Pattison Date: Thu, 11 Dec 2025 16:16:00 -0500 Subject: [PATCH 6/8] Complete cloudflare-mixin panel modernization - Modernize geoMetricByCountryGeomapPanel with full geomap configuration - Added transformations (groupBy, organize) - Configured geomap layers, basemap, controls, and view - Set color mode to continuous-BlPu - Increased panel height from 12 to 24 for better visibility - Modernize geoMetricsByCountryTablePanel - Use shared geoTransformations for DRY code - Added field overrides for gauge visualization on Total/Mean/Last - Configured sort by Total column descending - Modernize poolStatusPanel - Added joinByField and organize transformations - Configured Health column with color-coded mappings (green=Healthy, red=Unhealthy) - Set proper field ordering and renaming - Configuration improvements - Added shared geoTransformations helper to eliminate duplication - Set interval to 2m with intervalFactor 2 for geographic panels - Use standard withTargets approach instead of asTable() for consistency --- cloudflare-mixin/config.libsonnet | 2 +- cloudflare-mixin/dashboards.libsonnet | 2 +- .../cloudflare-geomap-overview.json | 255 ++++++++++++++++- .../cloudflare-worker-overview.json | 4 +- .../cloudflare-zone-overview.json | 114 +++++++- cloudflare-mixin/panels.libsonnet | 258 +++++++++++++++++- cloudflare-mixin/signals/geomap.libsonnet | 13 - 7 files changed, 607 insertions(+), 41 deletions(-) diff --git a/cloudflare-mixin/config.libsonnet b/cloudflare-mixin/config.libsonnet index 2d504617f..a9c5b6e09 100644 --- a/cloudflare-mixin/config.libsonnet +++ b/cloudflare-mixin/config.libsonnet @@ -5,7 +5,7 @@ groupLabels: ['job', 'cluster', 'zone', 'script_name'], instanceLabels: ['instance'], - dashboardTags: [self.uid], + dashboardTags: [self.uid + '-mixin'], legendLabels: ['instance'], uid: 'cloudflare', dashboardNamePrefix: 'Cloudflare', diff --git a/cloudflare-mixin/dashboards.libsonnet b/cloudflare-mixin/dashboards.libsonnet index 831a10b25..895486dd3 100644 --- a/cloudflare-mixin/dashboards.libsonnet +++ b/cloudflare-mixin/dashboards.libsonnet @@ -64,7 +64,7 @@ local g = import './g.libsonnet'; g.util.grid.wrapPanels( [ this.grafana.panels.geoMetricsByCountryTablePanel + g.panel.table.gridPos.withW(24) + g.panel.table.gridPos.withH(7), - this.grafana.panels.geoMetricByCountryGeomapPanel + g.panel.geomap.gridPos.withW(24) + g.panel.geomap.gridPos.withH(12), + this.grafana.panels.geoMetricByCountryGeomapPanel + g.panel.geomap.gridPos.withW(24) + g.panel.geomap.gridPos.withH(24), ] ) ) diff --git a/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json b/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json index 621cc83a8..df5dc57ae 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json @@ -29,7 +29,7 @@ "includeVars": true, "keepTime": true, "tags": [ - "cloudflare" + "cloudflare-mixin" ], "title": "All dashboards", "type": "dashboards" @@ -42,6 +42,32 @@ "uid": "-- Mixed --" }, "description": "Table currently showing $geo_metric for the zone.", + "fieldConfig": { + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": "/Total|Mean|Last/" + }, + "properties": [ + { + "id": "custom.cellOptions", + "value": { + "mode": "basic", + "type": "gauge", + "valueDisplayMode": "text" + } + }, + { + "id": "color", + "value": { + "mode": "continuous-BlPu" + } + } + ] + } + ] + }, "gridPos": { "h": 7, "w": 24, @@ -49,6 +75,14 @@ "y": 0 }, "id": 1, + "options": { + "sortBy": [ + { + "desc": true, + "displayName": "Total" + } + ] + }, "pluginVersion": "v11.4.0", "targets": [ { @@ -59,11 +93,74 @@ "expr": "increase(${geo_metric}{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "table", "instant": false, + "interval": "2m", + "intervalFactor": 2, "legendFormat": "", "refId": "$geo_metric Distribution" } ], "title": "Geographic distribution", + "transformations": [ + { + "id": "groupBy", + "options": { + "fields": { + "Value": { + "aggregations": [ + "sum", + "mean", + "lastNotNull" + ], + "operation": "aggregate" + }, + "country": { + "aggregations": [ ], + "operation": "groupby" + }, + "host": { + "aggregations": [ ] + }, + "instance": { + "aggregations": [ ], + "operation": "groupby" + }, + "job": { + "aggregations": [ ], + "operation": "groupby" + }, + "region": { + "aggregations": [ ], + "operation": "groupby" + }, + "status": { + "aggregations": [ ], + "operation": "groupby" + }, + "zone": { + "aggregations": [ ] + } + } + } + }, + { + "id": "organize", + "options": { + "excludeByName": { }, + "indexByName": { }, + "renameByName": { + "Value (lastNotNull)": "Last", + "Value (mean)": "Mean", + "Value (sum)": "Total", + "country": "Country", + "instance": "Instance", + "job": "Job", + "region": "Region", + "status": "Status", + "zone": "Zone" + } + } + } + ], "type": "table" }, { @@ -72,13 +169,94 @@ "uid": "-- Mixed --" }, "description": "Geomap panel currently showing $geo_metric for the zone.", + "fieldConfig": { + "defaults": { + "color": { + "mode": "continuous-BlPu" + } + } + }, "gridPos": { - "h": 12, + "h": 24, "w": 24, "x": 0, - "y": 12 + "y": 24 }, "id": 2, + "options": { + "basemap": { + "config": { }, + "name": "Layer 0", + "type": "default" + }, + "controls": { + "mouseWheelZoom": true, + "showAttribution": true, + "showDebug": false, + "showMeasure": false, + "showScale": false, + "showZoom": true + }, + "layers": [ + { + "config": { + "showLegend": true, + "style": { + "color": { + "field": "Total", + "fixed": "dark-green" + }, + "opacity": 0.40000000000000002, + "rotation": { + "fixed": 0, + "max": 360, + "min": -360, + "mode": "mod" + }, + "size": { + "field": "Total", + "fixed": 5, + "max": 15, + "min": 7 + }, + "symbol": { + "fixed": "img/icons/marker/circle.svg", + "mode": "fixed" + }, + "symbolAlign": { + "horizontal": "center", + "vertical": "center" + }, + "textConfig": { + "fontSize": 12, + "offsetX": 0, + "offsetY": 0, + "textAlign": "center", + "textBaseline": "middle" + } + } + }, + "location": { + "gazetteer": "public/gazetteer/countries.json", + "lookup": "country", + "mode": "lookup" + }, + "name": "Total", + "tooltip": true, + "type": "markers" + } + ], + "tooltip": { + "mode": "multi" + }, + "view": { + "allLayers": true, + "id": "zero", + "lat": 0, + "lon": 0, + "zoom": 1 + } + }, "pluginVersion": "v11.4.0", "targets": [ { @@ -87,21 +265,84 @@ "uid": "${datasource}" }, "expr": "increase(${geo_metric}{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", - "format": "time_series", + "format": "table", + "expr": "increase(${geo_metric}{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "instant": false, - "interval": "1m", + "interval": "2m", + "intervalFactor": 2, "legendFormat": "", "refId": "$geo_metric Distribution" } ], "title": "Geographic distribution", + "transformations": [ + { + "id": "groupBy", + "options": { + "fields": { + "Value": { + "aggregations": [ + "sum", + "mean", + "lastNotNull" + ], + "operation": "aggregate" + }, + "country": { + "aggregations": [ ], + "operation": "groupby" + }, + "host": { + "aggregations": [ ] + }, + "instance": { + "aggregations": [ ], + "operation": "groupby" + }, + "job": { + "aggregations": [ ], + "operation": "groupby" + }, + "region": { + "aggregations": [ ], + "operation": "groupby" + }, + "status": { + "aggregations": [ ], + "operation": "groupby" + }, + "zone": { + "aggregations": [ ] + } + } + } + }, + { + "id": "organize", + "options": { + "excludeByName": { }, + "indexByName": { }, + "renameByName": { + "Value (lastNotNull)": "Last", + "Value (mean)": "Mean", + "Value (sum)": "Total", + "country": "Country", + "instance": "Instance", + "job": "Job", + "region": "Region", + "status": "Status", + "zone": "Zone" + } + } + } + ], "type": "geomap" } ], "refresh": "1m", "schemaVersion": 39, "tags": [ - "cloudflare" + "cloudflare-mixin" ], "templating": { "list": [ @@ -226,4 +467,4 @@ "timezone": "default", "title": "Cloudflare geomap overview", "uid": "cloudflare_cloudflare_geomap_overview" - } \ No newline at end of file + } diff --git a/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json b/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json index c5a849cb8..02e70e9df 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json @@ -29,7 +29,7 @@ "includeVars": true, "keepTime": true, "tags": [ - "cloudflare" + "cloudflare-mixin" ], "title": "All dashboards", "type": "dashboards" @@ -265,7 +265,7 @@ "refresh": "1m", "schemaVersion": 39, "tags": [ - "cloudflare" + "cloudflare-mixin" ], "templating": { "list": [ diff --git a/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json b/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json index a1c7981b8..e378131db 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json @@ -29,7 +29,7 @@ "includeVars": true, "keepTime": true, "tags": [ - "cloudflare" + "cloudflare-mixin" ], "title": "All dashboards", "type": "dashboards" @@ -83,10 +83,62 @@ }, { "datasource": { - "type": "prometheus", - "uid": "${datasource}" + "type": "datasource", + "uid": "-- Mixed --" }, "description": "A table view of the pools in your zone showing their health and rate of requests.", + "fieldConfig": { + "defaults": { + "mappings": [ + { + "options": { + "Health=1": { + "index": 0, + "text": "Healthy" + } + }, + "type": "value" + } + ], + "unit": "reqps" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Health" + }, + "properties": [ + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + }, + { + "id": "mappings", + "value": [ + { + "options": { + "0": { + "color": "red", + "index": 1, + "text": "Unhealthy" + }, + "1": { + "color": "green", + "index": 0, + "text": "Healthy" + } + }, + "type": "value" + } + ] + } + ] + } + ] + }, "gridPos": { "h": 8, "w": 12, @@ -94,7 +146,7 @@ "y": 1 }, "id": 3, - "pluginVersion": "v11.0.0", + "pluginVersion": "v11.4.0", "targets": [ { "datasource": { @@ -104,7 +156,8 @@ "expr": "cloudflare_zone_pool_health_status{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}", "format": "table", "instant": false, - "legendFormat": "{{ pool_name }}", + "intervalFactor": 2, + "legendFormat": "", "refId": "Pool status" }, { @@ -115,11 +168,58 @@ "expr": "rate(cloudflare_zone_pool_requests_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "table", "instant": false, - "legendFormat": "{{ pool_name }}", + "intervalFactor": 2, + "legendFormat": "", "refId": "Request rate" } ], "title": "Pool status", + "transformations": [ + { + "id": "joinByField", + "options": { + "byField": "pool_name", + "mode": "outer" + } + }, + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "pool_name", + "Value #A", + "load_balancer_name 2", + "origin_name", + "Value #B", + "zone 2" + ] + } + } + }, + { + "id": "organize", + "options": { + "excludeByName": { }, + "indexByName": { + "Value #A": 5, + "Value #B": 4, + "load_balancer_name 2": 1, + "origin_name": 2, + "pool_name": 0, + "zone 2": 3 + }, + "renameByName": { + "Value #A": "Health", + "Value #B": "Requests", + "load_balancer_name 2": "Load balancer", + "origin_name": "Origin", + "pool_name": "Pool", + "zone 2": "Zone" + } + } + } + ], "type": "table" }, { @@ -695,7 +795,7 @@ "refresh": "1m", "schemaVersion": 39, "tags": [ - "cloudflare" + "cloudflare-mixin" ], "templating": { "list": [ diff --git a/cloudflare-mixin/panels.libsonnet b/cloudflare-mixin/panels.libsonnet index 3c6057af7..6e7549aef 100644 --- a/cloudflare-mixin/panels.libsonnet +++ b/cloudflare-mixin/panels.libsonnet @@ -7,6 +7,65 @@ local utils = commonlib.utils; { local signals = this.signals, + // Shared transformations for geomap panels + local geoTransformations = [ + { + id: 'groupBy', + options: { + fields: { + Value: { + aggregations: ['sum', 'mean', 'lastNotNull'], + operation: 'aggregate', + }, + country: { + aggregations: [], + operation: 'groupby', + }, + host: { + aggregations: [], + }, + instance: { + aggregations: [], + operation: 'groupby', + }, + job: { + aggregations: [], + operation: 'groupby', + }, + region: { + aggregations: [], + operation: 'groupby', + }, + status: { + aggregations: [], + operation: 'groupby', + }, + zone: { + aggregations: [], + }, + }, + }, + }, + { + id: 'organize', + options: { + excludeByName: {}, + indexByName: {}, + renameByName: { + 'Value (lastNotNull)': 'Last', + 'Value (mean)': 'Mean', + 'Value (sum)': 'Total', + country: 'Country', + instance: 'Instance', + job: 'Job', + region: 'Region', + status: 'Status', + zone: 'Zone', + }, + }, + }, + ], + // Zone panels alertsPanel: { @@ -150,14 +209,105 @@ local utils = commonlib.utils; // Pool panels poolStatusPanel: - commonlib.panels.generic.table.base.new( - 'Pool status', - targets=[ - signals.pool.poolStatus.asTarget() { format: 'table' }, - signals.pool.requests.asTarget() { format: 'table' }, - ], - description='A table view of the pools in your zone showing their health and rate of requests.' - ), + g.panel.table.new('Pool status') + + g.panel.table.panelOptions.withDescription('A table view of the pools in your zone showing their health and rate of requests.') + + g.panel.table.queryOptions.withTargets([ + signals.pool.poolStatus.asTarget() + + g.query.prometheus.withFormat('table') + + g.query.prometheus.withIntervalFactor(2) + + g.query.prometheus.withLegendFormat(''), + signals.pool.requests.asTarget() + + g.query.prometheus.withFormat('table') + + g.query.prometheus.withIntervalFactor(2) + + g.query.prometheus.withLegendFormat(''), + ]) + + g.panel.table.standardOptions.withUnit('reqps') + + g.panel.table.standardOptions.withMappings([ + { + type: 'value', + options: { + 'Health=1': { + index: 0, + text: 'Healthy', + }, + }, + }, + ]) + + g.panel.table.queryOptions.withTransformations([ + { + id: 'joinByField', + options: { + byField: 'pool_name', + mode: 'outer', + }, + }, + { + id: 'filterFieldsByName', + options: { + include: { + names: [ + 'pool_name', + 'Value #A', + 'load_balancer_name 2', + 'origin_name', + 'Value #B', + 'zone 2', + ], + }, + }, + }, + { + id: 'organize', + options: { + excludeByName: {}, + indexByName: { + pool_name: 0, + 'load_balancer_name 2': 1, + origin_name: 2, + 'zone 2': 3, + 'Value #B': 4, + 'Value #A': 5, + }, + renameByName: { + pool_name: 'Pool', + 'load_balancer_name 2': 'Load balancer', + origin_name: 'Origin', + 'zone 2': 'Zone', + 'Value #B': 'Requests', + 'Value #A': 'Health', + }, + }, + }, + ]) + + g.panel.table.standardOptions.withOverrides([ + g.panel.table.fieldOverride.byName.new('Health') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.cellOptions', + { + type: 'color-text', + } + ) + + g.panel.table.fieldOverride.byName.withProperty( + 'mappings', + [ + { + type: 'value', + options: { + '0': { + color: 'red', + index: 1, + text: 'Unhealthy', + }, + '1': { + color: 'green', + index: 0, + text: 'Healthy', + }, + }, + }, + ] + ), + ]), poolRequestsPanel: commonlib.panels.generic.timeSeries.base.new( @@ -209,16 +359,104 @@ local utils = commonlib.utils; g.panel.geomap.new('Geographic distribution') + g.panel.geomap.panelOptions.withDescription('Geomap panel currently showing $geo_metric for the zone.') + g.panel.geomap.queryOptions.withTargets([ - signals.geomap.geoMapByCountry.asTarget() { interval: '1m' } + signals.geomap.geoMapByCountry.asTarget() + + g.query.prometheus.withFormat('table') + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2) + g.query.prometheus.withLegendFormat(''), + ]) + + g.panel.geomap.standardOptions.color.withMode('continuous-BlPu') + + g.panel.geomap.queryOptions.withTransformations(geoTransformations) + + g.panel.geomap.options.withBasemap({ type: 'default', name: 'Layer 0', config: {} }) + + g.panel.geomap.options.withView({ id: 'zero', lat: 0, lon: 0, zoom: 1, allLayers: true }) + + g.panel.geomap.options.withTooltip({ mode: 'multi' }) + + g.panel.geomap.options.withControls({ + mouseWheelZoom: true, + showAttribution: true, + showDebug: false, + showMeasure: false, + showScale: false, + showZoom: true, + }) + + g.panel.geomap.options.withLayers([ + { + type: 'markers', + name: 'Total', + tooltip: true, + location: { + mode: 'lookup', + lookup: 'country', + gazetteer: 'public/gazetteer/countries.json', + }, + config: { + showLegend: true, + style: { + color: { + field: 'Total', + fixed: 'dark-green', + }, + opacity: 0.4, + size: { + field: 'Total', + fixed: 5, + min: 7, + max: 15, + }, + symbol: { + mode: 'fixed', + fixed: 'img/icons/marker/circle.svg', + }, + symbolAlign: { + horizontal: 'center', + vertical: 'center', + }, + rotation: { + mode: 'mod', + fixed: 0, + min: -360, + max: 360, + }, + textConfig: { + fontSize: 12, + offsetX: 0, + offsetY: 0, + textAlign: 'center', + textBaseline: 'middle', + }, + }, + }, + }, ]), geoMetricsByCountryTablePanel: g.panel.table.new('Geographic distribution') + g.panel.table.panelOptions.withDescription('Table currently showing $geo_metric for the zone.') + g.panel.table.queryOptions.withTargets([ - signals.geomap.geoMetricsByCountryTable.asTarget() + signals.geomap.geoMapByCountry.asTarget() + g.query.prometheus.withFormat('table') + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2) + g.query.prometheus.withLegendFormat(''), + ]) + + g.panel.table.queryOptions.withTransformations(geoTransformations) + + g.panel.table.standardOptions.withOverrides([ + g.panel.table.fieldOverride.byRegexp.new('/Total|Mean|Last/') + + g.panel.table.fieldOverride.byRegexp.withProperty( + 'custom.cellOptions', + { + mode: 'basic', + type: 'gauge', + valueDisplayMode: 'text', + } + ) + + g.panel.table.fieldOverride.byRegexp.withProperty( + 'color', + { + mode: 'continuous-BlPu', + } + ), + ]) + + g.panel.table.options.withSortBy([ + { desc: true, displayName: 'Total' }, ]), }, } diff --git a/cloudflare-mixin/signals/geomap.libsonnet b/cloudflare-mixin/signals/geomap.libsonnet index 96f461357..7988967d7 100644 --- a/cloudflare-mixin/signals/geomap.libsonnet +++ b/cloudflare-mixin/signals/geomap.libsonnet @@ -22,18 +22,5 @@ function(this) { }, }, }, - geoMetricsByCountryTable: { - name: '$geo_metric Distribution', - nameShort: 'Distribution', - type: 'counter', - description: 'Distribution of the selected metric by country.', - unit: 'short', - sources: { - prometheus: { - expr: '${geo_metric}{%(queriesSelector)s}', - rangeFunction: 'increase', - }, - }, - }, }, } From a1f4b256f101e7a12273b5c4c6935b967a2ab9bf Mon Sep 17 00:00:00 2001 From: Greg Pattison Date: Fri, 12 Dec 2025 09:52:23 -0500 Subject: [PATCH 7/8] Updated panels and signals to match legacy dashboards where appropriate --- .../cloudflare-geomap-overview.json | 6 +- .../cloudflare-worker-overview.json | 12 +- .../cloudflare-zone-overview.json | 144 +++++++++++--- cloudflare-mixin/panels.libsonnet | 175 ++++++++++++++---- cloudflare-mixin/signals/worker.libsonnet | 6 +- cloudflare-mixin/signals/zone.libsonnet | 33 ++-- 6 files changed, 295 insertions(+), 81 deletions(-) diff --git a/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json b/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json index df5dc57ae..7bdc40b7a 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json @@ -38,8 +38,8 @@ "panels": [ { "datasource": { - "type": "datasource", - "uid": "-- Mixed --" + "type": "prometheus", + "uid": "${datasource}" }, "description": "Table currently showing $geo_metric for the zone.", "fieldConfig": { @@ -83,7 +83,7 @@ } ] }, - "pluginVersion": "v11.4.0", + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { diff --git a/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json b/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json index 02e70e9df..b43cee469 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json @@ -65,7 +65,7 @@ "showPoints": "never", "spanNulls": false }, - "unit": "s" + "unit": "ms" } }, "gridPos": { @@ -78,7 +78,8 @@ "options": { "legend": { "calcs": [ ], - "displayMode": "list" + "displayMode": "list", + "placement": "right" }, "tooltip": { "mode": "multi", @@ -131,7 +132,8 @@ "options": { "legend": { "calcs": [ ], - "displayMode": "list" + "displayMode": "list", + "placement": "right" }, "tooltip": { "mode": "multi", @@ -254,11 +256,13 @@ "expr": "increase(cloudflare_worker_errors_count{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, + "interval": "1m", + "intervalFactor": 2, "legendFormat": "{{ script_name }}", "refId": "Worker errors" } ], - "title": "Worker errors", + "title": "Worker errors / $__interval", "type": "timeseries" } ], diff --git a/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json b/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json index e378131db..0b74774f1 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json @@ -83,8 +83,8 @@ }, { "datasource": { - "type": "datasource", - "uid": "-- Mixed --" + "type": "prometheus", + "uid": "${datasource}" }, "description": "A table view of the pools in your zone showing their health and rate of requests.", "fieldConfig": { @@ -136,6 +136,18 @@ ] } ] + }, + { + "matcher": { + "id": "byName", + "options": "Requests" + }, + "properties": [ + { + "id": "decimals", + "value": 4 + } + ] } ] }, @@ -146,7 +158,7 @@ "y": 1 }, "id": 3, - "pluginVersion": "v11.4.0", + "pluginVersion": "v11.0.0", "targets": [ { "datasource": { @@ -158,7 +170,7 @@ "instant": false, "intervalFactor": 2, "legendFormat": "", - "refId": "Pool status" + "refId": "A" }, { "datasource": { @@ -170,7 +182,7 @@ "instant": false, "intervalFactor": 2, "legendFormat": "", - "refId": "Request rate" + "refId": "B" } ], "title": "Pool status", @@ -343,6 +355,8 @@ "expr": "increase(cloudflare_zone_requests_cached{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval) / increase(cloudflare_zone_requests_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, + "interval": "1m", + "intervalFactor": 2, "legendFormat": "{{ zone }}", "refId": "Zone cached requests" } @@ -393,9 +407,11 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_threats_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "increase(cloudflare_zone_threats_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, + "interval": "1m", + "intervalFactor": 2, "legendFormat": "{{ zone }}", "refId": "Zone threats" } @@ -500,10 +516,12 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_bandwidth_ssl_encrypted{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "increase(cloudflare_zone_bandwidth_ssl_encrypted{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, - "legendFormat": "{{ zone }}", + "interval": "1m", + "intervalFactor": 2, + "legendFormat": "{{zone}} - SSL encrypted", "refId": "Zone SSL encrypted bandwidth" }, { @@ -511,10 +529,12 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_bandwidth_cached{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "increase(cloudflare_zone_bandwidth_cached{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, - "legendFormat": "{{ zone }}", + "interval": "1m", + "intervalFactor": 2, + "legendFormat": "{{zone}} - Cached", "refId": "Zone cached bandwidth" } ], @@ -565,9 +585,11 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_bandwidth_content_type{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "increase(cloudflare_zone_bandwidth_content_type{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, + "interval": "1m", + "intervalFactor": 2, "legendFormat": "{{ content_type }}", "refId": "Zone bandwidth by content type" } @@ -618,10 +640,12 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_requests_browser_map_page_views_count{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "increase(cloudflare_zone_requests_browser_map_page_views_count{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, - "legendFormat": "{{ zone }}", + "interval": "1m", + "intervalFactor": 2, + "legendFormat": "{{zone}} - {{family}}", "refId": "Zone browser map pageviews" } ], @@ -674,10 +698,12 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_uniques_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "increase(cloudflare_zone_uniques_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, - "legendFormat": "{{ zone }}", + "interval": "1m", + "intervalFactor": 2, + "legendFormat": "{{zone}} - unique", "refId": "Zone unique visitors" }, { @@ -685,10 +711,12 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "cloudflare_zone_pageviews_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"} - cloudflare_zone_uniques_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}", + "expr": "increase(cloudflare_zone_pageviews_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval) - increase(cloudflare_zone_uniques_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, - "legendFormat": "{{ zone }}", + "interval": "1m", + "intervalFactor": 2, + "legendFormat": "{{zone}} - non-unique", "refId": "Zone repeat visitors" } ], @@ -746,10 +774,12 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_requests_status{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", + "expr": "increase(cloudflare_zone_requests_status{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, - "legendFormat": "{{ status }}", + "interval": "1m", + "intervalFactor": 2, + "legendFormat": "{{zone}} - {{status}}", "refId": "Zone requests by status" } ], @@ -764,6 +794,13 @@ "description": "The different colocations being used by the zone and their request rates.", "fieldConfig": { "defaults": { + "custom": { + "align": "left", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, "unit": "reqps" } }, @@ -774,6 +811,26 @@ "y": 49 }, "id": 13, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": [ + "" + ], + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true, + "sortBy": [ + { + "desc": true, + "displayName": "Requests" + } + ] + }, "pluginVersion": "v11.0.0", "targets": [ { @@ -784,11 +841,56 @@ "expr": "rate(cloudflare_zone_colocation_requests_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__rate_interval])", "format": "time_series", "instant": false, - "legendFormat": "{{ colo_code }}", + "intervalFactor": 2, + "legendFormat": "", "refId": "Zone colocation requests" } ], "title": "Colocation requests", + "transformations": [ + { + "id": "reduce", + "options": { + "reducers": [ + "lastNotNull" + ] + } + }, + { + "id": "extractFields", + "options": { + "format": "auto", + "source": "Field" + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Field": true, + "cluster": true, + "host": true, + "instance": true, + "job": true, + "script_name": true + }, + "indexByName": { + "Field": 3, + "Last *": 2, + "colocation": 1, + "host": 4, + "instance": 5, + "job": 6, + "zone": 0 + }, + "renameByName": { + "Last *": "Requests", + "colocation": "Colocation", + "zone": "Zone" + } + } + } + ], "type": "table" } ], @@ -920,4 +1022,4 @@ "timezone": "default", "title": "Cloudflare zone overview", "uid": "cloudflare_cloudflare_zone_overview" - } \ No newline at end of file + } diff --git a/cloudflare-mixin/panels.libsonnet b/cloudflare-mixin/panels.libsonnet index 6e7549aef..417036635 100644 --- a/cloudflare-mixin/panels.libsonnet +++ b/cloudflare-mixin/panels.libsonnet @@ -106,7 +106,11 @@ local utils = commonlib.utils; cachedRequestsPanel: commonlib.panels.generic.timeSeries.base.new( 'Cached requests / $__interval', - targets=[signals.zone.requestsCached.asTarget()], + targets=[ + signals.zone.requestsCached.asTarget() + + g.query.prometheus.withInterval('1m') + + g.query.prometheus.withIntervalFactor(2), + ], description='The percentage of requests to the zone that are cached.' ) + g.panel.timeSeries.standardOptions.withUnit('percentunit') @@ -124,7 +128,11 @@ local utils = commonlib.utils; threatsPanel: commonlib.panels.generic.timeSeries.base.new( 'Threats / $__interval', - targets=[signals.zone.threatsTotal.asTarget()], + targets=[ + signals.zone.threatsTotal.asTarget() + + g.query.prometheus.withInterval('1m') + + g.query.prometheus.withIntervalFactor(2), + ], description='The number of threats that have targeted the zone.' ) + g.panel.timeSeries.standardOptions.withUnit('none') @@ -144,8 +152,12 @@ local utils = commonlib.utils; commonlib.panels.generic.timeSeries.base.new( 'Bandwidth type / $__interval', targets=[ - signals.zone.bandwidthSslEncrypted.asTarget(), - signals.zone.bandwidthCached.asTarget(), + signals.zone.bandwidthSslEncrypted.asTarget() + + g.query.prometheus.withInterval('1m') + + g.query.prometheus.withIntervalFactor(2), + signals.zone.bandwidthCached.asTarget() + + g.query.prometheus.withInterval('1m') + + g.query.prometheus.withIntervalFactor(2), ], description='The amount of cached and encrypted bandwidth that occurs in the zone.' ) @@ -156,7 +168,11 @@ local utils = commonlib.utils; bandwidthContentTypePanel: commonlib.panels.generic.timeSeries.base.new( 'Bandwidth content type / $__interval', - targets=[signals.zone.bandwidthContentType.asTarget()], + targets=[ + signals.zone.bandwidthContentType.asTarget() + + g.query.prometheus.withInterval('1m') + + g.query.prometheus.withIntervalFactor(2), + ], description='The content types that bandwidth is being used for in the zone.' ) + g.panel.timeSeries.standardOptions.withUnit('bytes') @@ -168,8 +184,12 @@ local utils = commonlib.utils; commonlib.panels.generic.timeSeries.base.new( 'Unique page views / $__interval', targets=[ - signals.zone.uniquesTotal.asTarget(), - signals.zone.repeatVisitors.asTarget(), + signals.zone.uniquesTotal.asTarget() + + g.query.prometheus.withInterval('1m') + + g.query.prometheus.withIntervalFactor(2), + signals.zone.repeatVisitors.asTarget() + + g.query.prometheus.withInterval('1m') + + g.query.prometheus.withIntervalFactor(2), ], description='The number of unique and total page views.' ) @@ -180,7 +200,11 @@ local utils = commonlib.utils; requestsStatusPanel: commonlib.panels.generic.timeSeries.base.new( 'Request HTTP status / $__interval', - targets=[signals.zone.requestsStatus.asTarget()], + targets=[ + signals.zone.requestsStatus.asTarget() + + g.query.prometheus.withInterval('1m') + + g.query.prometheus.withIntervalFactor(2), + ], description='The number of different HTTP status codes used for requests in the zone.' ) + g.panel.timeSeries.standardOptions.withUnit('none') @@ -193,7 +217,11 @@ local utils = commonlib.utils; browserMapPanel: commonlib.panels.generic.timeSeries.base.new( 'Browser page views / $__interval', - targets=[signals.zone.requestsBrowserMap.asTarget()], + targets=[ + signals.zone.requestsBrowserMap.asTarget() + + g.query.prometheus.withInterval('1m') + + g.query.prometheus.withIntervalFactor(2), + ], description='The number of zone views by browser family.' ) + g.panel.timeSeries.standardOptions.withUnit('none') @@ -202,25 +230,88 @@ local utils = commonlib.utils; colocationRequestsPanel: commonlib.panels.generic.table.base.new( 'Colocation requests', - targets=[signals.zone.colocationRequests.asTarget()], + targets=[ + signals.zone.colocationRequests.asTarget() + + g.query.prometheus.withFormat('time_series') + + g.query.prometheus.withIntervalFactor(2) + + g.query.prometheus.withLegendFormat(''), + ], description='The different colocations being used by the zone and their request rates.' ) - + g.panel.table.standardOptions.withUnit('reqps'), + + g.panel.table.standardOptions.withUnit('reqps') + + g.panel.table.fieldConfig.defaults.custom.withAlign('left') + + g.panel.table.fieldConfig.defaults.custom.withCellOptions({ type: 'auto' }) + + g.panel.table.fieldConfig.defaults.custom.withInspect(false) + + g.panel.table.queryOptions.withTransformations([ + { + id: 'reduce', + options: { + reducers: ['lastNotNull'], + }, + }, + { + id: 'extractFields', + options: { + format: 'auto', + source: 'Field', + }, + }, + { + id: 'organize', + options: { + excludeByName: { + Field: true, + cluster: true, + host: true, + instance: true, + job: true, + script_name: true, + }, + indexByName: { + Field: 3, + 'Last *': 2, + colocation: 1, + host: 4, + instance: 5, + job: 6, + zone: 0, + }, + renameByName: { + 'Last *': 'Requests', + colocation: 'Colocation', + zone: 'Zone', + }, + }, + }, + ]) + + g.panel.table.options.withCellHeight('sm') + + g.panel.table.options.footer.withCountRows(false) + + g.panel.table.options.footer.withFields('') + + g.panel.table.options.footer.withReducer(['sum']) + + g.panel.table.options.footer.withShow(false) + + g.panel.table.options.withShowHeader(true) + + g.panel.table.options.withSortBy([ + { desc: true, displayName: 'Requests' }, + ]), // Pool panels poolStatusPanel: - g.panel.table.new('Pool status') - + g.panel.table.panelOptions.withDescription('A table view of the pools in your zone showing their health and rate of requests.') - + g.panel.table.queryOptions.withTargets([ - signals.pool.poolStatus.asTarget() - + g.query.prometheus.withFormat('table') - + g.query.prometheus.withIntervalFactor(2) - + g.query.prometheus.withLegendFormat(''), - signals.pool.requests.asTarget() - + g.query.prometheus.withFormat('table') - + g.query.prometheus.withIntervalFactor(2) - + g.query.prometheus.withLegendFormat(''), - ]) + commonlib.panels.generic.table.base.new( + 'Pool status', + targets=[ + signals.pool.poolStatus.asTarget() + + g.query.prometheus.withRefId('A') + + g.query.prometheus.withFormat('table') + + g.query.prometheus.withIntervalFactor(2) + + g.query.prometheus.withLegendFormat(''), + signals.pool.requests.asTarget() + + g.query.prometheus.withRefId('B') + + g.query.prometheus.withFormat('table') + + g.query.prometheus.withIntervalFactor(2) + + g.query.prometheus.withLegendFormat(''), + ], + description='A table view of the pools in your zone showing their health and rate of requests.' + ) + g.panel.table.standardOptions.withUnit('reqps') + g.panel.table.standardOptions.withMappings([ { @@ -307,6 +398,8 @@ local utils = commonlib.utils; }, ] ), + g.panel.table.fieldOverride.byName.new('Requests') + + g.panel.table.fieldOverride.byName.withProperty('decimals', 4), ]), poolRequestsPanel: @@ -325,8 +418,9 @@ local utils = commonlib.utils; targets=[signals.worker.cpuTime.asTarget()], description='CPU time consumed by the worker.' ) - + g.panel.timeSeries.standardOptions.withUnit('s') - + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + g.panel.timeSeries.standardOptions.withUnit('ms') + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false) + + g.panel.timeSeries.options.legend.withPlacement('right'), workerDurationPanel: commonlib.panels.generic.timeSeries.base.new( @@ -335,7 +429,8 @@ local utils = commonlib.utils; description='Duration of worker execution.' ) + g.panel.timeSeries.standardOptions.withUnit('s') - + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false), + + g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false) + + g.panel.timeSeries.options.legend.withPlacement('right'), workerRequestsPanel: commonlib.panels.generic.timeSeries.base.new( @@ -348,8 +443,12 @@ local utils = commonlib.utils; workerErrorsPanel: commonlib.panels.generic.timeSeries.base.new( - 'Worker errors', - targets=[signals.worker.errorsCount.asTarget()], + 'Worker errors / $__interval', + targets=[ + signals.worker.errorsCount.asTarget() + + g.query.prometheus.withInterval('1m') + + g.query.prometheus.withIntervalFactor(2), + ], description='Number of errors from the worker.' ) + g.panel.timeSeries.standardOptions.withUnit('short') @@ -428,15 +527,17 @@ local utils = commonlib.utils; }, ]), geoMetricsByCountryTablePanel: - g.panel.table.new('Geographic distribution') - + g.panel.table.panelOptions.withDescription('Table currently showing $geo_metric for the zone.') - + g.panel.table.queryOptions.withTargets([ - signals.geomap.geoMapByCountry.asTarget() - + g.query.prometheus.withFormat('table') - + g.query.prometheus.withInterval('2m') - + g.query.prometheus.withIntervalFactor(2) - + g.query.prometheus.withLegendFormat(''), - ]) + commonlib.panels.generic.table.base.new( + 'Geographic distribution', + targets=[ + signals.geomap.geoMapByCountry.asTarget() + + g.query.prometheus.withFormat('table') + + g.query.prometheus.withInterval('2m') + + g.query.prometheus.withIntervalFactor(2) + + g.query.prometheus.withLegendFormat(''), + ], + description='Table currently showing $geo_metric for the zone.' + ) + g.panel.table.queryOptions.withTransformations(geoTransformations) + g.panel.table.standardOptions.withOverrides([ g.panel.table.fieldOverride.byRegexp.new('/Total|Mean|Last/') diff --git a/cloudflare-mixin/signals/worker.libsonnet b/cloudflare-mixin/signals/worker.libsonnet index 9e3e4c32f..5efe95f38 100644 --- a/cloudflare-mixin/signals/worker.libsonnet +++ b/cloudflare-mixin/signals/worker.libsonnet @@ -15,7 +15,7 @@ function(this) nameShort: 'CPU time', type: 'gauge', description: 'CPU time consumed by the worker.', - unit: 's', + unit: 'ms', sources: { prometheus: { expr: 'cloudflare_worker_cpu_time{%(queriesSelector)s}', @@ -40,8 +40,8 @@ function(this) name: 'Worker requests', nameShort: 'Requests', type: 'counter', - description: 'Number of requests to the worker.', - unit: '/ sec', + description: 'Rate of requests to the worker.', + unit: 'reqps', sources: { prometheus: { expr: 'cloudflare_worker_requests_count{%(queriesSelector)s}', diff --git a/cloudflare-mixin/signals/zone.libsonnet b/cloudflare-mixin/signals/zone.libsonnet index 7a35d429f..8085cd1be 100644 --- a/cloudflare-mixin/signals/zone.libsonnet +++ b/cloudflare-mixin/signals/zone.libsonnet @@ -16,8 +16,8 @@ function(this) name: 'Zone requests total', nameShort: 'Requests', type: 'counter', - description: 'Total number of requests to the zone.', - unit: '/ sec', + description: 'Rate of requests to the zone.', + unit: 'reqps', sources: { prometheus: { expr: 'cloudflare_zone_requests_total{%(queriesSelector)s}', @@ -48,6 +48,7 @@ function(this) prometheus: { expr: 'cloudflare_zone_threats_total{%(queriesSelector)s}', legendCustomTemplate: '{{ zone }}', + rangeFunction: 'increase', }, }, }, @@ -73,7 +74,8 @@ function(this) sources: { prometheus: { expr: 'cloudflare_zone_bandwidth_ssl_encrypted{%(queriesSelector)s}', - legendCustomTemplate: '{{ zone }}', + legendCustomTemplate: '{{zone}} - SSL encrypted', + rangeFunction: 'increase', }, }, }, @@ -86,7 +88,8 @@ function(this) sources: { prometheus: { expr: 'cloudflare_zone_bandwidth_cached{%(queriesSelector)s}', - legendCustomTemplate: '{{ zone }}', + legendCustomTemplate: '{{zone}} - Cached', + rangeFunction: 'increase', }, }, }, @@ -100,6 +103,7 @@ function(this) prometheus: { expr: 'cloudflare_zone_bandwidth_content_type{%(queriesSelector)s}', legendCustomTemplate: '{{ content_type }}', + rangeFunction: 'increase', }, }, }, @@ -112,7 +116,8 @@ function(this) sources: { prometheus: { expr: 'cloudflare_zone_uniques_total{%(queriesSelector)s}', - legendCustomTemplate: '{{ zone }}', + legendCustomTemplate: '{{zone}} - unique', + rangeFunction: 'increase', }, }, }, @@ -133,12 +138,12 @@ function(this) name: 'Zone repeat visitors', nameShort: 'Repeat visitors', type: 'raw', - description: 'Number of repeat visitors (pageviews - uniques).', + description: 'Rate of repeat visitors (pageviews - uniques).', unit: 'short', sources: { prometheus: { - expr: 'cloudflare_zone_pageviews_total{%(queriesSelector)s} - cloudflare_zone_uniques_total{%(queriesSelector)s}', - legendCustomTemplate: '{{ zone }}', + expr: 'increase(cloudflare_zone_pageviews_total{%(queriesSelector)s}[$__interval:] offset -$__interval) - increase(cloudflare_zone_uniques_total{%(queriesSelector)s}[$__interval:] offset -$__interval)', + legendCustomTemplate: '{{zone}} - non-unique', }, }, }, @@ -151,7 +156,8 @@ function(this) sources: { prometheus: { expr: 'cloudflare_zone_requests_status{%(queriesSelector)s}', - legendCustomTemplate: '{{ status }}', + legendCustomTemplate: '{{zone}} - {{status}}', + rangeFunction: 'increase', }, }, }, @@ -164,7 +170,8 @@ function(this) sources: { prometheus: { expr: 'cloudflare_zone_requests_browser_map_page_views_count{%(queriesSelector)s}', - legendCustomTemplate: '{{ zone }}', + legendCustomTemplate: '{{zone}} - {{family}}', + rangeFunction: 'increase', }, }, }, @@ -172,12 +179,12 @@ function(this) name: 'Zone colocation requests', nameShort: 'Colocation requests', type: 'counter', - description: 'Requests by colocation center.', - unit: '/ sec', + description: 'Rate of requests by colocation center.', + unit: 'reqps', sources: { prometheus: { expr: 'cloudflare_zone_colocation_requests_total{%(queriesSelector)s}', - legendCustomTemplate: '{{ colo_code }}', + legendCustomTemplate: '', }, }, }, From 99a68c8db253877e6f95e9040c904c7c5606124d Mon Sep 17 00:00:00 2001 From: Greg Pattison Date: Fri, 12 Dec 2025 10:11:39 -0500 Subject: [PATCH 8/8] Rebuilt dashboards after rebasing to latest --- .../cloudflare-geomap-overview.json | 3 +-- .../cloudflare-zone-overview.json | 18 +++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json b/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json index 7bdc40b7a..4bd732509 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json @@ -266,7 +266,6 @@ }, "expr": "increase(${geo_metric}{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "table", - "expr": "increase(${geo_metric}{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "instant": false, "interval": "2m", "intervalFactor": 2, @@ -467,4 +466,4 @@ "timezone": "default", "title": "Cloudflare geomap overview", "uid": "cloudflare_cloudflare_geomap_overview" - } + } \ No newline at end of file diff --git a/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json b/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json index 0b74774f1..0c5317faf 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json @@ -407,7 +407,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "increase(cloudflare_zone_threats_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", + "expr": "increase(cloudflare_zone_threats_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, "interval": "1m", @@ -516,7 +516,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "increase(cloudflare_zone_bandwidth_ssl_encrypted{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", + "expr": "increase(cloudflare_zone_bandwidth_ssl_encrypted{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, "interval": "1m", @@ -529,7 +529,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "increase(cloudflare_zone_bandwidth_cached{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", + "expr": "increase(cloudflare_zone_bandwidth_cached{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, "interval": "1m", @@ -585,7 +585,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "increase(cloudflare_zone_bandwidth_content_type{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", + "expr": "increase(cloudflare_zone_bandwidth_content_type{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, "interval": "1m", @@ -640,7 +640,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "increase(cloudflare_zone_requests_browser_map_page_views_count{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", + "expr": "increase(cloudflare_zone_requests_browser_map_page_views_count{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, "interval": "1m", @@ -698,7 +698,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "increase(cloudflare_zone_uniques_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", + "expr": "increase(cloudflare_zone_uniques_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, "interval": "1m", @@ -711,7 +711,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "increase(cloudflare_zone_pageviews_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval) - increase(cloudflare_zone_uniques_total{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", + "expr": "increase(cloudflare_zone_pageviews_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval) - increase(cloudflare_zone_uniques_total{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, "interval": "1m", @@ -774,7 +774,7 @@ "type": "prometheus", "uid": "${datasource}" }, - "expr": "increase(cloudflare_zone_requests_status{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", + "expr": "increase(cloudflare_zone_requests_status{job=\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}[$__interval:] offset -$__interval)", "format": "time_series", "instant": false, "interval": "1m", @@ -1022,4 +1022,4 @@ "timezone": "default", "title": "Cloudflare zone overview", "uid": "cloudflare_cloudflare_zone_overview" - } + } \ No newline at end of file