graphite-project / graphite-web

A highly scalable real-time graphing system
http://graphite.readthedocs.org/
Apache License 2.0
5.91k stars 1.26k forks source link

graphite-web 1.1.3 render with multiple targets returns null or no data #2318

Closed TimWhalen closed 6 years ago

TimWhalen commented 6 years ago

OS: centos-7 python: 2.7.5 django: 1.11 graphite-web: 1.1.3 rrdtool: 1.7.0

There are three queries in the examples below. Two are raw data from rrds and the third is a divideSeries of the first two. When you request the raw data or the divideSeries you get the correct results. If you request both raw data and the divideSeries you get null values or no datapoints depending on the order of targets:

  1. raw data curl 'http://xvba-e25.xv.dc.openx.org/graphite/render?format=json&from=1530050400&until=1530051000&target=market_opportunity_svc.md.internal_qualify_prequalify_micros.host.xvbd-e62.counter.value&target=market_opportunity_svc.md.get_opportunities_success.host.xvbd-e62.counter.value'

    [{
    "datapoints": [
        [9054705.109444445, 1530050400],
        [9120871.425, 1530050460],
        [9177432.971388888, 1530050520],
        [9045113.327777779, 1530050580],
        [9172009.116666667, 1530050640],
        [9072210.63888889, 1530050700],
        [9069803.035555555, 1530050760],
        [9143143.27388889, 1530050820],
        [9131529.015555555, 1530050880],
        [9077973.385833332, 1530050940]
    ],
    "target": "market_opportunity_svc.md.internal_qualify_prequalify_micros.host.xvbd-e62.counter.value",
    "tags": {
        "name": "market_opportunity_svc.md.internal_qualify_prequalify_micros.host.xvbd-e62.counter.value"
    }
    }, {
    "datapoints": [
        [7462.465277777777, 1530050400],
        [7626.964166666668, 1530050460],
        [7703.191944444445, 1530050520],
        [7513.552500000001, 1530050580],
        [7721.190833333332, 1530050640],
        [7547.9766666666665, 1530050700],
        [7571.581944444444, 1530050760],
        [7595.705277777778, 1530050820],
        [7630.304722222223, 1530050880],
        [7562.694444444443, 1530050940]
    ],
    "target": "market_opportunity_svc.md.get_opportunities_success.host.xvbd-e62.counter.value",
    "tags": {
        "name": "market_opportunity_svc.md.get_opportunities_success.host.xvbd-e62.counter.value"
    }
    }]
  2. divideSeries curl 'http://xvba-e25.xv.dc.openx.org/graphite/render?format=json&from=1530050400&until=1530051000&target=divideSeries(market_opportunity_svc.md.internal_qualify_prequalify_micros.host.xvbd-e62.counter.value,market_opportunity_svc.md.get_opportunities_success.host.xvbd-e62.counter.value)'

    [{
    "datapoints": [
        [1213.366464351686, 1530050400],
        [1195.8718076665934, 1530050460],
        [1191.3805390773973, 1530050520],
        [1203.8397719025425, 1530050580],
        [1187.9008451740337, 1530050640],
        [1201.9394123134398, 1530050700],
        [1197.8742490148195, 1530050760],
        [1203.7253868496375, 1530050820],
        [1196.7449987890025, 1530050880],
        [1200.3623116761003, 1530050940]
    ],
    "target": "divideSeries(market_opportunity_svc.md.internal_qualify_prequalify_micros.host.xvbd-e62.counter.value,market_opportunity_svc.md.get_opportunities_success.host.xvbd-e62.counter.value)",
    "tags": {
        "name": "divideSeries(market_opportunity_svc.md.internal_qualify_prequalify_micros.host.xvbd-e62.counter.value,market_opportunity_svc.md.get_opportunities_success.host.xvbd-e62.counter.value)"
    }
    }]
  3. raw data then divideSeries curl 'http://xvba-e25.xv.dc.openx.org/graphite/render?format=json&from=1530050400&until=1530051000&target=market_opportunity_svc.md.internal_qualify_prequalify_micros.host.xvbd-e62.counter.value&target=divideSeries(market_opportunity_svc.md.internal_qualify_prequalify_micros.host.xvbd-e62.counter.value,market_opportunity_svc.md.get_opportunities_success.host.xvbd-e62.counter.value)'

    [{
    "datapoints": [
        [9054705.109444445, 1530050400],
        [9120871.425, 1530050460],
        [9177432.971388888, 1530050520],
        [9045113.327777779, 1530050580],
        [9172009.116666667, 1530050640],
        [9072210.63888889, 1530050700],
        [9069803.035555555, 1530050760],
        [9143143.27388889, 1530050820],
        [9131529.015555555, 1530050880],
        [9077973.385833332, 1530050940]
    ],
    "target": "market_opportunity_svc.md.internal_qualify_prequalify_micros.host.xvbd-e62.counter.value",
    "tags": {
        "name": "market_opportunity_svc.md.internal_qualify_prequalify_micros.host.xvbd-e62.counter.value"
    }
    }, {
    "datapoints": [
        [null, 1530050400],
        [null, 1530050460],
        [null, 1530050520],
        [null, 1530050580],
        [null, 1530050640],
        [null, 1530050700],
        [null, 1530050760],
        [null, 1530050820],
        [null, 1530050880],
        [null, 1530050940]
    ],
    "target": "divideSeries(market_opportunity_svc.md.internal_qualify_prequalify_micros.host.xvbd-e62.counter.value,market_opportunity_svc.md.get_opportunities_success.host.xvbd-e62.counter.value)",
    "tags": {
        "name": "divideSeries(market_opportunity_svc.md.internal_qualify_prequalify_micros.host.xvbd-e62.counter.value,market_opportunity_svc.md.get_opportunities_success.host.xvbd-e62.counter.value)"
    }
    }]
  4. divideSeries then raw data curl 'http://xvba-e25.xv.dc.openx.org/graphite/render?format=json&from=1530050400&until=1530051000&target=divideSeries(market_opportunity_svc.md.internal_qualify_prequalify_micros.host.xvbd-e62.counter.value,market_opportunity_svc.md.get_opportunities_success.host.xvbd-e62.counter.value)&target=market_opportunity_svc.md.internal_qualify_prequalify_micros.host.xvbd-e62.counter.value'

    [{
    "datapoints": [
        [1213.366464351686, 1530050400],
        [1195.8718076665934, 1530050460],
        [1191.3805390773973, 1530050520],
        [1203.8397719025425, 1530050580],
        [1187.9008451740337, 1530050640],
        [1201.9394123134398, 1530050700],
        [1197.8742490148195, 1530050760],
        [1203.7253868496375, 1530050820],
        [1196.7449987890025, 1530050880],
        [1200.3623116761003, 1530050940]
    ],
    "target": "divideSeries(market_opportunity_svc.md.internal_qualify_prequalify_micros.host.xvbd-e62.counter.value,market_opportunity_svc.md.get_opportunities_success.host.xvbd-e62.counter.value)",
    "tags": {
        "name": "divideSeries(market_opportunity_svc.md.internal_qualify_prequalify_micros.host.xvbd-e62.counter.value,market_opportunity_svc.md.get_opportunities_success.host.xvbd-e62.counter.value)"
    }
    }, {
    "datapoints": [],
    "target": "market_opportunity_svc.md.internal_qualify_prequalify_micros.host.xvbd-e62.counter.value",
    "tags": {
        "name": "market_opportunity_svc.md.internal_qualify_prequalify_micros.host.xvbd-e62.counter.value"
    }
    }]

We saw similar behavior with graphite-api last year and we've been sticking with graphite-web 0.10.0alpha5 until we can resolve this issue.

TimWhalen commented 6 years ago

I packaged and tested with graphite-web 1.1.3 with the same result so I updated the version in this issue.

TimWhalen commented 6 years ago

The cause of this issue is that prefetched data in webapp/graphite/render/datalib.py is in a generator, converting it to a list in the cache resolves my issue: https://github.com/graphite-project/graphite-web/pull/2322

deniszh commented 6 years ago

Merged. Thanks!