Skip to content

Commit

Permalink
Improve performance of capture_ems_targets
Browse files Browse the repository at this point in the history
For Kubernetes type providers if the ems has metrics credentials then
all instances of container_nodes, container_groups, etc... supports
capture.

We don't have to check `.supporting(:capture)` if we are in a kubernetes
provider, but this isn't generally true so only implement this behavior
in k8s.
  • Loading branch information
agrare committed Jun 14, 2023
1 parent ba04739 commit 1d48e80
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ def capture_ems_targets(_options = {})
return []
end

super
MiqPreloader.preload([ems], :container_images => :tags, :container_nodes => :tags, :container_groups => [:tags, :containers => :tags])

with_archived(ems.all_container_nodes) +
with_archived(ems.all_container_groups) +
with_archived(ems.all_containers) +
with_archived(ems.container_images)
end

def prometheus_capture_context(target, start_time, end_time)
Expand Down

0 comments on commit 1d48e80

Please sign in to comment.