Class: Temporalio::Runtime::MetricsOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/temporalio/runtime.rb

Overview

Metrics options for runtime telemetry. Either #opentelemetry or #prometheus required, but not both.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opentelemetry: nil, prometheus: nil, buffer: nil, attach_service_name: true, global_tags: nil, metric_prefix: nil) ⇒ MetricsOptions

Create metrics options. Either ‘opentelemetry` or `prometheus` required, but not both.

Parameters:

  • opentelemetry (OpenTelemetryMetricsOptions, nil) (defaults to: nil)

    OpenTelemetry options if using OpenTelemetry. This is mutually exclusive with ‘prometheus` and `buffer`.

  • prometheus (PrometheusMetricsOptions, nil) (defaults to: nil)

    Prometheus options if using Prometheus. This is mutually exclusive with ‘opentelemetry` and `buffer`.

  • buffer (MetricBuffer, nil) (defaults to: nil)

    Metric buffer to send all metrics to. This is mutually exclusive with ‘prometheus` and `opentelemetry`.

  • attach_service_name (Boolean) (defaults to: true)

    Whether to put the service_name on every metric.

  • global_tags (Hash<String, String>, nil) (defaults to: nil)

    Resource tags to be applied to all metrics.

  • metric_prefix (String, nil) (defaults to: nil)

    Prefix to put on every Temporal metric. If unset, defaults to ‘temporal_`.



146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/temporalio/runtime.rb', line 146

def initialize(
  opentelemetry: nil,
  prometheus: nil,
  buffer: nil,
  attach_service_name: true,
  global_tags: nil,
  metric_prefix: nil
)
  if [opentelemetry, prometheus, buffer].count { |v| !v.nil? } > 1
    raise 'Can only have one of opentelemetry, prometheus, or buffer'
  end

  super
end

Instance Attribute Details

#attach_service_nameBoolean

Returns Whether to put the service_name on every metric.

Returns:

  • (Boolean)

    Whether to put the service_name on every metric.



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/temporalio/runtime.rb', line 134

class MetricsOptions
  # Create metrics options. Either `opentelemetry` or `prometheus` required, but not both.
  #
  # @param opentelemetry [OpenTelemetryMetricsOptions, nil] OpenTelemetry options if using OpenTelemetry. This is
  #   mutually exclusive with `prometheus` and `buffer`.
  # @param prometheus [PrometheusMetricsOptions, nil] Prometheus options if using Prometheus. This is mutually
  #   exclusive with `opentelemetry` and `buffer`.
  # @param buffer [MetricBuffer, nil] Metric buffer to send all metrics to. This is mutually exclusive with
  #   `prometheus` and `opentelemetry`.
  # @param attach_service_name [Boolean] Whether to put the service_name on every metric.
  # @param global_tags [Hash<String, String>, nil] Resource tags to be applied to all metrics.
  # @param metric_prefix [String, nil] Prefix to put on every Temporal metric. If unset, defaults to `temporal_`.
  def initialize(
    opentelemetry: nil,
    prometheus: nil,
    buffer: nil,
    attach_service_name: true,
    global_tags: nil,
    metric_prefix: nil
  )
    if [opentelemetry, prometheus, buffer].count { |v| !v.nil? } > 1
      raise 'Can only have one of opentelemetry, prometheus, or buffer'
    end

    super
  end

  # @!visibility private
  def _to_bridge
    # @type self: MetricsOptions
    Internal::Bridge::Runtime::MetricsOptions.new(
      opentelemetry: opentelemetry&._to_bridge,
      prometheus: prometheus&._to_bridge,
      buffered_with_size: buffer&._buffer_size,
      attach_service_name:,
      global_tags:,
      metric_prefix:
    )
  end
end

#bufferMetricBuffer?

Returns Metric buffer to send all metrics to. This is mutually exclusive with ‘prometheus` and `opentelemetry`.

Returns:

  • (MetricBuffer, nil)

    Metric buffer to send all metrics to. This is mutually exclusive with ‘prometheus` and `opentelemetry`.



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/temporalio/runtime.rb', line 134

class MetricsOptions
  # Create metrics options. Either `opentelemetry` or `prometheus` required, but not both.
  #
  # @param opentelemetry [OpenTelemetryMetricsOptions, nil] OpenTelemetry options if using OpenTelemetry. This is
  #   mutually exclusive with `prometheus` and `buffer`.
  # @param prometheus [PrometheusMetricsOptions, nil] Prometheus options if using Prometheus. This is mutually
  #   exclusive with `opentelemetry` and `buffer`.
  # @param buffer [MetricBuffer, nil] Metric buffer to send all metrics to. This is mutually exclusive with
  #   `prometheus` and `opentelemetry`.
  # @param attach_service_name [Boolean] Whether to put the service_name on every metric.
  # @param global_tags [Hash<String, String>, nil] Resource tags to be applied to all metrics.
  # @param metric_prefix [String, nil] Prefix to put on every Temporal metric. If unset, defaults to `temporal_`.
  def initialize(
    opentelemetry: nil,
    prometheus: nil,
    buffer: nil,
    attach_service_name: true,
    global_tags: nil,
    metric_prefix: nil
  )
    if [opentelemetry, prometheus, buffer].count { |v| !v.nil? } > 1
      raise 'Can only have one of opentelemetry, prometheus, or buffer'
    end

    super
  end

  # @!visibility private
  def _to_bridge
    # @type self: MetricsOptions
    Internal::Bridge::Runtime::MetricsOptions.new(
      opentelemetry: opentelemetry&._to_bridge,
      prometheus: prometheus&._to_bridge,
      buffered_with_size: buffer&._buffer_size,
      attach_service_name:,
      global_tags:,
      metric_prefix:
    )
  end
end

#global_tagsHash<String, String>?

Returns Resource tags to be applied to all metrics.

Returns:

  • (Hash<String, String>, nil)

    Resource tags to be applied to all metrics.



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/temporalio/runtime.rb', line 134

class MetricsOptions
  # Create metrics options. Either `opentelemetry` or `prometheus` required, but not both.
  #
  # @param opentelemetry [OpenTelemetryMetricsOptions, nil] OpenTelemetry options if using OpenTelemetry. This is
  #   mutually exclusive with `prometheus` and `buffer`.
  # @param prometheus [PrometheusMetricsOptions, nil] Prometheus options if using Prometheus. This is mutually
  #   exclusive with `opentelemetry` and `buffer`.
  # @param buffer [MetricBuffer, nil] Metric buffer to send all metrics to. This is mutually exclusive with
  #   `prometheus` and `opentelemetry`.
  # @param attach_service_name [Boolean] Whether to put the service_name on every metric.
  # @param global_tags [Hash<String, String>, nil] Resource tags to be applied to all metrics.
  # @param metric_prefix [String, nil] Prefix to put on every Temporal metric. If unset, defaults to `temporal_`.
  def initialize(
    opentelemetry: nil,
    prometheus: nil,
    buffer: nil,
    attach_service_name: true,
    global_tags: nil,
    metric_prefix: nil
  )
    if [opentelemetry, prometheus, buffer].count { |v| !v.nil? } > 1
      raise 'Can only have one of opentelemetry, prometheus, or buffer'
    end

    super
  end

  # @!visibility private
  def _to_bridge
    # @type self: MetricsOptions
    Internal::Bridge::Runtime::MetricsOptions.new(
      opentelemetry: opentelemetry&._to_bridge,
      prometheus: prometheus&._to_bridge,
      buffered_with_size: buffer&._buffer_size,
      attach_service_name:,
      global_tags:,
      metric_prefix:
    )
  end
end

#metric_prefixString?

Returns Prefix to put on every Temporal metric. If unset, defaults to ‘temporal_`.

Returns:

  • (String, nil)

    Prefix to put on every Temporal metric. If unset, defaults to ‘temporal_`.



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/temporalio/runtime.rb', line 134

class MetricsOptions
  # Create metrics options. Either `opentelemetry` or `prometheus` required, but not both.
  #
  # @param opentelemetry [OpenTelemetryMetricsOptions, nil] OpenTelemetry options if using OpenTelemetry. This is
  #   mutually exclusive with `prometheus` and `buffer`.
  # @param prometheus [PrometheusMetricsOptions, nil] Prometheus options if using Prometheus. This is mutually
  #   exclusive with `opentelemetry` and `buffer`.
  # @param buffer [MetricBuffer, nil] Metric buffer to send all metrics to. This is mutually exclusive with
  #   `prometheus` and `opentelemetry`.
  # @param attach_service_name [Boolean] Whether to put the service_name on every metric.
  # @param global_tags [Hash<String, String>, nil] Resource tags to be applied to all metrics.
  # @param metric_prefix [String, nil] Prefix to put on every Temporal metric. If unset, defaults to `temporal_`.
  def initialize(
    opentelemetry: nil,
    prometheus: nil,
    buffer: nil,
    attach_service_name: true,
    global_tags: nil,
    metric_prefix: nil
  )
    if [opentelemetry, prometheus, buffer].count { |v| !v.nil? } > 1
      raise 'Can only have one of opentelemetry, prometheus, or buffer'
    end

    super
  end

  # @!visibility private
  def _to_bridge
    # @type self: MetricsOptions
    Internal::Bridge::Runtime::MetricsOptions.new(
      opentelemetry: opentelemetry&._to_bridge,
      prometheus: prometheus&._to_bridge,
      buffered_with_size: buffer&._buffer_size,
      attach_service_name:,
      global_tags:,
      metric_prefix:
    )
  end
end

#opentelemetryOpenTelemetryMetricsOptions?

Returns OpenTelemetry options if using OpenTelemetry. This is mutually exclusive with ‘prometheus` and `buffer`.

Returns:

  • (OpenTelemetryMetricsOptions, nil)

    OpenTelemetry options if using OpenTelemetry. This is mutually exclusive with ‘prometheus` and `buffer`.



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/temporalio/runtime.rb', line 134

class MetricsOptions
  # Create metrics options. Either `opentelemetry` or `prometheus` required, but not both.
  #
  # @param opentelemetry [OpenTelemetryMetricsOptions, nil] OpenTelemetry options if using OpenTelemetry. This is
  #   mutually exclusive with `prometheus` and `buffer`.
  # @param prometheus [PrometheusMetricsOptions, nil] Prometheus options if using Prometheus. This is mutually
  #   exclusive with `opentelemetry` and `buffer`.
  # @param buffer [MetricBuffer, nil] Metric buffer to send all metrics to. This is mutually exclusive with
  #   `prometheus` and `opentelemetry`.
  # @param attach_service_name [Boolean] Whether to put the service_name on every metric.
  # @param global_tags [Hash<String, String>, nil] Resource tags to be applied to all metrics.
  # @param metric_prefix [String, nil] Prefix to put on every Temporal metric. If unset, defaults to `temporal_`.
  def initialize(
    opentelemetry: nil,
    prometheus: nil,
    buffer: nil,
    attach_service_name: true,
    global_tags: nil,
    metric_prefix: nil
  )
    if [opentelemetry, prometheus, buffer].count { |v| !v.nil? } > 1
      raise 'Can only have one of opentelemetry, prometheus, or buffer'
    end

    super
  end

  # @!visibility private
  def _to_bridge
    # @type self: MetricsOptions
    Internal::Bridge::Runtime::MetricsOptions.new(
      opentelemetry: opentelemetry&._to_bridge,
      prometheus: prometheus&._to_bridge,
      buffered_with_size: buffer&._buffer_size,
      attach_service_name:,
      global_tags:,
      metric_prefix:
    )
  end
end

#prometheusPrometheusMetricsOptions?

Returns Prometheus options if using Prometheus. This is mutually exclusive with ‘opentelemetry` and `buffer`.

Returns:

  • (PrometheusMetricsOptions, nil)

    Prometheus options if using Prometheus. This is mutually exclusive with ‘opentelemetry` and `buffer`.



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/temporalio/runtime.rb', line 134

class MetricsOptions
  # Create metrics options. Either `opentelemetry` or `prometheus` required, but not both.
  #
  # @param opentelemetry [OpenTelemetryMetricsOptions, nil] OpenTelemetry options if using OpenTelemetry. This is
  #   mutually exclusive with `prometheus` and `buffer`.
  # @param prometheus [PrometheusMetricsOptions, nil] Prometheus options if using Prometheus. This is mutually
  #   exclusive with `opentelemetry` and `buffer`.
  # @param buffer [MetricBuffer, nil] Metric buffer to send all metrics to. This is mutually exclusive with
  #   `prometheus` and `opentelemetry`.
  # @param attach_service_name [Boolean] Whether to put the service_name on every metric.
  # @param global_tags [Hash<String, String>, nil] Resource tags to be applied to all metrics.
  # @param metric_prefix [String, nil] Prefix to put on every Temporal metric. If unset, defaults to `temporal_`.
  def initialize(
    opentelemetry: nil,
    prometheus: nil,
    buffer: nil,
    attach_service_name: true,
    global_tags: nil,
    metric_prefix: nil
  )
    if [opentelemetry, prometheus, buffer].count { |v| !v.nil? } > 1
      raise 'Can only have one of opentelemetry, prometheus, or buffer'
    end

    super
  end

  # @!visibility private
  def _to_bridge
    # @type self: MetricsOptions
    Internal::Bridge::Runtime::MetricsOptions.new(
      opentelemetry: opentelemetry&._to_bridge,
      prometheus: prometheus&._to_bridge,
      buffered_with_size: buffer&._buffer_size,
      attach_service_name:,
      global_tags:,
      metric_prefix:
    )
  end
end