Class: Temporalio::Runtime::MetricsOptions

Inherits:
Data
  • Object
show all
Defined in:
lib/temporalio/runtime.rb,
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_`.



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

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.



135
136
137
# File 'lib/temporalio/runtime.rb', line 135

def attach_service_name
  @attach_service_name
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`.



135
136
137
# File 'lib/temporalio/runtime.rb', line 135

def buffer
  @buffer
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.



135
136
137
# File 'lib/temporalio/runtime.rb', line 135

def global_tags
  @global_tags
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_`.



135
136
137
# File 'lib/temporalio/runtime.rb', line 135

def metric_prefix
  @metric_prefix
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`.



135
136
137
# File 'lib/temporalio/runtime.rb', line 135

def opentelemetry
  @opentelemetry
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`.



135
136
137
# File 'lib/temporalio/runtime.rb', line 135

def prometheus
  @prometheus
end