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

[PRW 2.0] write_handler: Support for rc.2 spec & improved error handling for v2. #14427

Merged
merged 7 commits into from
Jul 12, 2024

Conversation

bwplotka
Copy link
Member

@bwplotka bwplotka commented Jul 5, 2024

Fixes: #14359, but also refactors v2 error handling to support partial writes (for non-retriable errors) and adds extensive tests for stats and error handling in general.

errors.Is(err, storage.ErrDuplicateSampleForTimestamp) ||
errors.Is(err, storage.ErrTooOldSample) {
// TODO(bwplotka): Not too spammy log?
level.Error(h.logger).Log("msg", "Out of order sample from remote write", "err", err.Error(), "series", ls.String(), "timestamp", s.Timestamp)
Copy link
Member

Choose a reason for hiding this comment

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

potentially, can we use the dedupe logger here?

Copy link
Member Author

Choose a reason for hiding this comment

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

What's dedupe logger? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, I see

func Dedupe(next log.Logger, repeat time.Duration) *Deduper {

Copy link
Member Author

Choose a reason for hiding this comment

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

since we log timestamp, series etc, this will not help I think.. I would say let's fix in further PRs if this becomes a problem somewhere.

storage/remote/write_handler.go Outdated Show resolved Hide resolved
storage/remote/write_handler.go Outdated Show resolved Hide resolved
storage/remote/write_handler.go Outdated Show resolved Hide resolved
storage/remote/write_handler.go Outdated Show resolved Hide resolved
storage/remote/write_handler.go Show resolved Hide resolved
@bwplotka bwplotka marked this pull request as ready for review July 8, 2024 09:53
@bwplotka bwplotka requested a review from tomwilkie as a code owner July 8, 2024 09:53
@bwplotka bwplotka force-pushed the rw20-err-handling branch 2 times, most recently from a3c47c1 to e133aac Compare July 8, 2024 11:49
Signed-off-by: bwplotka <[email protected]>
storage/remote/write_handler.go Show resolved Hide resolved
storage/remote/codec_test.go Outdated Show resolved Hide resolved
storage/remote/write_handler_test.go Show resolved Hide resolved
storage/remote/write_handler_test.go Outdated Show resolved Hide resolved
storage/remote/write_handler_test.go Show resolved Hide resolved
bwplotka and others added 2 commits July 11, 2024 13:39
if len(badRequestErrs) == 0 {
return samplesWithoutMetadata, 0, nil
}
// TODO(bwplotka): Better concat formatting? Perhaps add size limit?
Copy link
Member Author

@bwplotka bwplotka Jul 11, 2024

Choose a reason for hiding this comment

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

Copy link
Member Author

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Updated!

bwplotka added a commit that referenced this pull request Jul 11, 2024
Chained on top of #14427
Fixes #14359

Signed-off-by: bwplotka <[email protected]>
bwplotka added a commit that referenced this pull request Jul 11, 2024
Chained on top of #14427
Fixes #14359

Signed-off-by: bwplotka <[email protected]>
bwplotka added a commit that referenced this pull request Jul 11, 2024
Chained on top of #14427
Fixes #14359

Signed-off-by: bwplotka <[email protected]>
bwplotka added a commit that referenced this pull request Jul 11, 2024
Chained on top of #14427
Fixes #14359

Signed-off-by: bwplotka <[email protected]>
@bwplotka bwplotka merged commit 0c87643 into main Jul 12, 2024
42 checks passed
@bwplotka bwplotka deleted the rw20-err-handling branch July 12, 2024 07:11
bwplotka added a commit that referenced this pull request Jul 12, 2024
Chained on top of #14427
Fixes #14359

Signed-off-by: bwplotka <[email protected]>
bwplotka added a commit that referenced this pull request Jul 19, 2024
…4444)

* [PRW 2.0] Added Sender support for Response Stats.

Chained on top of #14427
Fixes #14359

Signed-off-by: bwplotka <[email protected]>

* Addressed comments.

Signed-off-by: bwplotka <[email protected]>

* move write stats to it's own file

Signed-off-by: Callum Styan <[email protected]>

* Clean up header usage

Signed-off-by: Callum Styan <[email protected]>

* add missing license to new stats file

Signed-off-by: Callum Styan <[email protected]>

* Addressed all comments.

Signed-off-by: bwplotka <[email protected]>

---------

Signed-off-by: bwplotka <[email protected]>
Signed-off-by: Callum Styan <[email protected]>
Co-authored-by: Callum Styan <[email protected]>
kushalShukla-web pushed a commit to kushalShukla-web/prometheus that referenced this pull request Jul 23, 2024
…ing for v2. (prometheus#14427)

* [PRW 2.0] write_handler: Support for rc.2 spec & improved error handling for v2.

Fixes: prometheus#14359

Signed-off-by: bwplotka <[email protected]>

* Addressed Callum comments.

Signed-off-by: bwplotka <[email protected]>

* Added missing lock on flush.

Signed-off-by: bwplotka <[email protected]>

* Fixed lint.

Signed-off-by: bwplotka <[email protected]>

* Added tests.

Signed-off-by: bwplotka <[email protected]>

* Addressed Callum's comments & updated re spec.

Signed-off-by: bwplotka <[email protected]>

* Update storage/remote/write_handler_test.go

Co-authored-by: Callum Styan <[email protected]>
Signed-off-by: Bartlomiej Plotka <[email protected]>

---------

Signed-off-by: bwplotka <[email protected]>
Signed-off-by: Bartlomiej Plotka <[email protected]>
Co-authored-by: Callum Styan <[email protected]>
Signed-off-by: kushagra Shukla <[email protected]>
kushalShukla-web pushed a commit to kushalShukla-web/prometheus that referenced this pull request Jul 25, 2024
…ing for v2. (prometheus#14427)

* [PRW 2.0] write_handler: Support for rc.2 spec & improved error handling for v2.

Fixes: prometheus#14359

Signed-off-by: bwplotka <[email protected]>

* Addressed Callum comments.

Signed-off-by: bwplotka <[email protected]>

* Added missing lock on flush.

Signed-off-by: bwplotka <[email protected]>

* Fixed lint.

Signed-off-by: bwplotka <[email protected]>

* Added tests.

Signed-off-by: bwplotka <[email protected]>

* Addressed Callum's comments & updated re spec.

Signed-off-by: bwplotka <[email protected]>

* Update storage/remote/write_handler_test.go

Co-authored-by: Callum Styan <[email protected]>
Signed-off-by: Bartlomiej Plotka <[email protected]>

---------

Signed-off-by: bwplotka <[email protected]>
Signed-off-by: Bartlomiej Plotka <[email protected]>
Co-authored-by: Callum Styan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[PRW 2.0 spec] Sample Write Confirmation in Response
2 participants