See base class.

def _InitializeMetric(self, metadata):
    """See base class."""
    field_defs = stats_utils.FieldDefinitionTuplesFromProtos(
        metadata.fields_defs)
    if metadata.metric_type == rdf_stats.MetricMetadata.MetricType.COUNTER:
      self._counter_metrics[metadata.varname] = _CounterMetric(field_defs)
    elif metadata.metric_type == rdf_stats.MetricMetadata.MetricType.EVENT:
      self._event_metrics[metadata.varname] = _EventMetric(
          list(metadata.bins), field_defs)
    elif metadata.metric_type == rdf_stats.MetricMetadata.MetricType.GAUGE:
      value_type = stats_utils.PythonTypeFromMetricValueType(
          metadata.value_type)
      self._gauge_metrics[metadata.varname] = _GaugeMetric(
          value_type, field_defs)
    else:
      raise ValueError("Unknown metric type: %s." % metadata.metric_type)