def METHOD_NAME(user: Optional[User], metric_name: str) -> flask.Response:
    metrics_storage = SQLMetricsStorage()
    from_time_ts = float(flask.request.args.get("from_time", 0))
    to_time_ts = float(flask.request.args.get("to_time", time.time()))
    try:
        labels: Dict = json.loads(flask.request.args.get("labels", "{}"))
    except Exception as e:
        return jsonify_error(
            f"Unable to deserialize labels: {e}", HTTPStatus.BAD_REQUEST
        )
    try:
        rollup = _get_rollup(flask.request.args)
    except ValueError as e:
        return jsonify_error(str(e), HTTPStatus.BAD_REQUEST)
    filter = MetricsFilter(
        name=metric_name,
        from_time=datetime.datetime.utcfromtimestamp(from_time_ts),
        to_time=datetime.datetime.utcfromtimestamp(to_time_ts),
        labels=labels,
    )
    try:
        group_bys = [
            GroupBy(value)
            for value in flask.request.args.get("group_by", "").split(",")
            if len(value) > 0
        ]
    except ValueError:
        options = ", ".join([gb.name for gb in GroupBy])
        return jsonify_error(
            f"Unrecognized group_by. Options are: {options}", HTTPStatus.BAD_REQUEST
        )
    try:
        series = metrics_storage.get_aggregated_metrics(filter, group_bys, rollup)
    except NoMetricError as e:
        return jsonify_error(str(e), HTTPStatus.NOT_FOUND)
    return flask.jsonify(content=series)