Skip to content

Commit e14c40d

Browse files
TradunskyTradunsky
authored and
Tradunsky
committed
ISSUE 9670: Adds AWS credentials refresh to out_prometheus_remote_write
Signed-off-by: Tradunsky <[email protected]>
1 parent d77c06d commit e14c40d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

plugins/out_prometheus_remote_write/remote_write.c

+10-3
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,13 @@ static int http_post(struct prometheus_remote_write_context *ctx,
183183
* - 200: OK
184184
* - 201: Created
185185
* - 202: Accepted
186-
* - 203: no authorative resp
186+
* - 203: no authoritative resp
187187
* - 204: No Content
188188
* - 205: Reset content
189189
*
190190
*/
191191
if ((c->resp.status < 200 || c->resp.status > 205) &&
192-
c->resp.status != 400) {
192+
c->resp.status != 400 && c->resp.status != 403) {
193193
if (ctx->log_response_payload &&
194194
c->resp.payload && c->resp.payload_size > 0) {
195195
flb_plg_error(ctx->ins, "%s:%i, HTTP status=%i\n%s",
@@ -203,7 +203,7 @@ static int http_post(struct prometheus_remote_write_context *ctx,
203203
out_ret = FLB_RETRY;
204204
}
205205
else if (c->resp.status == 400) {
206-
/* Returned 400 status means unrecoverable. Immidiately
206+
/* Returned 400 status means unrecoverable. Immediately
207207
* returning as a error. */
208208
if (ctx->log_response_payload &&
209209
c->resp.payload && c->resp.payload_size > 0) {
@@ -217,6 +217,13 @@ static int http_post(struct prometheus_remote_write_context *ctx,
217217
}
218218
out_ret = FLB_ERROR;
219219
}
220+
else if (c->resp.status == 403) {
221+
if (ctx->has_aws_auth == FLB_TRUE) {
222+
flb_plg_info(ctx->ins, "auth error, refreshing creds");
223+
ctx->aws_provider->provider_vtable->refresh(ctx->aws_provider);
224+
}
225+
out_ret = FLB_RETRY;
226+
}
220227
else {
221228
if (ctx->log_response_payload &&
222229
c->resp.payload && c->resp.payload_size > 0) {

0 commit comments

Comments
 (0)