Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distributor: Don't drop time series with invalid exemplars #8224

Merged
merged 9 commits into from
May 31, 2024

Conversation

aknuds1
Copy link
Contributor

@aknuds1 aknuds1 commented May 30, 2024

What this PR does

Modify the distributor to not discard time series with invalid exemplars, instead just drop affected exemplars. This is to deal with the fact that OTel sends empty exemplars by default.

Which issue(s) this PR fixes or relates to

Fixes #8210.

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

@aknuds1 aknuds1 added bug Something isn't working component/distributor labels May 30, 2024
@aknuds1 aknuds1 force-pushed the arve/fix-exemplar-reject branch 2 times, most recently from 67088c1 to 0996c39 Compare May 30, 2024 16:51
@aknuds1 aknuds1 changed the title WIP: Distributor: Don't drop time series with invalid exemplars Distributor: Don't drop time series with invalid exemplars May 30, 2024
Don't discard time series with invalid exemplars, just drop affected
exemplars.

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
@aknuds1 aknuds1 marked this pull request as ready for review May 30, 2024 16:54
@aknuds1 aknuds1 requested a review from a team as a code owner May 30, 2024 16:54
CHANGELOG.md Outdated Show resolved Hide resolved
pkg/distributor/distributor.go Outdated Show resolved Hide resolved
pkg/distributor/distributor_test.go Outdated Show resolved Hide resolved
pkg/distributor/distributor_test.go Outdated Show resolved Hide resolved
aknuds1 and others added 6 commits May 30, 2024 19:32
Co-authored-by: Nick Pillitteri <56quarters@users.noreply.github.com>
Co-authored-by: Nick Pillitteri <56quarters@users.noreply.github.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Copy link
Contributor

@colega colega left a comment

Choose a reason for hiding this comment

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

LGTM, please consider my nit about the test.

Co-authored-by: Oleg Zaytsev <mail@olegzaytsev.com>
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
@aknuds1
Copy link
Contributor Author

aknuds1 commented May 31, 2024

I tested the fix in our dev environment, and it works.

@aknuds1 aknuds1 merged commit d319b9f into main May 31, 2024
29 checks passed
@aknuds1 aknuds1 deleted the arve/fix-exemplar-reject branch May 31, 2024 10:33
grafanabot pushed a commit that referenced this pull request May 31, 2024
* Distributor: Don't drop time series with invalid exemplars

Don't discard time series with invalid exemplars, just drop affected
exemplars.

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Nick Pillitteri <56quarters@users.noreply.github.com>
Co-authored-by: Oleg Zaytsev <mail@olegzaytsev.com>
(cherry picked from commit d319b9f)
@grafanabot
Copy link
Contributor

The backport to r291 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-8224-to-r291 origin/r291
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x d319b9ff9d0dbdfed71e98526e2bf235b66e04dd
# Push it to GitHub
git push --set-upstream origin backport-8224-to-r291
git switch main
# Remove the local backport branch
git branch -D backport-8224-to-r291

Then, create a pull request where the base branch is r291 and the compare/head branch is backport-8224-to-r291.

@grafanabot
Copy link
Contributor

The backport to r290 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-8224-to-r290 origin/r290
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x d319b9ff9d0dbdfed71e98526e2bf235b66e04dd
# Push it to GitHub
git push --set-upstream origin backport-8224-to-r290
git switch main
# Remove the local backport branch
git branch -D backport-8224-to-r290

Then, create a pull request where the base branch is r290 and the compare/head branch is backport-8224-to-r290.

aknuds1 added a commit that referenced this pull request May 31, 2024
…8236)

* Distributor: Don't drop time series with invalid exemplars

Don't discard time series with invalid exemplars, just drop affected
exemplars.

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Nick Pillitteri <56quarters@users.noreply.github.com>
Co-authored-by: Oleg Zaytsev <mail@olegzaytsev.com>
(cherry picked from commit d319b9f)

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
aknuds1 added a commit that referenced this pull request May 31, 2024
* Distributor: Don't drop time series with invalid exemplars

Don't discard time series with invalid exemplars, just drop affected
exemplars.

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Nick Pillitteri <56quarters@users.noreply.github.com>
Co-authored-by: Oleg Zaytsev <mail@olegzaytsev.com>
(cherry picked from commit d319b9f)
aknuds1 added a commit that referenced this pull request May 31, 2024
* Distributor: Don't drop time series with invalid exemplars

Don't discard time series with invalid exemplars, just drop affected
exemplars.

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Nick Pillitteri <56quarters@users.noreply.github.com>
Co-authored-by: Oleg Zaytsev <mail@olegzaytsev.com>
(cherry picked from commit d319b9f)
aknuds1 added a commit that referenced this pull request May 31, 2024
…8238)

* Distributor: Don't drop time series with invalid exemplars

Don't discard time series with invalid exemplars, just drop affected
exemplars.

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Nick Pillitteri <56quarters@users.noreply.github.com>
Co-authored-by: Oleg Zaytsev <mail@olegzaytsev.com>
(cherry picked from commit d319b9f)
aknuds1 added a commit that referenced this pull request May 31, 2024
…8239)

* Distributor: Don't drop time series with invalid exemplars

Don't discard time series with invalid exemplars, just drop affected
exemplars.

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Nick Pillitteri <56quarters@users.noreply.github.com>
Co-authored-by: Oleg Zaytsev <mail@olegzaytsev.com>
(cherry picked from commit d319b9f)
narqo pushed a commit to narqo/grafana-mimir that referenced this pull request Jun 6, 2024
)

* Distributor: Don't drop time series with invalid exemplars

Don't discard time series with invalid exemplars, just drop affected
exemplars.

---------

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Nick Pillitteri <56quarters@users.noreply.github.com>
Co-authored-by: Oleg Zaytsev <mail@olegzaytsev.com>
Comment on lines 1449 to +1462
"rejects exemplar with too many series labels": {
req: makeWriteRequestExemplar(manyLabels, 0, nil),
errMsg: "received a series whose number of labels exceeds the limit",
errID: globalerror.MaxLabelNamesPerSeries,
req: makeWriteRequestExemplar(manyLabels, 0, 1, nil),
expectedErrMsg: "received a series whose number of labels exceeds the limit",
expectedErrID: globalerror.MaxLabelNamesPerSeries,
},
"rejects exemplar with duplicate series labels": {
req: makeWriteRequestExemplar([]string{model.MetricNameLabel, "test", "foo", "bar", "foo", "bar"}, 0, nil),
errMsg: "received a series with duplicate label name",
errID: globalerror.SeriesWithDuplicateLabelNames,
req: makeWriteRequestExemplar([]string{model.MetricNameLabel, "test", "foo", "bar", "foo", "bar"}, 0, 1, nil),
expectedErrMsg: "received a series with duplicate label name",
expectedErrID: globalerror.SeriesWithDuplicateLabelNames,
},
"rejects exemplar with empty series label name": {
req: makeWriteRequestExemplar([]string{model.MetricNameLabel, "test", "", "bar"}, 0, nil),
errMsg: "received a series with an invalid label",
errID: globalerror.SeriesInvalidLabel,
req: makeWriteRequestExemplar([]string{model.MetricNameLabel, "test", "", "bar"}, 0, 1, nil),
expectedErrMsg: "received a series with an invalid label",
expectedErrID: globalerror.SeriesInvalidLabel,

Choose a reason for hiding this comment

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

Just curious, why inconsistency with the above? (we are looking on this with @cstyan regarding Prometheus PRW 2.0 handler.

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.

Mimir rejects samples when exemplar is non-compliant
6 participants