@@ -695,6 +695,25 @@ func addHTTPGroups(z *zoneResp, name string, account string) {
695695 return
696696 }
697697
698+ // Clear stale series for this zone/account
699+ label := prometheus.Labels {"zone" : name , "account" : account }
700+ zoneRequestTotal .DeletePartialMatch (label )
701+ zoneRequestCached .DeletePartialMatch (label )
702+ zoneRequestSSLEncrypted .DeletePartialMatch (label )
703+ zoneRequestContentType .DeletePartialMatch (label )
704+ zoneBandwidthContentType .DeletePartialMatch (label )
705+ zoneRequestCountry .DeletePartialMatch (label )
706+ zoneBandwidthCountry .DeletePartialMatch (label )
707+ zoneThreatsCountry .DeletePartialMatch (label )
708+ zoneRequestHTTPStatus .DeletePartialMatch (label )
709+ zoneRequestBrowserMap .DeletePartialMatch (label )
710+ zoneBandwidthTotal .DeletePartialMatch (label )
711+ zoneBandwidthCached .DeletePartialMatch (label )
712+ zoneBandwidthSSLEncrypted .DeletePartialMatch (label )
713+ zoneThreatsTotal .DeletePartialMatch (label )
714+ zonePageviewsTotal .DeletePartialMatch (label )
715+ zoneUniquesTotal .DeletePartialMatch (label )
716+
698717 zt := z .HTTP1mGroups [0 ]
699718
700719 zoneRequestTotal .With (prometheus.Labels {"zone" : name , "account" : account }).Add (float64 (zt .Sum .Requests ))
@@ -744,6 +763,11 @@ func addFirewallGroups(z *zoneResp, name string, account string) {
744763 if len (z .FirewallEventsAdaptiveGroups ) == 0 {
745764 return
746765 }
766+
767+ // Clear stale series for this zone/account
768+ label := prometheus.Labels {"zone" : name , "account" : account }
769+ zoneFirewallEventsCount .DeletePartialMatch (label )
770+
747771 rulesMap := fetchFirewallRules (z .ZoneTag )
748772 for _ , g := range z .FirewallEventsAdaptiveGroups {
749773 zoneFirewallEventsCount .With (
@@ -773,6 +797,10 @@ func addHealthCheckGroups(z *zoneResp, name string, account string) {
773797 return
774798 }
775799
800+ // Clear stale series for this zone/account
801+ label := prometheus.Labels {"zone" : name , "account" : account }
802+ zoneHealthCheckEventsOriginCount .DeletePartialMatch (label )
803+
776804 for _ , g := range z .HealthCheckEventsAdaptiveGroups {
777805 zoneHealthCheckEventsOriginCount .With (
778806 prometheus.Labels {
@@ -787,6 +815,11 @@ func addHealthCheckGroups(z *zoneResp, name string, account string) {
787815}
788816
789817func addHTTPAdaptiveGroups (z * zoneResp , name string , account string ) {
818+ // Clear stale series for this zone/account
819+ label := prometheus.Labels {"zone" : name , "account" : account }
820+ zoneRequestOriginStatusCountryHost .DeletePartialMatch (label )
821+ zoneRequestStatusCountryHost .DeletePartialMatch (label )
822+
790823 for _ , g := range z .HTTPRequestsAdaptiveGroups {
791824 zoneRequestOriginStatusCountryHost .With (
792825 prometheus.Labels {
@@ -837,6 +870,10 @@ func fetchLoadBalancerAnalytics(zones []cfzones.Zone, wg *sync.WaitGroup) {
837870}
838871
839872func addLoadBalancingRequestsAdaptiveGroups (z * lbResp , name string , account string ) {
873+ // Clear stale series for this zone/account
874+ label := prometheus.Labels {"zone" : name , "account" : account }
875+ poolRequestsTotal .DeletePartialMatch (label )
876+
840877 for _ , g := range z .LoadBalancingRequestsAdaptiveGroups {
841878 poolRequestsTotal .With (
842879 prometheus.Labels {
@@ -850,6 +887,10 @@ func addLoadBalancingRequestsAdaptiveGroups(z *lbResp, name string, account stri
850887}
851888
852889func addLoadBalancingRequestsAdaptive (z * lbResp , name string , account string ) {
890+ // Clear stale series for this zone/account
891+ label := prometheus.Labels {"zone" : name , "account" : account }
892+ poolHealthStatus .DeletePartialMatch (label )
893+
853894 for _ , g := range z .LoadBalancingRequestsAdaptive {
854895 for _ , p := range g .Pools {
855896 poolHealthStatus .With (
0 commit comments