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

ISSUE 9670: Adds AWS credentials refresh to out_prometheus_remote_write #9765

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions plugins/out_prometheus_remote_write/remote_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,13 @@ static int http_post(struct prometheus_remote_write_context *ctx,
* - 200: OK
* - 201: Created
* - 202: Accepted
* - 203: no authorative resp
* - 203: no authoritative resp
* - 204: No Content
* - 205: Reset content
*
*/
if ((c->resp.status < 200 || c->resp.status > 205) &&
c->resp.status != 400) {
c->resp.status != 400 && c->resp.status != 403) {
if (ctx->log_response_payload &&
c->resp.payload && c->resp.payload_size > 0) {
flb_plg_error(ctx->ins, "%s:%i, HTTP status=%i\n%s",
Expand All @@ -203,7 +203,7 @@ static int http_post(struct prometheus_remote_write_context *ctx,
out_ret = FLB_RETRY;
}
else if (c->resp.status == 400) {
/* Returned 400 status means unrecoverable. Immidiately
/* Returned 400 status means unrecoverable. Immediately
* returning as a error. */
if (ctx->log_response_payload &&
c->resp.payload && c->resp.payload_size > 0) {
Expand All @@ -217,6 +217,13 @@ static int http_post(struct prometheus_remote_write_context *ctx,
}
out_ret = FLB_ERROR;
}
else if (c->resp.status == 403) {
if (ctx->has_aws_auth == FLB_TRUE) {
flb_plg_info(ctx->ins, "auth error, refreshing creds");
ctx->aws_provider->provider_vtable->refresh(ctx->aws_provider);
}
out_ret = FLB_RETRY;
}
else {
if (ctx->log_response_payload &&
c->resp.payload && c->resp.payload_size > 0) {
Expand Down