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

app/vmagent/remotewrite: skip sending empty block to downstream server #6241

Merged
merged 13 commits into from
May 17, 2024

Conversation

viperstars
Copy link
Contributor

@viperstars viperstars commented May 8, 2024

Describe Your Changes

Occasionally, vmagent sends empty blocks to downstream servers. If a downstream server returns an unexpected response, vmagent gets stuck in a retry loop. While vmagent handles 400 and 409 errors, there are various prometheus remote write implementations that return different error codes. For example, vector returns a 422 error. To mitigate the risk of vmagent getting stuck in a retry loop, it is advisable to skip sending empty blocks to downstream servers.

Related logs

2024-04-26T08:21:11.302Z  error  VictoriaMetrics/app/vmagent/remotewrite/client.go:383   unexpected status code received after sending a block with size 0 bytes to "1:secret-url" during retry #1: 422; response body="{\"code\":422,\"message\":\"Failed decompressing payload with snappy decoder.\"}"; re-sending the block in 2.000 seconds
2024-04-26T08:21:11.302Z  error  VictoriaMetrics/app/vmagent/remotewrite/client.go:383   unexpected status code received after sending a block with size 0 bytes to "1:secret-url" during retry #1: 422; response body="{\"code\":422,\"message\":\"Failed decompressing payload with snappy decoder.\"}"; re-sending the block in 2.000 seconds
2024-04-26T08:21:11.303Z  error  VictoriaMetrics/app/vmagent/remotewrite/client.go:383   unexpected status code received after sending a block with size 0 bytes to "1:secret-url" during retry #1: 422; response body="{\"code\":422,\"message\":\"Failed decompressing payload with snappy decoder.\"}"; re-sending the block in 2.000 seconds

Checklist

The following checks are mandatory:

Copy link
Collaborator

@hagen1778 hagen1778 left a comment

Choose a reason for hiding this comment

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

Thanks! See my comments below

app/vmagent/remotewrite/client.go Outdated Show resolved Hide resolved
app/vmagent/remotewrite/client_test.go Outdated Show resolved Hide resolved
@viperstars
Copy link
Contributor Author

I have made some update to fix lint check failure.

Copy link
Collaborator

@hagen1778 hagen1778 left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

Copy link

codecov bot commented May 17, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 55.34%. Comparing base (8aaa828) to head (3b8ca24).
Report is 696 commits behind head on master.

Current head 3b8ca24 differs from pull request most recent head a784711

Please upload reports for the commit a784711 to get more accurate results.

Files Patch % Lines
app/vmagent/remotewrite/client.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6241      +/-   ##
==========================================
- Coverage   60.37%   55.34%   -5.04%     
==========================================
  Files         411      586     +175     
  Lines       76609    77970    +1361     
==========================================
- Hits        46253    43150    -3103     
- Misses      27794    31839    +4045     
- Partials     2562     2981     +419     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

* remove unnecessary log message, since user can't
react on it;
* add note to the changelog.
@hagen1778 hagen1778 merged commit 3661373 into VictoriaMetrics:master May 17, 2024
3 checks passed
hagen1778 pushed a commit that referenced this pull request May 17, 2024
#6241)

Occasionally, vmagent sends empty blocks to downstream servers. If a
downstream server returns an unexpected response, vmagent gets stuck in
a retry loop. While vmagent handles 400 and 409 errors, there are
various prometheus remote write implementations that return different
error codes. For example, vector returns a 422 error. To mitigate the
risk of vmagent getting stuck in a retry loop, it is advisable to skip
sending empty blocks to downstream servers.

Co-authored-by: hao.peng <hao.peng@smartx.com>
Co-authored-by: Zhu Jiekun <jiekun.dev@gmail.com>
Co-authored-by: hagen1778 <roman@victoriametrics.com>
(cherry picked from commit 3661373)
hagen1778 added a commit that referenced this pull request May 17, 2024
#6241)

Occasionally, vmagent sends empty blocks to downstream servers. If a
downstream server returns an unexpected response, vmagent gets stuck in
a retry loop. While vmagent handles 400 and 409 errors, there are
various prometheus remote write implementations that return different
error codes. For example, vector returns a 422 error. To mitigate the
risk of vmagent getting stuck in a retry loop, it is advisable to skip
sending empty blocks to downstream servers.

Co-authored-by: hao.peng <hao.peng@smartx.com>
Co-authored-by: Zhu Jiekun <jiekun.dev@gmail.com>
Co-authored-by: hagen1778 <roman@victoriametrics.com>

(cherry picked from commit 3661373)
Signed-off-by: hagen1778 <roman@victoriametrics.com>
hagen1778 added a commit that referenced this pull request May 17, 2024
#6241)

Occasionally, vmagent sends empty blocks to downstream servers. If a
downstream server returns an unexpected response, vmagent gets stuck in
a retry loop. While vmagent handles 400 and 409 errors, there are
various prometheus remote write implementations that return different
error codes. For example, vector returns a 422 error. To mitigate the
risk of vmagent getting stuck in a retry loop, it is advisable to skip
sending empty blocks to downstream servers.

Co-authored-by: hao.peng <hao.peng@smartx.com>
Co-authored-by: Zhu Jiekun <jiekun.dev@gmail.com>
Co-authored-by: hagen1778 <roman@victoriametrics.com>

(cherry picked from commit 3661373)
Signed-off-by: hagen1778 <roman@victoriametrics.com>
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.

None yet

3 participants