diff --git a/cloudflare-mixin/alerts/alerts.libsonnet b/cloudflare-mixin/alerts.libsonnet similarity index 61% rename from cloudflare-mixin/alerts/alerts.libsonnet rename to cloudflare-mixin/alerts.libsonnet index cabd2d76d..d0199666e 100644 --- a/cloudflare-mixin/alerts/alerts.libsonnet +++ b/cloudflare-mixin/alerts.libsonnet @@ -1,6 +1,6 @@ { - prometheusAlerts+:: { - groups+: [ + new(this): { + groups: [ { name: 'cloudflare-alerts', rules: [ @@ -8,85 +8,70 @@ alert: 'CloudflareHighThreatCount', expr: ||| sum without (instance) (increase(cloudflare_zone_threats_total[5m])) > %(alertsHighThreatCount)s - ||| % $._config, + ||| % 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, + ||| % 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, + ||| % 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, + ||| % 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..f0c98657e 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..63aa57308 --- /dev/null +++ b/cloudflare-mixin/dashboards.libsonnet @@ -0,0 +1,91 @@ +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), + ] + ) + ) + ) + + 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..dd9fe1ad6 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-geomap-overview.json @@ -1,435 +1,217 @@ { - "__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 --" + "uid": "-- Mixed --" }, "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" - } - } - ] - } - ] - }, "gridPos": { "h": 7, "w": 24, "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, + "legendFormat": "", + "refId": "$geo_metric Distribution" } ], - "title": "$geo_metric by country", + "title": "Geographic Distribution", "type": "table" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "datasource", + "uid": "-- Mixed --" }, "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": [ ] - }, "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)", - "format": "table", + "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", - "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 +220,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..e53e47dc5 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-worker-overview.json @@ -1,115 +1,99 @@ { - "__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" - } - }, - "mappings": [ ], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - } - ] + "spanNulls": false }, - "unit": "ms" - }, - "overrides": [ ] + "unit": "s" + } }, "gridPos": { "h": 8, "w": 24, "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", @@ -117,88 +101,52 @@ }, { "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 + "y": 9 }, "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", @@ -206,88 +154,52 @@ }, { "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": 17 }, "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": 17 }, "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..e4737c63d 100644 --- a/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json +++ b/cloudflare-mixin/dashboards_out/cloudflare-zone-overview.json @@ -1,40 +1,60 @@ { - "__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}" + "uid": "prometheus" }, "gridPos": { "h": 8, "w": 12, "x": 0, - "y": 0 + "y": 1 }, "id": 2, "options": { @@ -60,255 +80,93 @@ }, { "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.", - "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" - } - ] - } - ] - } - ] - }, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 0 + "y": 1 }, "id": 3, - "options": { - "cellHeight": "sm", - "footer": { - "countRows": false, - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "frameIndex": 0, - "showHeader": true, - "sortBy": [ ] - }, - "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\"}", + "expr": "cloudflare_zone_pool_health_status{job=~\"integrations/cloudflare\",job=~\"$job\",cluster=~\"$cluster\",zone=~\"$zone\",script_name=~\"$script_name\",instance=~\"$instance\"}", "format": "table", - "intervalFactor": 2, - "legendFormat": "" + "instant": false, + "legendFormat": "{{ pool_name }}", + "refId": "Pool status" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "rate(cloudflare_zone_pool_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": "table", - "intervalFactor": 2, - "legendFormat": "" + "instant": false, + "legendFormat": "{{ pool_name }}", + "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" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, "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", + "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": 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_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": "{{zone}}" + "instant": false, + "legendFormat": "{{ zone }}", + "refId": "Zone requests total" } ], "title": "Request rate", @@ -316,47 +174,23 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, "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", + "gradientMode": "opacity", + "lineInterpolation": "smooth", "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": { @@ -377,38 +211,37 @@ ] }, "unit": "percentunit" - }, - "overrides": [ ] + } }, "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": "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", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{zone}}" + "instant": false, + "legendFormat": "{{ zone }}", + "refId": "Zone cached requests" } ], "title": "Cached requests / $__interval", @@ -416,89 +249,52 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, "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", + "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": [ ] + } }, "gridPos": { "h": 8, "w": 12, "x": 0, - "y": 16 + "y": 17 }, "id": 6, "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_threats_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 threats" } ], "title": "Threats / $__interval", @@ -506,88 +302,52 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, "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", + "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": [ ] + } }, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 16 + "y": 17 }, "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": "rate(cloudflare_zone_bandwidth_total{job=~\"$job\", instance=~\"$instance\", zone=~\"$zone\"}[$__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", - "intervalFactor": 2, - "legendFormat": "{{zone}}" + "instant": false, + "legendFormat": "{{ zone }}", + "refId": "Zone bandwidth" } ], "title": "Bandwidth rate", @@ -595,99 +355,64 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, "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", + "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": [ ] + } }, "gridPos": { "h": 8, "w": 12, "x": 0, - "y": 24 + "y": 25 }, "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": "increase(cloudflare_zone_bandwidth_ssl_encrypted{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}} - encrypted" + "instant": false, + "legendFormat": "{{ zone }}", + "refId": "Zone SSL encrypted bandwidth" }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, - "expr": "increase(cloudflare_zone_bandwidth_cached{job=~\"$job\", instance=~\"$instance\", zone=~\"$zone\"}[$__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", - "interval": "1m", - "intervalFactor": 2, - "legendFormat": "{{zone}} - cached" + "instant": false, + "legendFormat": "{{ zone }}", + "refId": "Zone cached bandwidth" } ], "title": "Bandwidth type / $__interval", @@ -695,93 +420,53 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, "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", + "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 - } - ] + "spanNulls": false }, "unit": "bytes" - }, - "overrides": [ ] + } }, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 24 + "y": 25 }, "id": 9, "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_bandwidth_content_type{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": "{{ content_type }}", + "refId": "Zone bandwidth by content type" } ], "title": "Bandwidth content type / $__interval", @@ -789,89 +474,52 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, "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", + "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": [ ] + } }, "gridPos": { "h": 8, "w": 12, "x": 0, - "y": 32 + "y": 33 }, "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_requests_browser_map_page_views_count{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}} - {{family}}" + "instant": false, + "legendFormat": "{{ zone }}", + "refId": "Zone browser map pageviews" } ], "title": "Browser page views / $__interval", @@ -879,99 +527,66 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, "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", + "gradientMode": "opacity", + "lineInterpolation": "smooth", "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": [ ] + } }, "gridPos": { "h": 8, "w": 12, "x": 12, - "y": 32 + "y": 33 }, "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_uniques_total{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}} - unique" + "instant": false, + "legendFormat": "{{ zone }}", + "refId": "Zone unique visitors" }, { "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": "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}} - non-unique" + "instant": false, + "legendFormat": "{{ zone }}", + "refId": "Zone repeat visitors" } ], "title": "Unique page views / $__interval", @@ -979,65 +594,31 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, "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", + "gradientMode": "opacity", + "lineInterpolation": "smooth", "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": [ ] + } }, "gridPos": { "h": 8, "w": 24, "x": 0, - "y": 40 + "y": 41 }, "id": 12, "options": { @@ -1048,24 +629,25 @@ "mean" ], "displayMode": "table", - "placement": "right", - "showLegend": true + "placement": "right" }, "tooltip": { "mode": "multi", "sort": "desc" } }, + "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": "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}} - {{status}}" + "instant": false, + "legendFormat": "{{ status }}", + "refId": "Zone requests by status" } ], "title": "Request HTTP status / $__interval", @@ -1073,197 +655,158 @@ }, { "datasource": { - "uid": "${prometheus_datasource}" + "type": "prometheus", + "uid": "${datasource}" }, "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": [ ] + } }, "gridPos": { "h": 8, "w": 24, "x": 0, - "y": 48 + "y": 49 }, "id": 13, - "options": { - "cellHeight": "sm", - "footer": { - "countRows": false, - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true - }, - "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_colocation_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": "{{ colo_code }}", + "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, - "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" } ], "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 +814,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..064bef035 --- /dev/null +++ b/cloudflare-mixin/panels.libsonnet @@ -0,0 +1,237 @@ +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 + + 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( + 'Request rate', + targets=[signals.zone.requestsTotal.asTarget()], + 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: + commonlib.panels.generic.timeSeries.base.new( + 'Cached requests / $__interval', + targets=[signals.zone.requestsCached.asTarget()], + 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 / $__interval', + targets=[signals.zone.threatsTotal.asTarget()], + 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: + commonlib.panels.generic.timeSeries.base.new( + 'Bandwidth rate', + targets=[signals.zone.bandwidthTotal.asTarget()], + description='The rate at which all bandwidth in the zone occurs.' + ) + + 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( + 'Bandwidth type / $__interval', + targets=[ + signals.zone.bandwidthSslEncrypted.asTarget(), + signals.zone.bandwidthCached.asTarget(), + ], + 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'), + + bandwidthContentTypePanel: + commonlib.panels.generic.timeSeries.base.new( + 'Bandwidth content type / $__interval', + targets=[signals.zone.bandwidthContentType.asTarget()], + 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'), + + uniqueVisitorsPanel: + commonlib.panels.generic.timeSeries.base.new( + 'Unique page views / $__interval', + targets=[ + signals.zone.uniquesTotal.asTarget(), + signals.zone.repeatVisitors.asTarget(), + ], + 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'), + + requestsStatusPanel: + commonlib.panels.generic.timeSeries.base.new( + 'Request HTTP status / $__interval', + targets=[signals.zone.requestsStatus.asTarget()], + 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']) + + g.panel.timeSeries.options.legend.withDisplayMode('table') + + g.panel.timeSeries.options.legend.withPlacement('right'), + + browserMapPanel: + commonlib.panels.generic.timeSeries.base.new( + 'Browser page views / $__interval', + targets=[signals.zone.requestsBrowserMap.asTarget()], + 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: + commonlib.panels.generic.table.base.new( + 'Colocation requests', + targets=[signals.zone.colocationRequests.asTarget()], + description='The different colocations being used by the zone and their request rates.' + ) + + g.panel.table.standardOptions.withUnit('reqps'), + + // 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.' + ), + + 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 quantiles', + 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 quantiles', + 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.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.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.withLegendFormat(''), + ]), + }, +} diff --git a/cloudflare-mixin/rows.libsonnet b/cloudflare-mixin/rows.libsonnet new file mode 100644 index 000000000..caa2ff02d --- /dev/null +++ b/cloudflare-mixin/rows.libsonnet @@ -0,0 +1,37 @@ +local g = import './g.libsonnet'; + +{ + new(this): { + // Zone overview main metrics + zoneOverview: + g.panel.row.new('Zone overview') + + g.panel.row.withPanels( + [ + 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), + ] + ), + + // Worker metrics + workers: + g.panel.row.new('Workers') + + g.panel.row.withPanels( + [ + 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), + ] + ), + }, +} 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 }}', + }, + }, + }, + }, + }