Class: Puma::Plugin::Telemetry::Targets::BaseFormattingTarget

Inherits:
Object
  • Object
show all
Defined in:
lib/puma/plugin/telemetry/targets/base_formatting_target.rb

Overview

A base class for other Targets concerned with formatting telemetry

Direct Known Subclasses

IOTarget

Instance Method Summary collapse

Constructor Details

#initialize(formatter: :json, transform: :cloud_watch) ⇒ BaseFormattingTarget

Returns a new instance of BaseFormattingTarget.



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/puma/plugin/telemetry/targets/base_formatting_target.rb', line 14

def initialize(formatter: :json, transform: :cloud_watch)
  @transform = case transform
               when :cloud_watch then Transforms::CloudWatchTransform
               when :passthrough then Transforms::PassthroughTransform
               else transform
               end
  @formatter = case formatter
               when :json then Formatters::JSONFormatter
               when :passthrough then Formatters::PassthroughFormatter
               else formatter
               end
end

Instance Method Details

#call(_telemetry) ⇒ Object

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/puma/plugin/telemetry/targets/base_formatting_target.rb', line 27

def call(_telemetry)
  raise NotImplementedError, "#{__method__} must be implemented by #{self.class.name}"
end