Boavizta / boaviztapi

🛠 Giving access to BOAVIZTA reference data and methodologies trough a RESTful API
GNU Affero General Public License v3.0
66 stars 23 forks source link

Incoherent min & max value for impacts #209

Closed PierreRust closed 10 months ago

PierreRust commented 10 months ago

Bug description

When requesting the impact of a aws m4.large instance, the min and max values are not coherent with the value returned by the API.

To Reproduce

curl -X 'GET' \
  'http://dev.api.boavizta.org/v1/cloud/instance?provider=aws&instance_type=m4.large&verbose=true&criteria=gwp&criteria=adp&criteria=pe' \
  -H 'accept: application/json'

The problem seems to be the same on other impact criteria.

Expected behavior

I would expect to see min < value < max

JSON OUTPUT

"impacts": {
    "gwp": {
      "embedded": {
        "value": 24.803,
        "significant_figures": 5,
        "min": 516.64,
        "max": 1439.1,
        "warnings": [
          "End of life is not included in the calculation"
        ]
      },
      "use": {
        "value": 141.15,
        "significant_figures": 5,
        "min": 277.5,
        "max": 18204
      },
      "unit": "kgCO2eq",
      "description": "Total climate change"
    },
  [...]

Additional context

This happens on the dev instance, tested at http://dev.api.boavizta.org/docs#/cloud/instance_cloud_impact_v1_cloud_instance_get

da-ekchajzer commented 10 months ago

Thanks for your bug report. Found the bug, we didn't divide the min/max impacts by the instance per server ratio.

Fixed in : https://github.com/Boavizta/boaviztapi/commit/7ff1aff9c560e7dbcdefd486cc0cf25786cdf124 which is up and running in the dev endpoint.

Please tell me if it fixes the issue.

PierreRust commented 10 months ago

I've just tried it and I confirm the issue is fixed 👍

I now always get min =< value =< max

thanks !