def Get(self, fields=None):
    """Gets the metric value corresponding to the given field values."""
    if not self._field_defs and fields:
      raise ValueError("Metric was registered without fields, "
                       "but following fields were provided: %s." % (fields,))

    if self._field_defs and not fields:
      raise ValueError("Metric was registered with fields (%s), "
                       "but no fields were provided." % self._field_defs)

    if self._field_defs and fields and len(self._field_defs) != len(fields):
      raise ValueError(
          "Metric was registered with %d fields (%s), but "
          "%d fields were provided (%s)." % (len(
              self._field_defs), self._field_defs, len(fields), fields))

    metric_value = self._metric_values.get(_FieldsToKey(fields))
    return self._DefaultValue() if metric_value is None else metric_value
def Get ( self , fields = None ) : if not self . _field_defs and fields : raise ValueError ( "Metric was registered without fields, " "but following fields were provided: %s." % ( fields , ) ) if self . _field_defs and not fields : raise ValueError ( "Metric was registered with fields (%s), " "but no fields were provided." % self . _field_defs ) if self . _field_defs and fields and len ( self . _field_defs ) != len ( fields ) : raise ValueError ( "Metric was registered with %d fields (%s), but " "%d fields were provided (%s)." % ( len ( self . _field_defs ) , self . _field_defs , len ( fields ) , fields ) ) metric_value = self . _metric_values . get ( _FieldsToKey ( fields ) ) return self . _DefaultValue ( ) if metric_value is None else metric_value
Gets the metric value corresponding to the given field values.