Skip to content

Prometheus - Last Point returned as NaN in some cases #308

@Hedius

Description

@Hedius

The commit

8626478

introduced changes in prometheus/series_set.go that cause NaN to be returned if a value has not been inserted yet by carbon-clickhouse.

You can observe that quite good in Grafana if you set an interval lower than your influx interval. This causes the last value to be NaN, nearly always.
If you use an interval >= your influx interval it returns NaN for the last window for as long as there has not been any value delivered in that window.

Without that logic the last value keeps to be returned

       // new...
	if index == len(sit.points) {
		return int64(sit.points[len(sit.points)-1].Time)*1000 + sit.step, math.NaN()
	}
	if index < 0 || index >= len(sit.points) {
		index = 0
	}

Idk what the ideal behavior would be. But having less NaNs makes it less pain kind of? Maybe add a feature switch for this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions