9
9
require_relative "../api/summary_metrics"
10
10
11
11
class MetricsProcessor < Closeable
12
+ GLOBAL_TARGET = Target . new ( identifier : "__global__cf_target" , name : "Global Target" ) . freeze
12
13
13
14
class FrequencyMap < Concurrent ::Map
14
15
def initialize ( options = nil , &block )
@@ -66,7 +67,6 @@ def init(connector, config, callback)
66
67
@target_attribute = "target"
67
68
@global_target_identifier = "__global__cf_target" # <--- This target identifier is used to aggregate and send data for all
68
69
# targets as a summary
69
- @global_target = Target . new ( "RubySDK1" , identifier = @global_target_identifier , name = @global_target_name )
70
70
@ready = false
71
71
@jar_version = Ff ::Ruby ::Server ::Sdk ::VERSION
72
72
@server = "server"
@@ -129,8 +129,8 @@ def register_evaluation_metric(feature_config, variation)
129
129
return
130
130
end
131
131
132
- if @global_target . nil? || !@global_target . respond_to? ( :identifier ) || @global_target . identifier . nil?
133
- @config . logger . warn ( "Skipping invalid MetricsEvent: global_target is missing or incomplete. global_target=#{ @global_target . inspect } " )
132
+ if GLOBAL_TARGET . nil? || !GLOBAL_TARGET . respond_to? ( :identifier ) || GLOBAL_TARGET . identifier . nil?
133
+ @config . logger . warn ( "Skipping invalid MetricsEvent: global_target is missing or incomplete. global_target=#{ GLOBAL_TARGET . inspect } " )
134
134
return
135
135
end
136
136
@@ -148,7 +148,7 @@ def register_evaluation_metric(feature_config, variation)
148
148
return
149
149
end
150
150
151
- event = MetricsEvent . new ( feature_config , @global_target , variation , @config . logger )
151
+ event = MetricsEvent . new ( feature_config , GLOBAL_TARGET , variation , @config . logger )
152
152
@evaluation_metrics . increment event
153
153
end
154
154
0 commit comments