Skip to content
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

Telemetry gap: Adding missing heartbeat telemetry #1129

Merged
merged 4 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions source/plugins/ruby/in_kube_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def start
$log.warn("Normal kube events collection enabled for cluster")
end
end
@@kubeEventsTelemetryTimeTracker = DateTime.now.to_time.to_i
jatakiajanvi12 marked this conversation as resolved.
Show resolved Hide resolved
end
end

Expand Down Expand Up @@ -141,6 +142,18 @@ def enumerate
if (@eventsCount > 0)
ApplicationInsightsUtility.sendMetricTelemetry("EventCount", @eventsCount, {})
end

# Adding telemetry to send kubevents telemetry every 5 minutes
jatakiajanvi12 marked this conversation as resolved.
Show resolved Hide resolved
timeDifference = (DateTime.now.to_time.to_i - @@kubeEventsTelemetryTimeTracker).abs
timeDifferenceInMinutes = timeDifference / 60
if (timeDifferenceInMinutes >= 5)
telemetryFlush = true
end

if telemetryFlush
ApplicationInsightsUtility.sendCustomEvent("KubeEventsHeartBeatEvent", {})
jatakiajanvi12 marked this conversation as resolved.
Show resolved Hide resolved
@@kubeEventsTelemetryTimeTracker = DateTime.now.to_time.to_i
end
rescue => errorStr
$log.warn "in_kube_events::enumerate:Failed in enumerate: #{errorStr}"
$log.debug_backtrace(errorStr.backtrace)
Expand Down
1 change: 1 addition & 0 deletions source/plugins/ruby/in_kube_nodes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ def enumerate
timeDifference = (DateTime.now.to_time.to_i - @@nodeInventoryLatencyTelemetryTimeTracker).abs
timeDifferenceInMinutes = timeDifference / 60
if (timeDifferenceInMinutes >= @TELEMETRY_FLUSH_INTERVAL_IN_MINUTES)
ApplicationInsightsUtility.sendCustomEvent("KubeNodeInventoryHeartBeatEvent", {})
@applicationInsightsUtility.sendMetricTelemetry("NodeInventoryE2EProcessingLatencyMs", @nodeInventoryE2EProcessingLatencyMs, {})
@applicationInsightsUtility.sendMetricTelemetry("NodesAPIE2ELatencyMs", @nodesAPIE2ELatencyMs, {})
telemetryProperties = {}
Expand Down
13 changes: 13 additions & 0 deletions source/plugins/ruby/in_kube_perfinventory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def start
@podCacheMutex = Mutex.new
@thread = Thread.new(&method(:run_periodic))
@watchPodsThread = Thread.new(&method(:watch_pods))
@@perfTelemetryTimeTracker = DateTime.now.to_time.to_i
jatakiajanvi12 marked this conversation as resolved.
Show resolved Hide resolved
end
end

Expand Down Expand Up @@ -132,6 +133,18 @@ def enumerate(podList = nil)
# Setting these to nil so that we dont hold memory until GC kicks in
podInventory = nil
nodeAllocatableRecords = nil

# Adding telemetry to send perfinventory telemetry every 5 minutes
timeDifference = (DateTime.now.to_time.to_i - @@perfTelemetryTimeTracker).abs
timeDifferenceInMinutes = timeDifference / 60
if (timeDifferenceInMinutes >= 5)
telemetryFlush = true
end

if telemetryFlush
ApplicationInsightsUtility.sendCustomEvent("KubePerfInventoryHeartBeatEvent", {})
jatakiajanvi12 marked this conversation as resolved.
Show resolved Hide resolved
@@perfTelemetryTimeTracker = DateTime.now.to_time.to_i
end
rescue => errorStr
$log.warn "in_kube_perfinventory::enumerate:Failed in enumerate: #{errorStr}"
$log.debug_backtrace(errorStr.backtrace)
Expand Down
1 change: 1 addition & 0 deletions source/plugins/ruby/in_kubestate_deployments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ def enumerate
@@deploymentsCount = @deploymentsRunningTotal
end
if (((DateTime.now.to_time.to_i - @@telemetryLastSentTime).abs) / 60) >= Constants::KUBE_STATE_TELEMETRY_FLUSH_INTERVAL_IN_MINUTES
ApplicationInsightsUtility.sendCustomEvent("KubeStateDeploymentHeartBeatEvent", {})
#send telemetry
$log.info "sending deployemt telemetry..."
ApplicationInsightsUtility.sendMetricTelemetry("MaxDeploymentCount", @@deploymentsCount, {})
Expand Down
13 changes: 13 additions & 0 deletions source/plugins/ruby/in_kubestate_hpa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def start
@condition = ConditionVariable.new
@mutex = Mutex.new
@thread = Thread.new(&method(:run_periodic))
@@kubeStateHPATelemetryTimeTracker = DateTime.now.to_time.to_i
jatakiajanvi12 marked this conversation as resolved.
Show resolved Hide resolved
end
end

Expand Down Expand Up @@ -132,6 +133,18 @@ def enumerate
$log.info("in_kubestate_hpa::hpaCount= #{hpaCount}")
#ApplicationInsightsUtility.sendMetricTelemetry("HPACount", @hpaCount, {})
end

# Adding telemetry to send kubestateHPA telemetry every 5 minutes
timeDifference = (DateTime.now.to_time.to_i - @@kubeStateHPATelemetryTimeTracker).abs
timeDifferenceInMinutes = timeDifference / 60
if (timeDifferenceInMinutes >= 5)
telemetryFlush = true
end

if telemetryFlush
ApplicationInsightsUtility.sendCustomEvent("KubeStateHPAHeartBeatEvent", {})
jatakiajanvi12 marked this conversation as resolved.
Show resolved Hide resolved
@@kubeStateHPATelemetryTimeTracker = DateTime.now.to_time.to_i
end
rescue => errorStr
$log.warn "in_kubestate_hpa::enumerate:Failed in enumerate: #{errorStr}"
ApplicationInsightsUtility.sendExceptionTelemetry("in_kubestate_hpa::enumerate:Failed in enumerate: #{errorStr}")
Expand Down
Loading