@@ -702,6 +702,25 @@ func addHTTPGroups(z *zoneResp, name string, account string) {
702702 return
703703 }
704704
705+ // Clear stale series for this zone/account
706+ label := prometheus.Labels {"zone" : name , "account" : account }
707+ zoneRequestTotal .DeletePartialMatch (label )
708+ zoneRequestCached .DeletePartialMatch (label )
709+ zoneRequestSSLEncrypted .DeletePartialMatch (label )
710+ zoneRequestContentType .DeletePartialMatch (label )
711+ zoneBandwidthContentType .DeletePartialMatch (label )
712+ zoneRequestCountry .DeletePartialMatch (label )
713+ zoneBandwidthCountry .DeletePartialMatch (label )
714+ zoneThreatsCountry .DeletePartialMatch (label )
715+ zoneRequestHTTPStatus .DeletePartialMatch (label )
716+ zoneRequestBrowserMap .DeletePartialMatch (label )
717+ zoneBandwidthTotal .DeletePartialMatch (label )
718+ zoneBandwidthCached .DeletePartialMatch (label )
719+ zoneBandwidthSSLEncrypted .DeletePartialMatch (label )
720+ zoneThreatsTotal .DeletePartialMatch (label )
721+ zonePageviewsTotal .DeletePartialMatch (label )
722+ zoneUniquesTotal .DeletePartialMatch (label )
723+
705724 zt := z .HTTP1mGroups [0 ]
706725
707726 zoneRequestTotal .With (prometheus.Labels {"zone" : name , "account" : account }).Add (float64 (zt .Sum .Requests ))
@@ -751,6 +770,11 @@ func addFirewallGroups(z *zoneResp, name string, account string) {
751770 if len (z .FirewallEventsAdaptiveGroups ) == 0 {
752771 return
753772 }
773+
774+ // Clear stale series for this zone/account
775+ label := prometheus.Labels {"zone" : name , "account" : account }
776+ zoneFirewallEventsCount .DeletePartialMatch (label )
777+
754778 rulesMap := fetchFirewallRules (z .ZoneTag )
755779 for _ , g := range z .FirewallEventsAdaptiveGroups {
756780 zoneFirewallEventsCount .With (
@@ -780,6 +804,10 @@ func addHealthCheckGroups(z *zoneResp, name string, account string) {
780804 return
781805 }
782806
807+ // Clear stale series for this zone/account
808+ label := prometheus.Labels {"zone" : name , "account" : account }
809+ zoneHealthCheckEventsOriginCount .DeletePartialMatch (label )
810+
783811 for _ , g := range z .HealthCheckEventsAdaptiveGroups {
784812 zoneHealthCheckEventsOriginCount .With (
785813 prometheus.Labels {
@@ -794,6 +822,11 @@ func addHealthCheckGroups(z *zoneResp, name string, account string) {
794822}
795823
796824func addHTTPAdaptiveGroups (z * zoneResp , name string , account string ) {
825+ // Clear stale series for this zone/account
826+ label := prometheus.Labels {"zone" : name , "account" : account }
827+ zoneRequestOriginStatusCountryHost .DeletePartialMatch (label )
828+ zoneRequestStatusCountryHost .DeletePartialMatch (label )
829+
797830 for _ , g := range z .HTTPRequestsAdaptiveGroups {
798831 zoneRequestOriginStatusCountryHost .With (
799832 prometheus.Labels {
@@ -845,6 +878,10 @@ func fetchLoadBalancerAnalytics(zones []cfzones.Zone, wg *sync.WaitGroup) {
845878}
846879
847880func addLoadBalancingRequestsAdaptiveGroups (z * lbResp , name string , account string ) {
881+ // Clear stale series for this zone/account
882+ label := prometheus.Labels {"zone" : name , "account" : account }
883+ poolRequestsTotal .DeletePartialMatch (label )
884+
848885 for _ , g := range z .LoadBalancingRequestsAdaptiveGroups {
849886 poolRequestsTotal .With (
850887 prometheus.Labels {
@@ -858,6 +895,10 @@ func addLoadBalancingRequestsAdaptiveGroups(z *lbResp, name string, account stri
858895}
859896
860897func addLoadBalancingRequestsAdaptive (z * lbResp , name string , account string ) {
898+ // Clear stale series for this zone/account
899+ label := prometheus.Labels {"zone" : name , "account" : account }
900+ poolHealthStatus .DeletePartialMatch (label )
901+
861902 for _ , g := range z .LoadBalancingRequestsAdaptive {
862903 for _ , p := range g .Pools {
863904 poolHealthStatus .With (
0 commit comments