Class: Gitlab::Usage::ServicePing::InstrumentedPayload

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/usage/service_ping/instrumented_payload.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(metrics_key_paths, output_method) ⇒ InstrumentedPayload

Returns a new instance of InstrumentedPayload.



12
13
14
15
# File 'lib/gitlab/usage/service_ping/instrumented_payload.rb', line 12

def initialize(metrics_key_paths, output_method)
  @metrics_key_paths = metrics_key_paths
  @output_method = output_method
end

Instance Attribute Details

#metrics_key_pathsObject (readonly)

Returns the value of attribute metrics_key_paths.



9
10
11
# File 'lib/gitlab/usage/service_ping/instrumented_payload.rb', line 9

def metrics_key_paths
  @metrics_key_paths
end

#output_methodObject (readonly)

Returns the value of attribute output_method.



10
11
12
# File 'lib/gitlab/usage/service_ping/instrumented_payload.rb', line 10

def output_method
  @output_method
end

Instance Method Details

#buildObject



17
18
19
20
21
# File 'lib/gitlab/usage/service_ping/instrumented_payload.rb', line 17

def build
  metrics_key_paths.map do |key_path|
    compute_instrumental_value(key_path, output_method)
  end.reduce({}, :deep_merge)
end