Skip to content

OxQL metrics: stuck in loading when exactly one data point #2733

@david-crespo

Description

@david-crespo

I started an instance and went to metrics. Because my instance had just started and the time range for metrics ended at now, all my graphs had one data point. Unfortunately, we always drop the first data point because it is the cumulative value up until now, and then the chart component treats an empty list of points as a loading state.

I think in this case we probably want to keep the former but change the latter. I'm not sure we can usefully display the cumulative value, though maybe we can get cute and do what we kinda used to do, start with that value and sort of synthetically fill out the data with a bunch of identical values using it. (We would have to make sure we don't project that value into the future.)

const chartData = timestamps
.map((timestamp, idx) => ({ timestamp, value: summedValues[idx] }))
// Drop the first datapoint, which — for delta metric types — is the cumulative sum of all previous
// datapoints (like CPU utilization). We've accounted for this by adjusting the start time earlier;
// We could use a more elegant approach to this down the road
.slice(1)

if (!data || data.length === 0) {
return (
<SkeletonMetric shimmer className={wrapperClass}>
<MetricsLoadingIndicator />
</SkeletonMetric>
)
}

Image

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions