def transmit_metrics(self):
        """
        Keep metrics updated about how long time ago each filetype was successfully uploaded.
        Transmits max once per ten seconds, regardless of how many threads are running.
        """
        global _last_stats_transmit_time  # pylint: disable=global-statement
        with _STATS_LOCK:  # pylint: disable=not-context-manager
            if time.monotonic() - _last_stats_transmit_time < 10.0:
                return

            for site in self.state:
                for filetype, prop in self.state[site]["upload"].items():
                    if prop["last_success"]:
                        self.metrics.gauge(
                            "pghoard.last_upload_age",
                            time.monotonic() - prop["last_success"],
                            tags={
                                "site": site,
                                "type": filetype,
                            }
                        )
            _last_stats_transmit_time = time.monotonic()
def transmit_metrics ( self ) : global _last_stats_transmit_time with _STATS_LOCK : if time . monotonic ( ) - _last_stats_transmit_time < 10.0 : return for site in self . state : for filetype , prop in self . state [ site ] [ "upload" ] . items ( ) : if prop [ "last_success" ] : self . metrics . gauge ( "pghoard.last_upload_age" , time . monotonic ( ) - prop [ "last_success" ] , tags = { "site" : site , "type" : filetype , } ) _last_stats_transmit_time = time . monotonic ( )
Keep metrics updated about how long time ago each filetype was successfully uploaded.
        Transmits max once per ten seconds, regardless of how many threads are running.