Skip to content

Conversation

@schmikei
Copy link
Contributor

@schmikei schmikei commented Aug 18, 2025

This pull request is similar to #1454 where we use more modular libs but now we are using them for Cloudflare.

As of submission this PR is mostly validated via git diff.

@schmikei schmikei changed the title chore: Cloudflare modernization (WIP) chore: Cloudflare modernization Aug 27, 2025
@schmikei schmikei marked this pull request as ready for review August 27, 2025 15:42
@schmikei schmikei requested a review from a team as a code owner August 27, 2025 15:42
@schmikei schmikei marked this pull request as draft August 27, 2025 15:43
@schmikei schmikei marked this pull request as ready for review November 25, 2025 21:35
Copy link
Member

@Dasomeone Dasomeone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple comments, mostly all nits or minor things!

Overall looks good, but it'd be great if we could verify it with a test environment? Even a few screenshots would be a good sanity check :)

"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:])",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This query is missing an increase offset :)

metricsSource: 'prometheus',

// CloudflareMetricsDown alert filter variable
alertsMetricsDownJobName: 'integrations/cloudflare',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit, we should probably extract this and reuse it in the filteringSelector so that both are updated dynamically in case end users change it

{
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed this is comparing 10 mins versus the previous 50m. I know that cleanly adds up to an hour, but it feels like an odd way to represent it.

),

'cloudflare-geomap-overview.json':
g.dashboard.new(prefix + ' Geomap overview')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit, sentence case

Suggested change
g.dashboard.new(prefix + ' Geomap overview')
g.dashboard.new(prefix + ' geomap overview')

+ g.panel.timeSeries.fieldConfig.defaults.custom.withSpanNulls(false),

geoMetricByCountryGeomapPanel:
g.panel.geomap.new('Geographic Distribution')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
g.panel.geomap.new('Geographic Distribution')
g.panel.geomap.new('Geographic distribution')

description='Duration of worker execution.'
)
+ g.panel.timeSeries.standardOptions.withUnit('s')
+ g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(54)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 here

description='Rate of requests to the worker.'
)
+ g.panel.timeSeries.standardOptions.withUnit('reqps')
+ g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be 10 or greater

description='Number of errors from the worker.'
)
+ g.panel.timeSeries.standardOptions.withUnit('short')
+ g.panel.timeSeries.fieldConfig.defaults.custom.withFillOpacity(0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

},
signals: {
geoMapByCountry: {
name: '$geo_metric Distribution',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm still mentally on vacation, but I don't recall seeing this used in the name before, just wanted to call out that it's a cool usage!

+ link.link.options.withKeepTime(true),
otherDashboards:
link.dashboards.new('All dashboards', this.config.dashboardTags)
+ link.dashboards.options.withIncludeVars(true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll want to add withIncludeVars(true) to each of the manual entries above as well

@Dasomeone Dasomeone self-assigned this Dec 4, 2025
Comment on lines 11 to 16
local optional_labels = {
script_name+: {
allValue: '.*',
label: 'Script',
},
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
local optional_labels = {
script_name+: {
allValue: '.*',
label: 'Script',
},
};
local optional_labels = {
cluster+: {
allValue: '.*',
},
script_name+: {
allValue: '.*',
label: 'Script',
},
zone+: {
allValue: '.*',
label: 'Zone',
},
};

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worker data coming in was missing the zone label, causing no data to show up in the worker dashboard vs. the old dashboards.

schmikei and others added 5 commits December 11, 2025 10:40
- Modernize geoMetricByCountryGeomapPanel with full geomap configuration
  - Added transformations (groupBy, organize)
  - Configured geomap layers, basemap, controls, and view
  - Set color mode to continuous-BlPu
  - Increased panel height from 12 to 24 for better visibility

- Modernize geoMetricsByCountryTablePanel
  - Use shared geoTransformations for DRY code
  - Added field overrides for gauge visualization on Total/Mean/Last
  - Configured sort by Total column descending

- Modernize poolStatusPanel
  - Added joinByField and organize transformations
  - Configured Health column with color-coded mappings (green=Healthy, red=Unhealthy)
  - Set proper field ordering and renaming

- Configuration improvements
  - Added shared geoTransformations helper to eliminate duplication
  - Set interval to 2m with intervalFactor 2 for geographic panels
  - Use standard withTargets approach instead of asTable() for consistency
@postnati
Copy link

postnati commented Dec 12, 2025

Zone Overview

cloudflare_zone_overview_1 cloudflare_zone_overview_2 cloudflare_zone_overview_3

Worker Overview

cloudflare_worker_overview

Geomap Overview

cloudflare_geomap_overview

…n-additions

Dashboard and signal updates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants