Skip to content

Commit 4c71b9a

Browse files
committed
address comments adding telemetry for throttle
1 parent 60257a4 commit 4c71b9a

File tree

5 files changed

+61
-35
lines changed

5 files changed

+61
-35
lines changed

build/common/installer/scripts/tomlparser-agent-config.rb

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@
104104
@waittime_port_13000 = 45 # default waittime for AMACA data port
105105
@waittime_port_12563 = 45 # default waittime for AMACA config port
106106

107-
@netoworkFlowLogsThrottleRate = 1000
108-
@netoworkFlowLogsThrottleWindow = 300
109-
@netoworkFlowLogsThrottleInterval = "1s"
110-
@netoworkFlowLogsThrottlePrint = false
107+
@networkFlowLogsThrottleRate = 1000
108+
@networkFlowLogsThrottleWindow = 300
109+
@networkFlowLogsThrottleInterval = "1s"
110+
@networkFlowLogsThrottlePrint = false
111111

112112
def is_number?(value)
113113
true if Integer(value) rescue false
@@ -195,25 +195,25 @@ def populateSettingValuesFromConfigMap(parsedConfig)
195195
# networkflow logs settings
196196
networkflow_logs_config = parsedConfig[:agent_settings][:networkflow_logs_config]
197197
if !networkflow_logs_config.nil?
198-
netoworkFlowLogsThrottleRate = networkflow_logs_config[:throttle_rate]
199-
if is_valid_number?(netoworkFlowLogsThrottleRate)
200-
@netoworkFlowLogsThrottleRate = netoworkFlowLogsThrottleRate.to_i
201-
puts "Using config map value: networkflow logs throttle_rate = #{@netoworkFlowLogsThrottleRate}"
202-
end
203-
netoworkFlowLogsThrottleWindow = networkflow_logs_config[:throttle_window]
204-
if is_valid_number?(netoworkFlowLogsThrottleWindow)
205-
@netoworkFlowLogsThrottleWindow = netoworkFlowLogsThrottleWindow.to_i
206-
puts "Using config map value: networkflow logsthrottle_window = #{@netoworkFlowLogsThrottleWindow}"
207-
end
208-
netoworkFlowLogsThrottleInterval = networkflow_logs_config[:throttle_interval]
209-
if !netoworkFlowLogsThrottleInterval.nil? && !netoworkFlowLogsThrottleInterval.empty?
210-
@netoworkFlowLogsThrottleInterval = netoworkFlowLogsThrottleInterval
211-
puts "Using config map value: networkflow logs throttle_interval = #{@netoworkFlowLogsThrottleInterval}"
212-
end
213-
netoworkFlowLogsThrottlePrint = networkflow_logs_config[:throttle_print]
214-
if !netoworkFlowLogsThrottlePrint.nil? && netoworkFlowLogsThrottlePrint.downcase == "true"
215-
@netoworkFlowLogsThrottlePrint = true
216-
puts "Using config map value: networkflow logs throttle_print = #{@netoworkFlowLogsThrottlePrint}"
198+
networkFlowLogsThrottleRate = networkflow_logs_config[:throttle_rate]
199+
if is_valid_number?(networkFlowLogsThrottleRate)
200+
@networkFlowLogsThrottleRate = networkFlowLogsThrottleRate.to_i
201+
puts "Using config map value: networkflow logs throttle_rate = #{@networkFlowLogsThrottleRate}"
202+
end
203+
networkFlowLogsThrottleWindow = networkflow_logs_config[:throttle_window]
204+
if is_valid_number?(networkFlowLogsThrottleWindow)
205+
@networkFlowLogsThrottleWindow = networkFlowLogsThrottleWindow.to_i
206+
puts "Using config map value: networkflow logsthrottle_window = #{@networkFlowLogsThrottleWindow}"
207+
end
208+
networkFlowLogsThrottleInterval = networkflow_logs_config[:throttle_interval]
209+
if !networkFlowLogsThrottleInterval.nil? && !networkFlowLogsThrottleInterval.empty?
210+
@networkFlowLogsThrottleInterval = networkFlowLogsThrottleInterval
211+
puts "Using config map value: networkflow logs throttle_interval = #{@networkFlowLogsThrottleInterval}"
212+
end
213+
networkFlowLogsThrottlePrint = networkflow_logs_config[:throttle_print]
214+
if !networkFlowLogsThrottlePrint.nil? && networkFlowLogsThrottlePrint.downcase == "true"
215+
@networkFlowLogsThrottlePrint = true
216+
puts "Using config map value: networkflow logs throttle_print = #{@networkFlowLogsThrottlePrint}"
217217
end
218218
end
219219

@@ -464,10 +464,10 @@ def populateSettingValuesFromConfigMap(parsedConfig)
464464
file.write("export NODES_EMIT_STREAM_BATCH_SIZE=#{@nodesEmitStreamBatchSize}\n")
465465

466466
# networkflow logs settings
467-
file.write("export NETWORKFLOW_LOGS_THROTTLE_RATE=#{@netoworkFlowLogsThrottleRate}\n")
468-
file.write("export NETWORKFLOW_LOGS_THROTTLE_WINDOW=#{@netoworkFlowLogsThrottleWindow}\n")
469-
file.write("export NETWORKFLOW_LOGS_THROTTLE_INTERVAL=#{@netoworkFlowLogsThrottleInterval}\n")
470-
file.write("export NETWORKFLOW_LOGS_THROTTLE_PRINT=#{@netoworkFlowLogsThrottlePrint}\n")
467+
file.write("export NETWORKFLOW_LOGS_THROTTLE_RATE=#{@networkFlowLogsThrottleRate}\n")
468+
file.write("export NETWORKFLOW_LOGS_THROTTLE_WINDOW=#{@networkFlowLogsThrottleWindow}\n")
469+
file.write("export NETWORKFLOW_LOGS_THROTTLE_INTERVAL=#{@networkFlowLogsThrottleInterval}\n")
470+
file.write("export NETWORKFLOW_LOGS_THROTTLE_PRINT=#{@networkFlowLogsThrottlePrint}\n")
471471

472472
# fbit settings
473473
file.write("export ENABLE_FBIT_INTERNAL_METRICS=#{@enableFbitInternalMetrics}\n")

kubernetes/container-azm-ms-agentconfig.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ data:
181181
# [agent_settings.networkflow_logs_config]
182182
# throttle_rate = 1000 # By default is 1000 and adjust this to control the amount of messages for the time.
183183
# throttle_window = 300 # By default is 300 and adjust this to control the amount of intervals to calculate average over.
184-
# throttle_interval = 1 # By default is 1 and adjust this to control time interval, expressed in "sleep" format. e.g 3s, 1.5m, 0.5h etc..
184+
# throttle_interval = 1s # By default is 1s and adjust this to control time interval, expressed in "sleep" format. e.g 3s, 1.5m, 0.5h etc..
185185
# throttle_print = false # By default is false and adjust this to control whether to print status messages with current rate and the limits to information logs.
186186
187187
# prometheus scrape fluent bit settings for high scale

source/plugins/go/input/lib/cadvisor.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,18 @@ func getContainerCpuMetricItems(metricInfo map[string]interface{}, hostName, met
10771077
if len(os.Getenv("AZMON_RETINA_FLOW_LOGS_ENABLED")) > 0 {
10781078
telemetryProps["networkFlowLogsEnabled"] = os.Getenv("AZMON_RETINA_FLOW_LOGS_ENABLED")
10791079
}
1080+
if len(os.Getenv("NETWORKFLOW_LOGS_THROTTLE_RATE")) > 0 {
1081+
telemetryProps["networkFlowLogsThrottleRate"] = os.Getenv("NETWORKFLOW_LOGS_THROTTLE_RATE")
1082+
}
1083+
if len(os.Getenv("NETWORKFLOW_LOGS_THROTTLE_WINDOW")) > 0 {
1084+
telemetryProps["networkFlowLogsThrottleWindow"] = os.Getenv("NETWORKFLOW_LOGS_THROTTLE_WINDOW")
1085+
}
1086+
if len(os.Getenv("NETWORKFLOW_LOGS_THROTTLE_INTERVAL")) > 0 {
1087+
telemetryProps["networkFlowLogsThrottleInterval"] = os.Getenv("NETWORKFLOW_LOGS_THROTTLE_INTERVAL")
1088+
}
1089+
if len(os.Getenv("NETWORKFLOW_LOGS_THROTTLE_PRINT")) > 0 {
1090+
telemetryProps["networkFlowLogsThrottlePrint"] = os.Getenv("NETWORKFLOW_LOGS_THROTTLE_PRINT")
1091+
}
10801092
if len(os.Getenv("AZMON_KUBERNETES_METADATA_ENABLED")) > 0 {
10811093
telemetryProps["metadataEnabled"] = os.Getenv("AZMON_KUBERNETES_METADATA_ENABLED")
10821094
}

source/plugins/go/src/network_flow_logs.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type NetworkFlowMsgPackEntry struct {
3939

4040
// PostNetworkFlowRecords sends data to the mdsd and amacoreagent
4141
func PostNetworkFlowRecords(tailPluginRecords []map[interface{}]interface{}) int {
42-
if IsNetworkFlowLogsEnabled {
42+
if IsNetworkFlowLogsEnabled && IsAADMSIAuthMode {
4343
start := time.Now()
4444
var elapsed time.Duration
4545
var bts int
@@ -74,12 +74,10 @@ func PostNetworkFlowRecords(tailPluginRecords []map[interface{}]interface{}) int
7474
}
7575

7676
if len(networkFlowLogsMsgPackEntries) > 0 {
77-
if IsAADMSIAuthMode == true {
78-
MdsdNetworkFlowLogsStreamTagName = getOutputStreamIdTag(RetinaNetworkFlowLogsStreamName, MdsdNetworkFlowLogsStreamTagName, &NetworkFlowTagRefreshTracker)
79-
if MdsdNetworkFlowLogsStreamTagName == "" {
80-
Log("Error::mdsd::Failed to get stream tag for networkflow logs. Will retry ...")
81-
return output.FLB_RETRY
82-
}
77+
MdsdNetworkFlowLogsStreamTagName = getOutputStreamIdTag(RetinaNetworkFlowLogsStreamName, MdsdNetworkFlowLogsStreamTagName, &NetworkFlowTagRefreshTracker)
78+
if MdsdNetworkFlowLogsStreamTagName == "" {
79+
Log("Error::mdsd::Failed to get stream tag for networkflow logs. Will retry ...")
80+
return output.FLB_RETRY
8381
}
8482
if MdsdNetworkFlowClient == nil {
8583
Log("Error::mdsd::mdsd connection does not exist for networkflow mdsd client. re-connecting ...")

source/plugins/ruby/CAdvisorMetricsAPIClient.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ class CAdvisorMetricsAPIClient
2828
@clusterContainerLogSchemaVersion = ENV["AZMON_CONTAINER_LOG_SCHEMA_VERSION"]
2929
@clusterMultilineEnabled = ENV["AZMON_MULTILINE_ENABLED"]
3030
@clusterNetworkFlowLogsEnabled = ENV["AZMON_RETINA_FLOW_LOGS_ENABLED"]
31+
@clusterNetworkFlowLogsThrottleRate = ENV["NETWORKFLOW_LOGS_THROTTLE_RATE"]
32+
@clusterNetworkFlowLogsThrottleWindow = ENV["NETWORKFLOW_LOGS_THROTTLE_WINDOW"]
33+
@clusterNetworkFlowLogsThrottleInterval = ENV["NETWORKFLOW_LOGS_THROTTLE_INTERVAL"]
34+
@clusterNetworkFlowLogsThrottlePrint = ENV["NETWORKFLOW_LOGS_THROTTLE_PRINT"]
3135
@clusterMultilineLanguages = ENV["AZMON_MULTILINE_LANGUAGES"]
3236
@clusterKubernetesMetadataEnabled = ENV["AZMON_KUBERNETES_METADATA_ENABLED"]
3337
@clusterKubernetesMetadataIncludeFields = ENV["AZMON_KUBERNETES_METADATA_INCLUDES_FIELDS"]
@@ -317,6 +321,18 @@ def getContainerCpuMetricItems(metricJSON, hostName, cpuMetricNameToCollect, met
317321
if (!clusterNetworkFlowLogsEnabled.nil? && !@clusterNetworkFlowLogsEnabled.empty?)
318322
telemetryProps["networkFlowLogsEnabled"] = @clusterNetworkFlowLogsEnabled
319323
end
324+
if (!@clusterNetworkFlowLogsThrottleRate.nil? && !@clusterNetworkFlowLogsThrottleRate.empty?)
325+
telemetryProps["networkFlowLogsThrottleRate"] = @clusterNetworkFlowLogsThrottleRate
326+
end
327+
if (!@clusterNetworkFlowLogsThrottleWindow.nil? && !@clusterNetworkFlowLogsThrottleWindow.empty?)
328+
telemetryProps["networkFlowLogsThrottleWindow"] = @clusterNetworkFlowLogsThrottleWindow
329+
end
330+
if (!@clusterNetworkFlowLogsThrottleInterval.nil? && !@clusterNetworkFlowLogsThrottleInterval.empty?)
331+
telemetryProps["networkFlowLogsThrottleInterval"] = @clusterNetworkFlowLogsThrottleInterval
332+
end
333+
if (!@clusterNetworkFlowLogsThrottlePrint.nil? && !@clusterNetworkFlowLogsThrottlePrint.empty?)
334+
telemetryProps["networkFlowLogsThrottlePrint"] = @clusterNetworkFlowLogsThrottlePrint
335+
end
320336
if (!@clusterKubernetesMetadataEnabled.nil? && !@clusterKubernetesMetadataEnabled.empty?)
321337
telemetryProps["metadataEnabled"] = @clusterKubernetesMetadataEnabled
322338
end

0 commit comments

Comments
 (0)