(
        self,
        metric_query: str,
        metric_type: str,
        time_start: int,
        time_end: int,
        is_regex: bool = False,
        check_deprecated: bool = True,
        use_cache: bool = True,
        extra_dimensions: Optional[Dict[str, str]] = None,
        app_identifier: Optional[str] = None,
    )
return data
Returns the values over a time range for some metric.

        :param metric_query: the name of the metric to get values for.
        :param metric_type: must be one of :ref:`Metric Types`. Type of metric_name
        :param time_start: start of the time range of values to return (Unix timestamp)
        :param time_end: end (inclusive) of the time range of values to return (Unix timestamp)
        :param is_regex: if True, interpret the metric_query as a regular expression against which keys can match
        :param check_deprecated: if True, check to see if there's any data using deprecated key names
        :param use_cache: if True, read and store metrics to a local cache
        :param extra_dimensions: a dictionary of extra dimensions to include in the query but that will not be
            present in the return value
        :param app_identifier: a string identifying the app to get metrics for (overrides self.app_identifier if set)
        :returns: a mapping from metric name -> timeseries data; the metric name does _not_ include the app_identifier
            or any dimensions specified in ``extra_dimensions``
        :raises: ``ValueError`` if the metric type is not one of :ref:`Metric Types` or if application metrics are
            requested with no app identifier
Returns the values over a time range for some metric.
Returns the values over a time range for some metric .
def get_metric_values(
        self,
        metric_query: str,
        metric_type: str,
        time_start: int,
        time_end: int,
        is_regex: bool = False,
        check_deprecated: bool = True,
        use_cache: bool = True,
        extra_dimensions: Optional[Dict[str, str]] = None,
        app_identifier: Optional[str] = None,
    ) -> MetricsValuesDict:
        """Returns the values over a time range for some metric.

        :param metric_query: the name of the metric to get values for.
        :param metric_type: must be one of :ref:`Metric Types`. Type of metric_name
        :param time_start: start of the time range of values to return (Unix timestamp)
        :param time_end: end (inclusive) of the time range of values to return (Unix timestamp)
        :param is_regex: if True, interpret the metric_query as a regular expression against which keys can match
        :param check_deprecated: if True, check to see if there's any data using deprecated key names
        :param use_cache: if True, read and store metrics to a local cache
        :param extra_dimensions: a dictionary of extra dimensions to include in the query but that will not be
            present in the return value
        :param app_identifier: a string identifying the app to get metrics for (overrides self.app_identifier if set)
        :returns: a mapping from metric name -> timeseries data; the metric name does _not_ include the app_identifier
            or any dimensions specified in ``extra_dimensions``
        :raises: ``ValueError`` if the metric type is not one of :ref:`Metric Types` or if application metrics are
            requested with no app identifier
        """
        if metric_type != APP_METRICS:
            if is_regex:
                raise ValueError("regex expressions are not supported for {type}".format(type=metric_type))
            app_identifier = ""
        else:
            app_identifier = app_identifier or self.app_identifier
            assert app_identifier  # make mypy happy
        key_prefix = self._get_key_prefix(metric_type, app_identifier)
        query_with_dims = key_prefix + generate_key_with_dimensions(metric_query, extra_dimensions)

        cached_data: MetricsValuesDict = defaultdict(list)
        if use_cache:
            cached_data, time_start, time_end = self._cache_lookup(query_with_dims, time_start, time_end)

        new_data: MetricsValuesDict = defaultdict(list)
        if time_start < time_end:  # Skip querying dynamodb if all the metrics were in the cache
            new_data = self._get_new_metric_values(
                key_prefix, metric_query, metric_type, time_start, time_end, is_regex, extra_dimensions,
            )

        if new_data and use_cache:
            self._cache_store(query_with_dims, time_start, new_data)

        data: MetricsValuesDict = defaultdict(list)
        for metric_key in set(cached_data) | set(new_data):
            ts = cached_data[metric_key] + new_data[metric_key]
            metric_key_without_app = metric_key[len(app_identifier) + 1 :] if metric_type == APP_METRICS else metric_key
            data[metric_key_without_app] = ts
        return data
def get_metric_values ( self , metric_query : str , metric_type : str , time_start : int , time_end : int , is_regex : bool = False , check_deprecated : bool = True , use_cache : bool = True , extra_dimensions : Optional [ Dict [ str , str ] ] = None , app_identifier : Optional [ str ] = None , ) -> MetricsValuesDict : if metric_type != APP_METRICS : if is_regex : raise ValueError ( "regex expressions are not supported for {type}" . format ( type = metric_type ) ) app_identifier = "" else : app_identifier = app_identifier or self . app_identifier assert app_identifier # make mypy happy key_prefix = self . _get_key_prefix ( metric_type , app_identifier ) query_with_dims = key_prefix + generate_key_with_dimensions ( metric_query , extra_dimensions ) cached_data : MetricsValuesDict = defaultdict ( list ) if use_cache : cached_data , time_start , time_end = self . _cache_lookup ( query_with_dims , time_start , time_end ) new_data : MetricsValuesDict = defaultdict ( list ) if time_start < time_end : # Skip querying dynamodb if all the metrics were in the cache new_data = self . _get_new_metric_values ( key_prefix , metric_query , metric_type , time_start , time_end , is_regex , extra_dimensions , ) if new_data and use_cache : self . _cache_store ( query_with_dims , time_start , new_data ) data : MetricsValuesDict = defaultdict ( list ) for metric_key in set ( cached_data ) | set ( new_data ) : ts = cached_data [ metric_key ] + new_data [ metric_key ] metric_key_without_app = metric_key [ len ( app_identifier ) + 1 : ] if metric_type == APP_METRICS else metric_key data [ metric_key_without_app ] = ts return data