Class: Temporalio::Internal::Metric::Meter

Inherits:
Metric::Meter show all
Defined in:
lib/temporalio/internal/metric.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Metric::Meter

null

Constructor Details

#initialize(bridge, bridge_attrs) ⇒ Meter

rubocop:disable Lint/MissingSuper



48
49
50
51
# File 'lib/temporalio/internal/metric.rb', line 48

def initialize(bridge, bridge_attrs) # rubocop:disable Lint/MissingSuper
  @bridge = bridge
  @bridge_attrs = bridge_attrs
end

Class Method Details

.create_from_runtime(runtime) ⇒ Object



41
42
43
44
45
46
# File 'lib/temporalio/internal/metric.rb', line 41

def self.create_from_runtime(runtime)
  bridge = Bridge::Metric::Meter.new(runtime._core_runtime)
  return nil unless bridge

  Meter.new(bridge, bridge.default_attributes)
end

Instance Method Details

#create_metric(metric_type, name, description: nil, unit: nil, value_type: :integer) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/temporalio/internal/metric.rb', line 53

def create_metric(
  metric_type,
  name,
  description: nil,
  unit: nil,
  value_type: :integer
)
  Metric.new(
    metric_type:,
    name:,
    description:,
    unit:,
    value_type:,
    bridge: Bridge::Metric.new(@bridge, metric_type, name, description, unit, value_type),
    bridge_attrs: @bridge_attrs
  )
end

#with_additional_attributes(additional_attributes) ⇒ Object



71
72
73
# File 'lib/temporalio/internal/metric.rb', line 71

def with_additional_attributes(additional_attributes)
  Meter.new(@bridge, @bridge_attrs.with_additional(additional_attributes))
end