-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add simple_aggregation to kinesis/firehose plugins #11284
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
Open
ShelbyZ
wants to merge
6
commits into
fluent:master
Choose a base branch
from
ShelbyZ:simple-aggregation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c44d008
aws: Implement simple_aggregation operation
ShelbyZ 093fb61
tests: aws_aggregation
ShelbyZ 7fd60fe
out_kinesis_firehose: Add simple_aggregation operation
ShelbyZ e87d38d
tests: Add firehose test cases for simple_aggregation operation
ShelbyZ 3fdebf3
out_kinesis_streams: Add simple_aggregation operation
ShelbyZ 72d6eb4
tests: Add kinesis test cases for simple_aggregation operation
ShelbyZ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | ||
|
|
||
| /* Fluent Bit | ||
| * ========== | ||
| * Copyright (C) 2015-2025 The Fluent Bit Authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #ifndef FLB_AWS_AGGREGATION_H | ||
| #define FLB_AWS_AGGREGATION_H | ||
|
|
||
| #include <fluent-bit/flb_output_plugin.h> | ||
| #include <fluent-bit/flb_time.h> | ||
|
|
||
| /* Aggregation buffer structure */ | ||
| struct flb_aws_agg_buffer { | ||
| char *agg_buf; /* aggregated records buffer */ | ||
| size_t agg_buf_size; /* total size of aggregation buffer */ | ||
| size_t agg_buf_offset; /* current offset in aggregation buffer */ | ||
| }; | ||
|
|
||
| /* Initialize aggregation buffer | ||
| * Returns: | ||
| * 0 = success | ||
| * -1 = error | ||
| */ | ||
| int flb_aws_aggregation_init(struct flb_aws_agg_buffer *buf, size_t max_record_size); | ||
|
|
||
| /* Destroy aggregation buffer */ | ||
| void flb_aws_aggregation_destroy(struct flb_aws_agg_buffer *buf); | ||
|
|
||
| /* Try to add event data to aggregation buffer | ||
| * Returns: | ||
| * 0 = success, event added to aggregation buffer | ||
| * 1 = buffer full, caller should finalize and retry | ||
| */ | ||
| int flb_aws_aggregation_add(struct flb_aws_agg_buffer *buf, | ||
| const char *data, size_t data_len, | ||
| size_t max_record_size); | ||
|
|
||
| /* Finalize aggregated record | ||
| * Returns: | ||
| * 0 = success | ||
| * -1 = error (no data to finalize) | ||
| * | ||
| * Output is written to buf->agg_buf and the size is returned via out_size parameter | ||
| */ | ||
| int flb_aws_aggregation_finalize(struct flb_aws_agg_buffer *buf, | ||
| int add_final_newline, | ||
| size_t *out_size); | ||
|
|
||
| /* Reset aggregation buffer for reuse */ | ||
| void flb_aws_aggregation_reset(struct flb_aws_agg_buffer *buf); | ||
|
|
||
| /* Process event with simple aggregation | ||
| * Converts msgpack to JSON, optionally adds log_key and time_key, | ||
| * then adds to aggregation buffer | ||
| * | ||
| * Returns: | ||
| * -1 = failure, record not added | ||
| * 0 = success, record added | ||
| * 1 = buffer full, caller should finalize and retry | ||
| * 2 = record could not be processed, discard it | ||
| */ | ||
| int flb_aws_aggregation_process_event(struct flb_aws_agg_buffer *agg_buf, | ||
| char *tmp_buf, | ||
| size_t tmp_buf_size, | ||
| size_t *tmp_buf_offset, | ||
| const msgpack_object *obj, | ||
| struct flb_time *tms, | ||
| struct flb_config *config, | ||
| struct flb_output_instance *ins, | ||
| const char *stream_name, | ||
| const char *log_key, | ||
| const char *time_key, | ||
| const char *time_key_format, | ||
| size_t max_event_size); | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.