Skip to content

Commit

Permalink
Fix: Don't include "enabled" metadata with adapters (#193)
Browse files Browse the repository at this point in the history
This data can change depending on whether the reporter process is running on a "redundant instance", so it's misleading to report it as metadata.
  • Loading branch information
adamlogic committed Jan 25, 2024
1 parent d6ae321 commit ff6a560
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
11 changes: 1 addition & 10 deletions judoscale-ruby/lib/judoscale-ruby.rb
Expand Up @@ -21,17 +21,8 @@ class << self
end

class Adapter < Struct.new(:identifier, :adapter_info, :metrics_collector)
attr_accessor :enabled

def initialize(identifier, adapter_info, metrics_collector)
super
self.enabled = false
end

def as_json
{
identifier => adapter_info.merge(enabled: enabled)
}
{identifier => adapter_info}
end
end

Expand Down
4 changes: 1 addition & 3 deletions judoscale-ruby/lib/judoscale/reporter.rb
Expand Up @@ -25,9 +25,7 @@ def start!(config, adapters)
end

enabled_adapters, skipped_adapters = adapters.partition { |adapter|
if adapter.metrics_collector&.collect?(config)
adapter.enabled = true
end
adapter.metrics_collector&.collect?(config)
}
metrics_collectors_classes = enabled_adapters.map(&:metrics_collector)
adapters_msg = enabled_adapters.map(&:identifier).concat(
Expand Down

0 comments on commit ff6a560

Please sign in to comment.