def add_metric(self, labels, buckets, sum_value, timestamp=None):
for b in buckets:<EOL><INDENT>bucket, value = b[:<NUM_LIT:2>]<EOL>exemplar = None<EOL>if len(b) == <NUM_LIT:3>:<EOL><INDENT>exemplar = b[<NUM_LIT:2>]<EOL><DEDENT>self.samples.append(Sample(<EOL>self.name + '<STR_LIT>',<EOL>dict(list(zip(self._labelnames, labels)) + [('<STR_LIT>', bucket)]),<EOL>value,<EOL>timestamp,<EOL>exemplar,<EOL>))<EOL><DEDENT>self.samples.extend([<EOL>Sample(self.name + '<STR_LIT>', dict(zip(self._labelnames, labels)), buckets[-<NUM_LIT:1>][<NUM_LIT:1>], timestamp),<EOL>Sample(self.name + '<STR_LIT>', dict(zip(self._labelnames, labels)), sum_value, timestamp),<EOL>])<EOL>
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.