code: def add_metric(self, labels, buckets, sum_value, timestamp=None):
          
          for b in buckets:
              bucket, value = b[:2]
              exemplar = None
              if len(b) == 3:
                  exemplar = b[2]
              self.samples.append(Sample(
                  self.name + '_bucket',
                  dict(list(zip(self._labelnames, labels)) + [('le', bucket)]),
                  value,
                  timestamp,
                  exemplar,
              ))
          # +Inf is last and provides the count value.
          self.samples.extend([
              Sample(self.name + '_count', dict(zip(self._labelnames, labels)), buckets[-1][1], timestamp),
              Sample(self.name + '_sum', dict(zip(self._labelnames, labels)), sum_value, timestamp),
          ])
docs: Add a metric to the metric family.
  
          Args:
            labels: A list of label values
            buckets: A list of lists.
                Each inner list can be a pair of bucket name and value,
                or a triple of bucket name, value, and exemplar.
                The buckets must be sorted, and +Inf present.
            sum_value: The sum value of the metric.