Exemple #1
0
def get_measures_or_abort(metrics_and_aggregations, operations, start, stop,
                          granularity, needed_overlap, fill, ref_identifier):
    try:
        return processor.get_measures(pecan.request.storage,
                                      metrics_and_aggregations,
                                      operations,
                                      start,
                                      stop,
                                      granularity,
                                      needed_overlap,
                                      fill,
                                      ref_identifier=ref_identifier)
    except exceptions.UnAggregableTimeseries as e:
        api.abort(400, e)
    # TODO(sileht): We currently got only one metric for these exceptions but
    # we can improve processor to returns all missing metrics at once, so we
    # returns a list for the future
    except storage.MetricDoesNotExist as e:
        api.abort(404, {
            "cause": "Unknown metrics",
            "detail": [str(e.metric.id)]
        })
    except storage.AggregationDoesNotExist as e:
        api.abort(
            404, {
                "cause": "Metrics with unknown aggregation",
                "detail": [(str(e.metric.id), e.method)]
            })
Exemple #2
0
def get_measures_or_abort(references, operations, start,
                          stop, granularity, needed_overlap, fill):
    try:
        return processor.get_measures(
            pecan.request.storage,
            references,
            operations,
            start, stop,
            granularity, needed_overlap, fill)
    except exceptions.UnAggregableTimeseries as e:
        api.abort(400, e)
    # TODO(sileht): We currently got only one metric for these exceptions but
    # we can improve processor to returns all missing metrics at once, so we
    # returns a list for the future
    except storage.MetricDoesNotExist as e:
        api.abort(404, {"cause": "Unknown metrics",
                        "detail": [str(e.metric.id)]})
    except storage.AggregationDoesNotExist as e:
        api.abort(404, {"cause": "Metrics with unknown aggregation",
                        "detail": [(str(e.metric.id), e.method)]})