Skip to content

Conversation

jhesketh
Copy link
Contributor

Previously a PossibleNonCounterInfo annotation would be left in cases where a range-vector selects 1 float data point, even if no more points are selected in order to calculate a rate.

This change ensures an output float exists before emitting such an annotation.

This fixes an inconsistency where a series with mixed data (ie, a float and a native histogram) would emit an annotation without any points.

For example,


load 1m
series{label="a"} 1 {{schema:1 sum:10 count:5 buckets:[1 2 3]}}

eval instant at 1m rate(series[1m1s])

Would have a PossibleNonCounterInfo annotation.

Wheras


load 1m
series{label="a"} {{schema:1 sum:10 count:5 buckets:[1 2 3]}} {{schema:1 sum:15 count:10 buckets:[1 2 3]}}

eval instant at 1m rate(series[1m1s])

Would not.

Previously a PossibleNonCounterInfo annotation would be left in cases
where a range-vector selects 1 float data point, even if no more points
are selected in order to calculate a rate.

This change ensures an output float exists before emitting such an
annotation.

This fixes an inconsistency where a series with mixed data (ie, a float
and a native histogram) would emit an annotation without any points.

For example,

```

load 1m
series{label="a"} 1 {{schema:1 sum:10 count:5 buckets:[1 2 3]}}

eval instant at 1m rate(series[1m1s])

```

Would have a PossibleNonCounterInfo annotation.

Wheras

```

load 1m
series{label="a"} {{schema:1 sum:10 count:5 buckets:[1 2 3]}} {{schema:1 sum:15 count:10 buckets:[1 2 3]}}

eval instant at 1m rate(series[1m1s])

```

Would not.

Signed-off-by: Joshua Hesketh <josh@nitrotech.org>
Signed-off-by: Joshua Hesketh <josh@nitrotech.org>
Copy link
Contributor

@aknuds1 aknuds1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but please see comments. I'm also wondering if a changelog entry isn't warranted?

Signed-off-by: Joshua Hesketh <josh@nitrotech.org>
Signed-off-by: Joshua Hesketh <josh@nitrotech.org>
Copy link
Contributor

@aknuds1 aknuds1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@aknuds1 aknuds1 enabled auto-merge (squash) September 18, 2024 10:16
@aknuds1 aknuds1 merged commit b6107cc into prometheus:main Sep 18, 2024
26 checks passed
@jhesketh jhesketh deleted the jhesketh/rate_annotations branch September 18, 2024 11:08
charleskorn added a commit to grafana/mimir that referenced this pull request Oct 3, 2024
charleskorn added a commit to grafana/mimir that referenced this pull request Oct 4, 2024
charleskorn added a commit to grafana/mimir that referenced this pull request Oct 4, 2024
* Update to latest mimir-prometheus

* Add changelog entries

* Address PR feedback: improve changelog entries

Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>

* Fix breaking change

* Bring in grafana/mimir-prometheus#705 too

* Adjust behaviour to match prometheus/prometheus#14821

* Re-enable tests now that we have prometheus/prometheus#14910

* Add more changelog entries

---------

Co-authored-by: George Krajcsovits <krajorama@users.noreply.github.com>
bboreham pushed a commit to bboreham/prometheus that referenced this pull request Oct 22, 2024
* Make rate possible non-counter annotation consistent

Previously a PossibleNonCounterInfo annotation would be left in cases
where a range-vector selects 1 float data point, even if no more points
are selected in order to calculate a rate.

This change ensures an output float exists before emitting such an
annotation.

This fixes an inconsistency where a series with mixed data (ie, a float
and a native histogram) would emit an annotation without any points.

For example,

```

load 1m
series{label="a"} 1 {{schema:1 sum:10 count:5 buckets:[1 2 3]}}

eval instant at 1m rate(series[1m1s])

```

Would have a PossibleNonCounterInfo annotation.

Wheras

```

load 1m
series{label="a"} {{schema:1 sum:10 count:5 buckets:[1 2 3]}} {{schema:1 sum:15 count:10 buckets:[1 2 3]}}

eval instant at 1m rate(series[1m1s])

```

Would not.

---------

Signed-off-by: Joshua Hesketh <josh@nitrotech.org>
# Conflicts:
#	CHANGELOG.md
julienduchesne pushed a commit to julienduchesne/prometheus that referenced this pull request Dec 13, 2024
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants