code: def _update_pods_metrics(self, instance, pods):
          tags_map = defaultdict(int)
          for pod in pods['items']:
              pod_meta = pod.get('metadata', {})
              pod_tags = self.kubeutil.get_pod_creator_tags(pod_meta, legacy_rep_controller_tag=True)
              services = self.kubeutil.match_services_for_pod(pod_meta)
              if isinstance(services, list):
                  for service in services:
                      pod_tags.append('kube_service:%s' % service)
              if 'namespace' in pod_meta:
                  pod_tags.append('kube_namespace:%s' % pod_meta['namespace'])
              tags_map[frozenset(pod_tags)] += 1
          commmon_tags = instance.get('tags', [])
          for pod_tags, pod_count in tags_map.iteritems():
              tags = list(pod_tags)
              tags.extend(commmon_tags)
              self.publish_gauge(self, NAMESPACE + '.pods.running', pod_count, tags)