# Query\_range how to set start and end date and have one calculated and sum value of domains

**URL:** <https://discuss.prometheus.io/t/query-range-how-to-set-start-and-end-date-and-have-one-calculated-and-sum-value-of-domains/3161>\
**Category:** General Help/Support\
**Created:** [October 14, 2024, 12:05pm UTC](https://discuss.prometheus.io/t/query-range-how-to-set-start-and-end-date-and-have-one-calculated-and-sum-value-of-domains/3161 "2024-10-14T12:05:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![inna](https://avatars.discourse-cdn.com/v4/letter/i/8e8cbc/32.png) [@inna](https://discuss.prometheus.io/u/inna)\
**Post date:** [October 14, 2024, 12:05pm UTC](https://discuss.prometheus.io/t/query-range-how-to-set-start-and-end-date-and-have-one-calculated-and-sum-value-of-domains/3161/1 "2024-10-14T12:05:53Z")

</div>

Prometheus query\_range how to set start and end date and have one calculated and sum value of domains

I googled as much as I could to find and reach what I’m going to have, but I have some problems.

I downloaded [libvirt\_exporter](https://github.com/Tinkoff/libvirt-exporter) on `instance1.mysite.com` to have the values of how much each VM downloads and uploads.

This is my code:

```python
import requests
response_tmp =requests.get(
    'http://prom.mysite.com:9091/api/v1/query_range',
    params={
        'query': 'sum(increase(libvirt_domain_interface_stats_receive_bytes_total[2h]))',
        'start': '2024-10-01T00:00:00.000Z', # RFC3339, UTC
        'end': '2024-10-13T00:00:00.000Z', # RFC3339, UTC
        'step': '60'
        },
        auth=('admin', 'myStrongAdminPassWord')
        )#.json()['data']['result']

```

This is current result:

```auto
{"status":"error","errorType":"bad_data","error":"exceeded maximum resolution of 11,000 points per timeseries. Try decreasing the query resolution (?step=XX)"}

```

But if I change the start-end to a newer start date like `2024-10-12T00:00:00.000Z`, it is something like this:

```json
{
  "status": "success",
  "data": {
    "resultType": "matrix",
    "result": [
      {
        "metric": {
          "domain": "instance-0000017d",
          "instance": "instance1.mysite.com:9177",
          "job": "libvirt_exporter",
          "target_device": "tapc1aedd0e-fd"
        },
        "values": [
          [1728722820, "13668737203.838501"
          ],
          [1728722880, "20305044171.814877"
          ],
          [1728722940, "26668580969.595806"
          ],
          [1728723000, "33146620341.0449"
          ],
          [1728723060, "40289211402.494484"
          ],
          [1728723120, "46987842952.288124"
          ],
          [1728723180, "53823854756.43225"
          ]
        ]
      }
    ]
  }
}

```

But as I understood, the `increase` function does this: `13668737203.838501 + 20305044171.814877 + 26668580969.595806 + 33146620341.0449 + 40289211402.494484 + 46987842952.288124 + 53823854756.43225`, but I see all the values.

I’m going to have `234889891797.5089` which is the sum of all above numbers.

Would you please help me regarding this?

---

<div class="post-metadata">

**Author:** ![OffShoreSailor](https://avatars.discourse-cdn.com/v4/letter/o/d9b06d/32.png) [@OffShoreSailor](https://discuss.prometheus.io/u/OffShoreSailor)\
**Post date:** [April 3, 2025, 1:31pm UTC](https://discuss.prometheus.io/t/query-range-how-to-set-start-and-end-date-and-have-one-calculated-and-sum-value-of-domains/3161/2 "2025-04-03T13:31:38Z")

</div>

Did you ever figure this out? I’m having a similar issue with out much success.
