(self, config)
Retrieves the leader-election annotation from a given object, and
        submits metrics and a service check.

        An integration warning is sent if the object is not retrievable,
        or no record is found. Monitors on the service-check should have
        no-data alerts enabled to account for this.

        The config object requires the following fields:
            namespace (prefix for the metrics and check)
            record_kind (leases, endpoints or configmap)
            record_name
            record_namespace
            tags (optional)

        It reads the following agent configuration:
            kubernetes_kubeconfig_path: default is to use in-cluster config
Retrieves the leader-election annotation from a given object, and
        submits metrics and a service check.
Retrieves the leader - election annotation from a given object and submits metrics and a service check .
def check_election_status(self, config):
        """
        Retrieves the leader-election annotation from a given object, and
        submits metrics and a service check.

        An integration warning is sent if the object is not retrievable,
        or no record is found. Monitors on the service-check should have
        no-data alerts enabled to account for this.

        The config object requires the following fields:
            namespace (prefix for the metrics and check)
            record_kind (leases, endpoints or configmap)
            record_name
            record_namespace
            tags (optional)

        It reads the following agent configuration:
            kubernetes_kubeconfig_path: default is to use in-cluster config
        """
        try:
            record = self._get_record(
                config.get("record_kind", ""), config.get("record_name", ""), config.get("record_namespace", "")
            )
            self._report_status(config, record)
        except Exception as e:
            self.warning("Cannot retrieve leader election record %s: %s", config.get("record_name", ""), e)
def check_election_status ( self , config ) : try : record = self . _get_record ( config . get ( "record_kind" , "" ) , config . get ( "record_name" , "" ) , config . get ( "record_namespace" , "" ) ) self . _report_status ( config , record ) except Exception as e : self . warning ( "Cannot retrieve leader election record %s: %s" , config . get ( "record_name" , "" ) , e )