Skip to content

Commit

Permalink
filter: aws tags are not critical
Browse files Browse the repository at this point in the history
allows to inject base metadata group into the logs even if tags were not
fetched

in this version fetching tags will be retried indefinitely with every
flush, where each retry is going to produce error logs

Signed-off-by: Mateusz Warzyński <mateusz@warzynski.pro>
  • Loading branch information
mwarzynski authored and PettitWesley committed May 3, 2024
1 parent 1af82f8 commit 16087f1
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions plugins/filter_aws/aws.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,7 @@ static int get_ec2_metadata_tags(struct flb_filter_aws *ctx)
static int get_ec2_metadata(struct flb_filter_aws *ctx)
{
int ret;
int failures = 0;

if (!ctx->metadata_groups[FLB_FILTER_AWS_METADATA_GROUP_BASE].done) {
ret = get_ec2_metadata_base(ctx);
Expand All @@ -750,16 +751,23 @@ static int get_ec2_metadata(struct flb_filter_aws *ctx)
}

if (!ctx->metadata_groups[FLB_FILTER_AWS_METADATA_GROUP_TAGS].done) {
/* TODO: retries */
/* TODO: retries with Fixed Interval Rate */
/* at the moment it will retry with every flush */
ret = get_ec2_metadata_tags(ctx);

if (ret < 0) {
if (ret == FLB_FILTER_AWS_CONFIGURATION_ERROR) {
return ret;
}
ctx->metadata_groups[FLB_FILTER_AWS_METADATA_GROUP_TAGS].done = FLB_TRUE;
if (ret == 0) {
ctx->metadata_groups[FLB_FILTER_AWS_METADATA_GROUP_TAGS].done = FLB_TRUE;
} else {
failures++;
}
}

if (failures == 0) {
ctx->metadata_retrieved = FLB_TRUE;
}

ctx->metadata_retrieved = FLB_TRUE;
return 0;
}

Expand Down

0 comments on commit 16087f1

Please sign in to comment.