def set_function(self, f):
        def samples(self):
            return (('', {}, float(f())), )
        self._samples = types.MethodType(samples, self)
Call the provided function to return the Gauge value.
dataset/ETHPy150Open prometheus/client_python/prometheus_client/core.py/Gauge.set_function