-
Notifications
You must be signed in to change notification settings - Fork 115
Make sidecar fluentbit chunk size configurable #573
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
13404a0
changes
rashmichandrashekar 57b7d84
changes
rashmichandrashekar 279073c
changes
rashmichandrashekar 434370d
changes
rashmichandrashekar 0f89133
telemetry changes
rashmichandrashekar abc64f6
merging from ci_dev
rashmichandrashekar ab352cd
fixing merge issue
rashmichandrashekar 80655f8
convert to string
rashmichandrashekar aaf72cd
adding comments
rashmichandrashekar 97c9a1e
reverting changes
rashmichandrashekar 69f0a72
doc update
rashmichandrashekar 0bd136f
formatting
rashmichandrashekar a06458b
doc link update
rashmichandrashekar 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
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,26 @@ | ||
| ## Configurable agent settings for high scale prometheus metric scraping using pod annotations with prometheus sidecar. | ||
|
|
||
| Container Insights agent runs native prometheus telegraf plugin to scrape prometheus metrics using pod annotations. | ||
| The metrics scraped from the telegraf plugin are sent to the fluent bit tcp listener. | ||
| In order to support higher volumes of prometheus metrics scraping some of the tcp listener settings can be tuned. | ||
| [Fluent Bit TCP listener](https://docs.fluentbit.io/manual/pipeline/inputs/tcp) | ||
|
|
||
| * Chunk Size - This can be increased to process bigger chunks of data. | ||
|
|
||
| * Buffer Size - This should be greater than or equal to the chunk size. | ||
|
|
||
| * Mem Buf Limit - This can be increased to increase the buffer size. But the memory limit on the sidecar also needs to be increased accordingly. | ||
| Note that this can only be achieved using helm chart today. | ||
|
|
||
|
|
||
| ** Note - The LA ingestion team also states that higher chunk sizes might not necessarily mean higher throughput since there are pipeline limitations. | ||
|
|
||
| ``` | ||
| agent-settings: |- | ||
| # prometheus scrape fluent bit settings for high scale | ||
| # buffer size should be greater than or equal to chunk size else we set it to chunk size. | ||
| [agent_settings.prometheus_fbit_settings] | ||
| tcp_listener_chunk_size = 10 | ||
| tcp_listener_buffer_size = 10 | ||
| tcp_listener_mem_buf_limit = 200 | ||
| ``` |
102 changes: 102 additions & 0 deletions
102
build/common/installer/scripts/tomlparser-prom-agent-config.rb
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,102 @@ | ||
| #!/usr/local/bin/ruby | ||
|
|
||
| #this should be require relative in Linux and require in windows, since it is a gem install on windows | ||
| @os_type = ENV["OS_TYPE"] | ||
| if !@os_type.nil? && !@os_type.empty? && @os_type.strip.casecmp("windows") == 0 | ||
| require "tomlrb" | ||
| else | ||
| require_relative "tomlrb" | ||
| end | ||
|
|
||
| require_relative "ConfigParseErrorLogger" | ||
|
|
||
| @configMapMountPath = "/etc/config/settings/agent-settings" | ||
| @configSchemaVersion = "" | ||
|
|
||
| @promFbitChunkSize = 10 | ||
| @promFbitBufferSize = 10 | ||
| @promFbitMemBufLimit = 200 | ||
|
|
||
| def is_number?(value) | ||
| true if Integer(value) rescue false | ||
| end | ||
|
|
||
| # Use parser to parse the configmap toml file to a ruby structure | ||
| def parseConfigMap | ||
| begin | ||
| # Check to see if config map is created | ||
| if (File.file?(@configMapMountPath)) | ||
| puts "config::configmap container-azm-ms-agentconfig for sidecar agent settings mounted, parsing values" | ||
| parsedConfig = Tomlrb.load_file(@configMapMountPath, symbolize_keys: true) | ||
| puts "config::Successfully parsed mounted config map" | ||
| return parsedConfig | ||
| else | ||
| puts "config::configmap container-azm-ms-agentconfig for sidecar agent settings not mounted, using defaults" | ||
| return nil | ||
| end | ||
| rescue => errorStr | ||
| ConfigParseErrorLogger.logError("Exception while parsing config map for sidecar agent settings : #{errorStr}, using defaults, please check config map for errors") | ||
| return nil | ||
| end | ||
| end | ||
|
|
||
| # Use the ruby structure created after config parsing to set the right values to be used as environment variables | ||
| def populateSettingValuesFromConfigMap(parsedConfig) | ||
| begin | ||
| if !parsedConfig.nil? && !parsedConfig[:agent_settings].nil? | ||
| # fbit config settings | ||
| prom_fbit_config = parsedConfig[:agent_settings][:prometheus_fbit_settings] | ||
| if !prom_fbit_config.nil? | ||
| chunk_size = prom_fbit_config[:tcp_listener_chunk_size] | ||
| if !chunk_size.nil? && is_number?(chunk_size) && chunk_size.to_i > 0 | ||
| @promFbitChunkSize = chunk_size.to_i | ||
| puts "Using config map value: AZMON_SIDECAR_FBIT_CHUNK_SIZE = #{@promFbitChunkSize.to_s + "m"}" | ||
| end | ||
| buffer_size = prom_fbit_config[:tcp_listener_buffer_size] | ||
| if !buffer_size.nil? && is_number?(buffer_size) && buffer_size.to_i > 0 | ||
| @promFbitBufferSize = buffer_size.to_i | ||
| puts "Using config map value: AZMON_SIDECAR_FBIT_BUFFER_SIZE = #{@promFbitBufferSize.to_s + "m"}" | ||
| if @promFbitBufferSize < @promFbitChunkSize | ||
| @promFbitBufferSize = @promFbitChunkSize | ||
| puts "Setting Fbit buffer size equal to chunk size since it is set to less than chunk size - AZMON_SIDECAR_FBIT_BUFFER_SIZE = #{@promFbitBufferSize.to_s + "m"}" | ||
| end | ||
| end | ||
| mem_buf_limit = prom_fbit_config[:tcp_listener_mem_buf_limit] | ||
| if !mem_buf_limit.nil? && is_number?(mem_buf_limit) && mem_buf_limit.to_i > 0 | ||
| @promFbitMemBufLimit = mem_buf_limit.to_i | ||
| puts "Using config map value: AZMON_SIDECAR_FBIT_MEM_BUF_LIMIT = #{@promFbitMemBufLimit.to_s + "m"}" | ||
| end | ||
| end | ||
| end | ||
| rescue => errorStr | ||
| puts "config::error:Exception while reading config settings for sidecar agent configuration setting - #{errorStr}, using defaults" | ||
| end | ||
| end | ||
|
|
||
| @configSchemaVersion = ENV["AZMON_AGENT_CFG_SCHEMA_VERSION"] | ||
| puts "****************Start Sidecar Agent Config Processing********************" | ||
| if !@configSchemaVersion.nil? && !@configSchemaVersion.empty? && @configSchemaVersion.strip.casecmp("v1") == 0 #note v1 is the only supported schema version , so hardcoding it | ||
| configMapSettings = parseConfigMap | ||
| if !configMapSettings.nil? | ||
| populateSettingValuesFromConfigMap(configMapSettings) | ||
| end | ||
| else | ||
| if (File.file?(@configMapMountPath)) | ||
| ConfigParseErrorLogger.logError("config::unsupported/missing config schema version - '#{@configSchemaVersion}' , using defaults, please use supported schema version") | ||
| end | ||
| @enable_health_model = false | ||
| end | ||
|
|
||
| # Write the settings to file, so that they can be set as environment variables | ||
| file = File.open("side_car_fbit_config_env_var", "w") | ||
|
|
||
| if !file.nil? | ||
| file.write("export AZMON_SIDECAR_FBIT_CHUNK_SIZE=#{@promFbitChunkSize.to_s + "m"}\n") | ||
| file.write("export AZMON_SIDECAR_FBIT_BUFFER_SIZE=#{@promFbitBufferSize.to_s + "m"}\n") | ||
| file.write("export AZMON_SIDECAR_FBIT_MEM_BUF_LIMIT=#{@promFbitMemBufLimit.to_s + "m"}\n") | ||
| # Close file after writing all environment variables | ||
| file.close | ||
| else | ||
| puts "Exception while opening file for writing config environment variables" | ||
| puts "****************End Sidecar Agent Config Processing********************" | ||
| end |
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
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
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.