temporalio 0.3.0-arm64-darwin → 0.4.0-arm64-darwin
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +4 -0
- data/Rakefile +1 -1
- data/lib/temporalio/activity/context.rb +13 -0
- data/lib/temporalio/activity/definition.rb +22 -5
- data/lib/temporalio/activity/info.rb +3 -0
- data/lib/temporalio/api/batch/v1/message.rb +6 -1
- data/lib/temporalio/api/command/v1/message.rb +1 -1
- data/lib/temporalio/api/common/v1/message.rb +2 -1
- data/lib/temporalio/api/deployment/v1/message.rb +38 -0
- data/lib/temporalio/api/enums/v1/batch_operation.rb +1 -1
- data/lib/temporalio/api/enums/v1/common.rb +1 -1
- data/lib/temporalio/api/enums/v1/deployment.rb +23 -0
- data/lib/temporalio/api/enums/v1/event_type.rb +1 -1
- data/lib/temporalio/api/enums/v1/failed_cause.rb +1 -1
- data/lib/temporalio/api/enums/v1/nexus.rb +21 -0
- data/lib/temporalio/api/enums/v1/reset.rb +1 -1
- data/lib/temporalio/api/enums/v1/workflow.rb +2 -1
- data/lib/temporalio/api/errordetails/v1/message.rb +3 -1
- data/lib/temporalio/api/failure/v1/message.rb +3 -1
- data/lib/temporalio/api/history/v1/message.rb +3 -1
- data/lib/temporalio/api/nexus/v1/message.rb +2 -1
- data/lib/temporalio/api/payload_visitor.rb +75 -7
- data/lib/temporalio/api/query/v1/message.rb +2 -1
- data/lib/temporalio/api/taskqueue/v1/message.rb +4 -1
- data/lib/temporalio/api/workflow/v1/message.rb +9 -1
- data/lib/temporalio/api/workflowservice/v1/request_response.rb +40 -11
- data/lib/temporalio/api/workflowservice/v1/service.rb +1 -1
- data/lib/temporalio/api.rb +1 -0
- data/lib/temporalio/client/connection/workflow_service.rb +238 -28
- data/lib/temporalio/client/interceptor.rb +39 -0
- data/lib/temporalio/client/schedule.rb +25 -1
- data/lib/temporalio/client/with_start_workflow_operation.rb +115 -0
- data/lib/temporalio/client/workflow_execution.rb +19 -0
- data/lib/temporalio/client/workflow_handle.rb +3 -3
- data/lib/temporalio/client.rb +125 -2
- data/lib/temporalio/contrib/open_telemetry.rb +470 -0
- data/lib/temporalio/error.rb +1 -0
- data/lib/temporalio/internal/bridge/3.2/temporalio_bridge.bundle +0 -0
- data/lib/temporalio/internal/bridge/3.3/temporalio_bridge.bundle +0 -0
- data/lib/temporalio/internal/bridge/3.4/temporalio_bridge.bundle +0 -0
- data/lib/temporalio/internal/bridge/api/activity_task/activity_task.rb +1 -1
- data/lib/temporalio/internal/bridge/api/common/common.rb +2 -1
- data/lib/temporalio/internal/bridge/api/workflow_activation/workflow_activation.rb +1 -1
- data/lib/temporalio/internal/bridge/api/workflow_commands/workflow_commands.rb +1 -1
- data/lib/temporalio/internal/bridge/api/workflow_completion/workflow_completion.rb +2 -1
- data/lib/temporalio/internal/bridge/runtime.rb +3 -0
- data/lib/temporalio/internal/bridge/testing.rb +3 -0
- data/lib/temporalio/internal/client/implementation.rb +232 -10
- data/lib/temporalio/internal/proto_utils.rb +34 -2
- data/lib/temporalio/internal/worker/activity_worker.rb +20 -8
- data/lib/temporalio/internal/worker/multi_runner.rb +2 -2
- data/lib/temporalio/internal/worker/workflow_instance/context.rb +57 -3
- data/lib/temporalio/internal/worker/workflow_instance/details.rb +4 -2
- data/lib/temporalio/internal/worker/workflow_instance/outbound_implementation.rb +11 -26
- data/lib/temporalio/internal/worker/workflow_instance/scheduler.rb +22 -2
- data/lib/temporalio/internal/worker/workflow_instance.rb +76 -32
- data/lib/temporalio/internal/worker/workflow_worker.rb +62 -19
- data/lib/temporalio/runtime/metric_buffer.rb +94 -0
- data/lib/temporalio/runtime.rb +48 -10
- data/lib/temporalio/search_attributes.rb +13 -0
- data/lib/temporalio/testing/activity_environment.rb +42 -14
- data/lib/temporalio/testing/workflow_environment.rb +26 -3
- data/lib/temporalio/version.rb +1 -1
- data/lib/temporalio/worker/interceptor.rb +3 -0
- data/lib/temporalio/worker/thread_pool.rb +5 -5
- data/lib/temporalio/worker/tuner.rb +38 -0
- data/lib/temporalio/worker/workflow_executor/thread_pool.rb +13 -8
- data/lib/temporalio/worker/workflow_executor.rb +1 -1
- data/lib/temporalio/worker/workflow_replayer.rb +350 -0
- data/lib/temporalio/worker.rb +58 -52
- data/lib/temporalio/workflow/definition.rb +40 -8
- data/lib/temporalio/workflow/future.rb +2 -2
- data/lib/temporalio/workflow/info.rb +22 -0
- data/lib/temporalio/workflow.rb +60 -8
- data/lib/temporalio/workflow_history.rb +26 -1
- data/temporalio.gemspec +2 -1
- metadata +25 -4
| @@ -33,11 +33,48 @@ module Temporalio | |
| 33 33 | 
             
                      end
         | 
| 34 34 | 
             
                    end
         | 
| 35 35 |  | 
| 36 | 
            -
                    def  | 
| 37 | 
            -
                       | 
| 36 | 
            +
                    def self.bridge_workflow_failure_exception_type_options(
         | 
| 37 | 
            +
                      workflow_failure_exception_types:,
         | 
| 38 | 
            +
                      workflow_definitions:
         | 
| 39 | 
            +
                    )
         | 
| 40 | 
            +
                      as_fail = workflow_failure_exception_types.any? do |t|
         | 
| 41 | 
            +
                        t.is_a?(Class) && t >= Workflow::NondeterminismError
         | 
| 42 | 
            +
                      end
         | 
| 43 | 
            +
                      as_fail_for_types = workflow_definitions.values.map do |defn|
         | 
| 44 | 
            +
                        next unless defn.failure_exception_types.any? { |t| t.is_a?(Class) && t >= Workflow::NondeterminismError }
         | 
| 38 45 |  | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 46 | 
            +
                        # If they tried to do this on a dynamic workflow and haven't already set worker-level option, warn
         | 
| 47 | 
            +
                        unless defn.name || as_fail
         | 
| 48 | 
            +
                          warn('Note, dynamic workflows cannot trap non-determinism errors, so worker-level ' \
         | 
| 49 | 
            +
                               'workflow_failure_exception_types should be set to capture that if that is the intention')
         | 
| 50 | 
            +
                        end
         | 
| 51 | 
            +
                        defn.name
         | 
| 52 | 
            +
                      end.compact
         | 
| 53 | 
            +
                      [as_fail, as_fail_for_types]
         | 
| 54 | 
            +
                    end
         | 
| 55 | 
            +
             | 
| 56 | 
            +
                    def initialize(
         | 
| 57 | 
            +
                      bridge_worker:,
         | 
| 58 | 
            +
                      namespace:,
         | 
| 59 | 
            +
                      task_queue:,
         | 
| 60 | 
            +
                      workflow_definitions:,
         | 
| 61 | 
            +
                      workflow_executor:,
         | 
| 62 | 
            +
                      logger:,
         | 
| 63 | 
            +
                      data_converter:,
         | 
| 64 | 
            +
                      metric_meter:,
         | 
| 65 | 
            +
                      workflow_interceptors:,
         | 
| 66 | 
            +
                      disable_eager_activity_execution:,
         | 
| 67 | 
            +
                      illegal_workflow_calls:,
         | 
| 68 | 
            +
                      workflow_failure_exception_types:,
         | 
| 69 | 
            +
                      workflow_payload_codec_thread_pool:,
         | 
| 70 | 
            +
                      unsafe_workflow_io_enabled:,
         | 
| 71 | 
            +
                      debug_mode:,
         | 
| 72 | 
            +
                      on_eviction: nil
         | 
| 73 | 
            +
                    )
         | 
| 74 | 
            +
                      @executor = workflow_executor
         | 
| 75 | 
            +
             | 
| 76 | 
            +
                      payload_codec = data_converter.payload_codec
         | 
| 77 | 
            +
                      @workflow_payload_codec_thread_pool = workflow_payload_codec_thread_pool
         | 
| 41 78 | 
             
                      if !Fiber.current_scheduler && payload_codec && !@workflow_payload_codec_thread_pool
         | 
| 42 79 | 
             
                        raise ArgumentError, 'Must have workflow payload codec thread pool if providing codec and not using fibers'
         | 
| 43 80 | 
             
                      end
         | 
| @@ -55,29 +92,31 @@ module Temporalio | |
| 55 92 | 
             
                      @state = State.new(
         | 
| 56 93 | 
             
                        workflow_definitions:,
         | 
| 57 94 | 
             
                        bridge_worker:,
         | 
| 58 | 
            -
                        logger | 
| 59 | 
            -
                        metric_meter | 
| 60 | 
            -
                        data_converter | 
| 61 | 
            -
                        deadlock_timeout:  | 
| 95 | 
            +
                        logger:,
         | 
| 96 | 
            +
                        metric_meter:,
         | 
| 97 | 
            +
                        data_converter:,
         | 
| 98 | 
            +
                        deadlock_timeout: debug_mode ? nil : 2.0,
         | 
| 62 99 | 
             
                        # TODO(cretz): Make this more performant for the default set?
         | 
| 63 100 | 
             
                        illegal_calls: WorkflowInstance::IllegalCallTracer.frozen_validated_illegal_calls(
         | 
| 64 | 
            -
                           | 
| 101 | 
            +
                          illegal_workflow_calls || {}
         | 
| 65 102 | 
             
                        ),
         | 
| 66 | 
            -
                        namespace | 
| 67 | 
            -
                        task_queue | 
| 68 | 
            -
                        disable_eager_activity_execution | 
| 69 | 
            -
                        workflow_interceptors | 
| 70 | 
            -
                        workflow_failure_exception_types:  | 
| 103 | 
            +
                        namespace:,
         | 
| 104 | 
            +
                        task_queue:,
         | 
| 105 | 
            +
                        disable_eager_activity_execution:,
         | 
| 106 | 
            +
                        workflow_interceptors:,
         | 
| 107 | 
            +
                        workflow_failure_exception_types: workflow_failure_exception_types.map do |t|
         | 
| 71 108 | 
             
                          unless t.is_a?(Class) && t < Exception
         | 
| 72 109 | 
             
                            raise ArgumentError, 'All failure types must classes inheriting Exception'
         | 
| 73 110 | 
             
                          end
         | 
| 74 111 |  | 
| 75 112 | 
             
                          t
         | 
| 76 | 
            -
                        end.freeze
         | 
| 113 | 
            +
                        end.freeze,
         | 
| 114 | 
            +
                        unsafe_workflow_io_enabled:
         | 
| 77 115 | 
             
                      )
         | 
| 116 | 
            +
                      @state.on_eviction = on_eviction if on_eviction
         | 
| 78 117 |  | 
| 79 118 | 
             
                      # Validate worker
         | 
| 80 | 
            -
                      @executor._validate_worker( | 
| 119 | 
            +
                      @executor._validate_worker(self, @state)
         | 
| 81 120 | 
             
                    end
         | 
| 82 121 |  | 
| 83 122 | 
             
                    def handle_activation(runner:, activation:, decoded:)
         | 
| @@ -147,12 +186,14 @@ module Temporalio | |
| 147 186 | 
             
                    class State
         | 
| 148 187 | 
             
                      attr_reader :workflow_definitions, :bridge_worker, :logger, :metric_meter, :data_converter, :deadlock_timeout,
         | 
| 149 188 | 
             
                                  :illegal_calls, :namespace, :task_queue, :disable_eager_activity_execution,
         | 
| 150 | 
            -
                                  :workflow_interceptors, :workflow_failure_exception_types
         | 
| 189 | 
            +
                                  :workflow_interceptors, :workflow_failure_exception_types, :unsafe_workflow_io_enabled
         | 
| 190 | 
            +
             | 
| 191 | 
            +
                      attr_writer :on_eviction
         | 
| 151 192 |  | 
| 152 193 | 
             
                      def initialize(
         | 
| 153 194 | 
             
                        workflow_definitions:, bridge_worker:, logger:, metric_meter:, data_converter:, deadlock_timeout:,
         | 
| 154 195 | 
             
                        illegal_calls:, namespace:, task_queue:, disable_eager_activity_execution:,
         | 
| 155 | 
            -
                        workflow_interceptors:, workflow_failure_exception_types:
         | 
| 196 | 
            +
                        workflow_interceptors:, workflow_failure_exception_types:, unsafe_workflow_io_enabled:
         | 
| 156 197 | 
             
                      )
         | 
| 157 198 | 
             
                        @workflow_definitions = workflow_definitions
         | 
| 158 199 | 
             
                        @bridge_worker = bridge_worker
         | 
| @@ -166,6 +207,7 @@ module Temporalio | |
| 166 207 | 
             
                        @disable_eager_activity_execution = disable_eager_activity_execution
         | 
| 167 208 | 
             
                        @workflow_interceptors = workflow_interceptors
         | 
| 168 209 | 
             
                        @workflow_failure_exception_types = workflow_failure_exception_types
         | 
| 210 | 
            +
                        @unsafe_workflow_io_enabled = unsafe_workflow_io_enabled
         | 
| 169 211 |  | 
| 170 212 | 
             
                        @running_workflows = {}
         | 
| 171 213 | 
             
                        @running_workflows_mutex = Mutex.new
         | 
| @@ -182,8 +224,9 @@ module Temporalio | |
| 182 224 | 
             
                        instance
         | 
| 183 225 | 
             
                      end
         | 
| 184 226 |  | 
| 185 | 
            -
                      def evict_running_workflow(run_id)
         | 
| 227 | 
            +
                      def evict_running_workflow(run_id, cache_remove_job)
         | 
| 186 228 | 
             
                        @running_workflows_mutex.synchronize { @running_workflows.delete(run_id) }
         | 
| 229 | 
            +
                        @on_eviction&.call(run_id, cache_remove_job)
         | 
| 187 230 | 
             
                      end
         | 
| 188 231 |  | 
| 189 232 | 
             
                      def evict_all
         | 
| @@ -0,0 +1,94 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Temporalio
         | 
| 4 | 
            +
              class Runtime
         | 
| 5 | 
            +
                # Metric buffer for use with a runtime to capture metrics. Only one metric buffer can be associated with a runtime
         | 
| 6 | 
            +
                # and {retrieve_updates} cannot be called before the runtime is created. Once runtime created, users should
         | 
| 7 | 
            +
                # regularly call {retrieve_updates} to drain the buffer.
         | 
| 8 | 
            +
                #
         | 
| 9 | 
            +
                # @note WARNING: It is important that the buffer size is set to a high number and that {retrieve_updates} is called
         | 
| 10 | 
            +
                #   regularly to drain the buffer. If the buffer is full, metric updates will be dropped and an error will be
         | 
| 11 | 
            +
                #   logged.
         | 
| 12 | 
            +
                class MetricBuffer
         | 
| 13 | 
            +
                  # Enumerates for the duration format.
         | 
| 14 | 
            +
                  module DurationFormat
         | 
| 15 | 
            +
                    # Durations are millisecond integers.
         | 
| 16 | 
            +
                    MILLISECONDS = :milliseconds
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                    # Durations are second floats.
         | 
| 19 | 
            +
                    SECONDS = :seconds
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  Update = Data.define(:metric, :value, :attributes)
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                  # Metric buffer update.
         | 
| 25 | 
            +
                  #
         | 
| 26 | 
            +
                  # @note WARNING: The constructor of this class should not be invoked by users and may change in incompatible ways
         | 
| 27 | 
            +
                  #   in the future.
         | 
| 28 | 
            +
                  #
         | 
| 29 | 
            +
                  # @!attribute metric
         | 
| 30 | 
            +
                  #   @return [Metric] Metric for this update. For performance reasons, this is created lazily on first use and is
         | 
| 31 | 
            +
                  #     the same object each time an update on this metric exists.
         | 
| 32 | 
            +
                  # @!attribute value
         | 
| 33 | 
            +
                  #   @return [Integer, Float] Metric value for this update.
         | 
| 34 | 
            +
                  # @!attribute attributes
         | 
| 35 | 
            +
                  #   @return [Hash{String => String, Integer, Float, Boolean}] Attributes for this value as a frozen hash.
         | 
| 36 | 
            +
                  #     For performance reasons this is sometimes the same hash if the attribute set is reused at a metric level.
         | 
| 37 | 
            +
                  class Update # rubocop:disable Lint/EmptyClass
         | 
| 38 | 
            +
                    # DEV NOTE: This class is instantiated inside Rust, be careful changing it.
         | 
| 39 | 
            +
                  end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                  Metric = Data.define(:name, :description, :unit, :kind)
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                  # Metric definition present on an update.
         | 
| 44 | 
            +
                  #
         | 
| 45 | 
            +
                  # @!attribute name
         | 
| 46 | 
            +
                  #   @return [String] Name of the metric.
         | 
| 47 | 
            +
                  # @!attribute description
         | 
| 48 | 
            +
                  #   @return [String, nil] Description of the metric if any.
         | 
| 49 | 
            +
                  # @!attribute unit
         | 
| 50 | 
            +
                  #   @return [String, nil] Unit of the metric if any.
         | 
| 51 | 
            +
                  # @!attribute kind
         | 
| 52 | 
            +
                  #   @return [:counter, :histogram, :gauge] Kind of the metric.
         | 
| 53 | 
            +
                  class Metric # rubocop:disable Lint/EmptyClass
         | 
| 54 | 
            +
                    # DEV NOTE: This class is instantiated inside Rust, be careful changing it.
         | 
| 55 | 
            +
                  end
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                  # Create a metric buffer with the given size.
         | 
| 58 | 
            +
                  #
         | 
| 59 | 
            +
                  # @note WARNING: It is important that the buffer size is set to a high number and is drained regularly. See
         | 
| 60 | 
            +
                  #   {MetricBuffer} warning.
         | 
| 61 | 
            +
                  #
         | 
| 62 | 
            +
                  # @param buffer_size [Integer] Maximum size of the buffer before metrics will be dropped.
         | 
| 63 | 
            +
                  # @param duration_format [DurationFormat] How durations are represented.
         | 
| 64 | 
            +
                  def initialize(buffer_size, duration_format: DurationFormat::MILLISECONDS)
         | 
| 65 | 
            +
                    @buffer_size = buffer_size
         | 
| 66 | 
            +
                    @duration_format = duration_format
         | 
| 67 | 
            +
                    @runtime = nil
         | 
| 68 | 
            +
                  end
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                  # Drain the buffer and return all metric updates.
         | 
| 71 | 
            +
                  #
         | 
| 72 | 
            +
                  # @note WARNING: It is important that this is called regularly. See {MetricBuffer} warning.
         | 
| 73 | 
            +
                  #
         | 
| 74 | 
            +
                  # @return [Array<Update>] Updates since last time this was called.
         | 
| 75 | 
            +
                  def retrieve_updates
         | 
| 76 | 
            +
                    raise 'Attempting to retrieve updates before runtime created' unless @runtime
         | 
| 77 | 
            +
             | 
| 78 | 
            +
                    @runtime._core_runtime.retrieve_buffered_metrics(@duration_format == DurationFormat::SECONDS)
         | 
| 79 | 
            +
                  end
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                  # @!visibility private
         | 
| 82 | 
            +
                  def _buffer_size
         | 
| 83 | 
            +
                    @buffer_size
         | 
| 84 | 
            +
                  end
         | 
| 85 | 
            +
             | 
| 86 | 
            +
                  # @!visibility private
         | 
| 87 | 
            +
                  def _set_runtime(runtime)
         | 
| 88 | 
            +
                    raise 'Metric buffer already attached to a runtime' if @runtime
         | 
| 89 | 
            +
             | 
| 90 | 
            +
                    @runtime = runtime
         | 
| 91 | 
            +
                  end
         | 
| 92 | 
            +
                end
         | 
| 93 | 
            +
              end
         | 
| 94 | 
            +
            end
         | 
    
        data/lib/temporalio/runtime.rb
    CHANGED
    
    | @@ -4,6 +4,7 @@ require 'temporalio/internal/bridge' | |
| 4 4 | 
             
            require 'temporalio/internal/bridge/runtime'
         | 
| 5 5 | 
             
            require 'temporalio/internal/metric'
         | 
| 6 6 | 
             
            require 'temporalio/metric'
         | 
| 7 | 
            +
            require 'temporalio/runtime/metric_buffer'
         | 
| 7 8 |  | 
| 8 9 | 
             
            module Temporalio
         | 
| 9 10 | 
             
              # Runtime for Temporal Ruby SDK.
         | 
| @@ -107,6 +108,7 @@ module Temporalio | |
| 107 108 | 
             
                MetricsOptions = Data.define(
         | 
| 108 109 | 
             
                  :opentelemetry,
         | 
| 109 110 | 
             
                  :prometheus,
         | 
| 111 | 
            +
                  :buffer,
         | 
| 110 112 | 
             
                  :attach_service_name,
         | 
| 111 113 | 
             
                  :global_tags,
         | 
| 112 114 | 
             
                  :metric_prefix
         | 
| @@ -116,10 +118,13 @@ module Temporalio | |
| 116 118 | 
             
                #
         | 
| 117 119 | 
             
                # @!attribute opentelemetry
         | 
| 118 120 | 
             
                #   @return [OpenTelemetryMetricsOptions, nil] OpenTelemetry options if using OpenTelemetry. This is mutually
         | 
| 119 | 
            -
                #     exclusive with  | 
| 121 | 
            +
                #     exclusive with `prometheus` and `buffer`.
         | 
| 120 122 | 
             
                # @!attribute prometheus
         | 
| 121 123 | 
             
                #   @return [PrometheusMetricsOptions, nil] Prometheus options if using Prometheus. This is mutually exclusive with
         | 
| 122 | 
            -
                #      | 
| 124 | 
            +
                #     `opentelemetry` and `buffer`.
         | 
| 125 | 
            +
                # @!attribute buffer
         | 
| 126 | 
            +
                #   @return [MetricBuffer, nil] Metric buffer to send all metrics to. This is mutually exclusive with `prometheus`
         | 
| 127 | 
            +
                #     and `opentelemetry`.
         | 
| 123 128 | 
             
                # @!attribute attach_service_name
         | 
| 124 129 | 
             
                #   @return [Boolean] Whether to put the service_name on every metric.
         | 
| 125 130 | 
             
                # @!attribute global_tags
         | 
| @@ -130,19 +135,26 @@ module Temporalio | |
| 130 135 | 
             
                  # Create metrics options. Either `opentelemetry` or `prometheus` required, but not both.
         | 
| 131 136 | 
             
                  #
         | 
| 132 137 | 
             
                  # @param opentelemetry [OpenTelemetryMetricsOptions, nil] OpenTelemetry options if using OpenTelemetry. This is
         | 
| 133 | 
            -
                  #   mutually exclusive with `prometheus`.
         | 
| 138 | 
            +
                  #   mutually exclusive with `prometheus` and `buffer`.
         | 
| 134 139 | 
             
                  # @param prometheus [PrometheusMetricsOptions, nil] Prometheus options if using Prometheus. This is mutually
         | 
| 135 | 
            -
                  #   exclusive with `opentelemetry`.
         | 
| 140 | 
            +
                  #   exclusive with `opentelemetry` and `buffer`.
         | 
| 141 | 
            +
                  # @param buffer [MetricBuffer, nil] Metric buffer to send all metrics to. This is mutually exclusive with
         | 
| 142 | 
            +
                  #   `prometheus` and `opentelemetry`.
         | 
| 136 143 | 
             
                  # @param attach_service_name [Boolean] Whether to put the service_name on every metric.
         | 
| 137 144 | 
             
                  # @param global_tags [Hash<String, String>, nil] Resource tags to be applied to all metrics.
         | 
| 138 145 | 
             
                  # @param metric_prefix [String, nil] Prefix to put on every Temporal metric. If unset, defaults to `temporal_`.
         | 
| 139 146 | 
             
                  def initialize(
         | 
| 140 147 | 
             
                    opentelemetry: nil,
         | 
| 141 148 | 
             
                    prometheus: nil,
         | 
| 149 | 
            +
                    buffer: nil,
         | 
| 142 150 | 
             
                    attach_service_name: true,
         | 
| 143 151 | 
             
                    global_tags: nil,
         | 
| 144 152 | 
             
                    metric_prefix: nil
         | 
| 145 153 | 
             
                  )
         | 
| 154 | 
            +
                    if [opentelemetry, prometheus, buffer].count { |v| !v.nil? } > 1
         | 
| 155 | 
            +
                      raise 'Can only have one of opentelemetry, prometheus, or buffer'
         | 
| 156 | 
            +
                    end
         | 
| 157 | 
            +
             | 
| 146 158 | 
             
                    super
         | 
| 147 159 | 
             
                  end
         | 
| 148 160 |  | 
| @@ -152,6 +164,7 @@ module Temporalio | |
| 152 164 | 
             
                    Internal::Bridge::Runtime::MetricsOptions.new(
         | 
| 153 165 | 
             
                      opentelemetry: opentelemetry&._to_bridge,
         | 
| 154 166 | 
             
                      prometheus: prometheus&._to_bridge,
         | 
| 167 | 
            +
                      buffered_with_size: buffer&._buffer_size,
         | 
| 155 168 | 
             
                      attach_service_name:,
         | 
| 156 169 | 
             
                      global_tags:,
         | 
| 157 170 | 
             
                      metric_prefix:
         | 
| @@ -164,7 +177,9 @@ module Temporalio | |
| 164 177 | 
             
                  :headers,
         | 
| 165 178 | 
             
                  :metric_periodicity,
         | 
| 166 179 | 
             
                  :metric_temporality,
         | 
| 167 | 
            -
                  :durations_as_seconds
         | 
| 180 | 
            +
                  :durations_as_seconds,
         | 
| 181 | 
            +
                  :http,
         | 
| 182 | 
            +
                  :histogram_bucket_overrides
         | 
| 168 183 | 
             
                )
         | 
| 169 184 |  | 
| 170 185 | 
             
                # Options for exporting metrics to OpenTelemetry.
         | 
| @@ -181,6 +196,11 @@ module Temporalio | |
| 181 196 | 
             
                # @!attribute durations_as_seconds
         | 
| 182 197 | 
             
                #   @return [Boolean] Whether to use float seconds instead of integer milliseconds for durations, default is
         | 
| 183 198 | 
             
                #     +false+.
         | 
| 199 | 
            +
                # @!attribute http
         | 
| 200 | 
            +
                #   @return [Boolean] True if the protocol is HTTP, false if gRPC (the default).
         | 
| 201 | 
            +
                # @!attribute histogram_bucket_overrides
         | 
| 202 | 
            +
                #   @return [Hash<String, Array<Numeric>>, nil] Override default histogram buckets. Key of the hash it the metric
         | 
| 203 | 
            +
                #     name, value is an array of floats for the set of buckets.
         | 
| 184 204 | 
             
                class OpenTelemetryMetricsOptions
         | 
| 185 205 | 
             
                  # OpenTelemetry metric temporality.
         | 
| 186 206 | 
             
                  module MetricTemporality
         | 
| @@ -196,12 +216,17 @@ module Temporalio | |
| 196 216 | 
             
                  # @param metric_temporality [MetricTemporality] How frequently metrics should be exported.
         | 
| 197 217 | 
             
                  # @param durations_as_seconds [Boolean] Whether to use float seconds instead of integer milliseconds for
         | 
| 198 218 | 
             
                  #   durations.
         | 
| 219 | 
            +
                  # @param http [Boolean] True if the protocol is HTTP, false if gRPC (the default).
         | 
| 220 | 
            +
                  # @param histogram_bucket_overrides [Hash<String, Array<Numeric>>, nil] Override default histogram buckets. Key of
         | 
| 221 | 
            +
                  #   the hash it the metric name, value is an array of floats for the set of buckets.
         | 
| 199 222 | 
             
                  def initialize(
         | 
| 200 223 | 
             
                    url:,
         | 
| 201 224 | 
             
                    headers: nil,
         | 
| 202 225 | 
             
                    metric_periodicity: nil,
         | 
| 203 226 | 
             
                    metric_temporality: MetricTemporality::CUMULATIVE,
         | 
| 204 | 
            -
                    durations_as_seconds: false
         | 
| 227 | 
            +
                    durations_as_seconds: false,
         | 
| 228 | 
            +
                    http: false,
         | 
| 229 | 
            +
                    histogram_bucket_overrides: nil
         | 
| 205 230 | 
             
                  )
         | 
| 206 231 | 
             
                    super
         | 
| 207 232 | 
             
                  end
         | 
| @@ -218,7 +243,9 @@ module Temporalio | |
| 218 243 | 
             
                                                when MetricTemporality::DELTA then true
         | 
| 219 244 | 
             
                                                else raise 'Unrecognized metric temporality'
         | 
| 220 245 | 
             
                                                end,
         | 
| 221 | 
            -
                      durations_as_seconds | 
| 246 | 
            +
                      durations_as_seconds:,
         | 
| 247 | 
            +
                      http:,
         | 
| 248 | 
            +
                      histogram_bucket_overrides:
         | 
| 222 249 | 
             
                    )
         | 
| 223 250 | 
             
                  end
         | 
| 224 251 | 
             
                end
         | 
| @@ -227,7 +254,8 @@ module Temporalio | |
| 227 254 | 
             
                  :bind_address,
         | 
| 228 255 | 
             
                  :counters_total_suffix,
         | 
| 229 256 | 
             
                  :unit_suffix,
         | 
| 230 | 
            -
                  :durations_as_seconds
         | 
| 257 | 
            +
                  :durations_as_seconds,
         | 
| 258 | 
            +
                  :histogram_bucket_overrides
         | 
| 231 259 | 
             
                )
         | 
| 232 260 |  | 
| 233 261 | 
             
                # Options for exporting metrics to Prometheus.
         | 
| @@ -240,6 +268,9 @@ module Temporalio | |
| 240 268 | 
             
                #   @return [Boolean] If `true`, all histograms will include the unit in their name as a suffix.
         | 
| 241 269 | 
             
                # @!attribute durations_as_seconds
         | 
| 242 270 | 
             
                #   @return [Boolean] Whether to use float seconds instead of integer milliseconds for durations.
         | 
| 271 | 
            +
                # @!attribute histogram_bucket_overrides
         | 
| 272 | 
            +
                #   @return [Hash<String, Array<Numeric>>, nil] Override default histogram buckets. Key of the hash it the metric
         | 
| 273 | 
            +
                #     name, value is an array of floats for the set of buckets.
         | 
| 243 274 | 
             
                class PrometheusMetricsOptions
         | 
| 244 275 | 
             
                  # Create Prometheus options.
         | 
| 245 276 | 
             
                  #
         | 
| @@ -248,11 +279,14 @@ module Temporalio | |
| 248 279 | 
             
                  # @param unit_suffix [Boolean] If `true`, all histograms will include the unit in their name as a suffix.
         | 
| 249 280 | 
             
                  # @param durations_as_seconds [Boolean] Whether to use float seconds instead of integer milliseconds for
         | 
| 250 281 | 
             
                  #   durations.
         | 
| 282 | 
            +
                  # @param histogram_bucket_overrides [Hash<String, Array<Numeric>>, nil] Override default histogram buckets. Key of
         | 
| 283 | 
            +
                  #   the hash it the metric name, value is an array of floats for the set of buckets.
         | 
| 251 284 | 
             
                  def initialize(
         | 
| 252 285 | 
             
                    bind_address:,
         | 
| 253 286 | 
             
                    counters_total_suffix: false,
         | 
| 254 287 | 
             
                    unit_suffix: false,
         | 
| 255 | 
            -
                    durations_as_seconds: false
         | 
| 288 | 
            +
                    durations_as_seconds: false,
         | 
| 289 | 
            +
                    histogram_bucket_overrides: nil
         | 
| 256 290 | 
             
                  )
         | 
| 257 291 | 
             
                    super
         | 
| 258 292 | 
             
                  end
         | 
| @@ -264,7 +298,8 @@ module Temporalio | |
| 264 298 | 
             
                      bind_address:,
         | 
| 265 299 | 
             
                      counters_total_suffix:,
         | 
| 266 300 | 
             
                      unit_suffix:,
         | 
| 267 | 
            -
                      durations_as_seconds | 
| 301 | 
            +
                      durations_as_seconds:,
         | 
| 302 | 
            +
                      histogram_bucket_overrides:
         | 
| 268 303 | 
             
                    )
         | 
| 269 304 | 
             
                  end
         | 
| 270 305 | 
             
                end
         | 
| @@ -295,6 +330,9 @@ module Temporalio | |
| 295 330 | 
             
                #
         | 
| 296 331 | 
             
                # @param telemetry [TelemetryOptions] Telemetry options to set.
         | 
| 297 332 | 
             
                def initialize(telemetry: TelemetryOptions.new)
         | 
| 333 | 
            +
                  # Set runtime on the buffer which will fail if the buffer is used on another runtime
         | 
| 334 | 
            +
                  telemetry.metrics&.buffer&._set_runtime(self)
         | 
| 335 | 
            +
             | 
| 298 336 | 
             
                  @core_runtime = Internal::Bridge::Runtime.new(
         | 
| 299 337 | 
             
                    Internal::Bridge::Runtime::Options.new(telemetry: telemetry._to_bridge)
         | 
| 300 338 | 
             
                  )
         | 
| @@ -251,6 +251,14 @@ module Temporalio | |
| 251 251 | 
             
                  @raw_hash.length
         | 
| 252 252 | 
             
                end
         | 
| 253 253 |  | 
| 254 | 
            +
                # Check equality.
         | 
| 255 | 
            +
                #
         | 
| 256 | 
            +
                # @param other [SearchAttributes] To compare.
         | 
| 257 | 
            +
                # @return [Boolean] Whether equal.
         | 
| 258 | 
            +
                def ==(other)
         | 
| 259 | 
            +
                  other.is_a?(SearchAttributes) && @raw_hash == other._raw_hash
         | 
| 260 | 
            +
                end
         | 
| 261 | 
            +
             | 
| 254 262 | 
             
                alias size length
         | 
| 255 263 |  | 
| 256 264 | 
             
                # Return a new search attributes collection with updates applied.
         | 
| @@ -280,6 +288,11 @@ module Temporalio | |
| 280 288 | 
             
                  end
         | 
| 281 289 | 
             
                end
         | 
| 282 290 |  | 
| 291 | 
            +
                # @!visibility private
         | 
| 292 | 
            +
                def _raw_hash
         | 
| 293 | 
            +
                  @raw_hash
         | 
| 294 | 
            +
                end
         | 
| 295 | 
            +
             | 
| 283 296 | 
             
                # @!visibility private
         | 
| 284 297 | 
             
                def _to_proto
         | 
| 285 298 | 
             
                  Api::Common::V1::SearchAttributes.new(indexed_fields: _to_proto_hash)
         | 
| @@ -13,8 +13,8 @@ module Temporalio | |
| 13 13 | 
             
                # cancellation can be set, users create this for each activity that is run. There is no real performance penalty for
         | 
| 14 14 | 
             
                # creating an environment for every run.
         | 
| 15 15 | 
             
                class ActivityEnvironment
         | 
| 16 | 
            -
                  # @return [Activity::Info] The activity info used by default. This is frozen, but can be  | 
| 17 | 
            -
                  #   in to {initialize}.
         | 
| 16 | 
            +
                  # @return [Activity::Info] The activity info used by default. This is frozen, but `with` can be used to make a new
         | 
| 17 | 
            +
                  #   instance with changes to pass in to {initialize}.
         | 
| 18 18 | 
             
                  def self.default_info
         | 
| 19 19 | 
             
                    @default_info ||= Activity::Info.new(
         | 
| 20 20 | 
             
                      activity_id: 'test',
         | 
| @@ -34,12 +34,13 @@ module Temporalio | |
| 34 34 | 
             
                      workflow_namespace: 'default',
         | 
| 35 35 | 
             
                      workflow_run_id: 'test-run',
         | 
| 36 36 | 
             
                      workflow_type: 'test'
         | 
| 37 | 
            -
                    ) | 
| 37 | 
            +
                    )
         | 
| 38 38 | 
             
                  end
         | 
| 39 39 |  | 
| 40 40 | 
             
                  # Create a test environment for activities.
         | 
| 41 41 | 
             
                  #
         | 
| 42 | 
            -
                  # @param info [Activity::Info] Value for {Activity::Context#info}.
         | 
| 42 | 
            +
                  # @param info [Activity::Info] Value for {Activity::Context#info}. Users should not try to instantiate this
         | 
| 43 | 
            +
                  #   themselves, but rather use `with` on {default_info}.
         | 
| 43 44 | 
             
                  # @param on_heartbeat [Proc(Array), nil] Proc that is called with all heartbeat details when
         | 
| 44 45 | 
             
                  #   {Activity::Context#heartbeat} is called.
         | 
| 45 46 | 
             
                  # @param cancellation [Cancellation] Value for {Activity::Context#cancellation}.
         | 
| @@ -47,6 +48,9 @@ module Temporalio | |
| 47 48 | 
             
                  # @param payload_converter [Converters::PayloadConverter] Value for {Activity::Context#payload_converter}.
         | 
| 48 49 | 
             
                  # @param logger [Logger] Value for {Activity::Context#logger}.
         | 
| 49 50 | 
             
                  # @param activity_executors [Hash<Symbol, Worker::ActivityExecutor>] Executors that activities can run within.
         | 
| 51 | 
            +
                  # @param metric_meter [Metric::Meter, nil] Value for {Activity::Context#metric_meter}, or nil to raise when
         | 
| 52 | 
            +
                  #   called.
         | 
| 53 | 
            +
                  # @param client [Client, nil] Value for {Activity::Context#client}, or nil to raise when called.
         | 
| 50 54 | 
             
                  def initialize(
         | 
| 51 55 | 
             
                    info: ActivityEnvironment.default_info,
         | 
| 52 56 | 
             
                    on_heartbeat: nil,
         | 
| @@ -54,7 +58,9 @@ module Temporalio | |
| 54 58 | 
             
                    worker_shutdown_cancellation: Cancellation.new,
         | 
| 55 59 | 
             
                    payload_converter: Converters::PayloadConverter.default,
         | 
| 56 60 | 
             
                    logger: Logger.new(nil),
         | 
| 57 | 
            -
                    activity_executors: Worker::ActivityExecutor.defaults
         | 
| 61 | 
            +
                    activity_executors: Worker::ActivityExecutor.defaults,
         | 
| 62 | 
            +
                    metric_meter: nil,
         | 
| 63 | 
            +
                    client: nil
         | 
| 58 64 | 
             
                  )
         | 
| 59 65 | 
             
                    @info = info
         | 
| 60 66 | 
             
                    @on_heartbeat = on_heartbeat
         | 
| @@ -63,6 +69,8 @@ module Temporalio | |
| 63 69 | 
             
                    @payload_converter = payload_converter
         | 
| 64 70 | 
             
                    @logger = logger
         | 
| 65 71 | 
             
                    @activity_executors = activity_executors
         | 
| 72 | 
            +
                    @metric_meter = metric_meter
         | 
| 73 | 
            +
                    @client = client
         | 
| 66 74 | 
             
                  end
         | 
| 67 75 |  | 
| 68 76 | 
             
                  # Run an activity and returns its result or raises its exception.
         | 
| @@ -80,14 +88,18 @@ module Temporalio | |
| 80 88 | 
             
                      Activity::Context._current_executor = executor
         | 
| 81 89 | 
             
                      executor.set_activity_context(defn, Context.new(
         | 
| 82 90 | 
             
                                                            info: @info.dup,
         | 
| 91 | 
            +
                                                            instance:
         | 
| 92 | 
            +
                                                              defn.instance.is_a?(Proc) ? defn.instance.call : defn.instance,
         | 
| 83 93 | 
             
                                                            on_heartbeat: @on_heartbeat,
         | 
| 84 94 | 
             
                                                            cancellation: @cancellation,
         | 
| 85 95 | 
             
                                                            worker_shutdown_cancellation: @worker_shutdown_cancellation,
         | 
| 86 96 | 
             
                                                            payload_converter: @payload_converter,
         | 
| 87 | 
            -
                                                            logger: @logger
         | 
| 97 | 
            +
                                                            logger: @logger,
         | 
| 98 | 
            +
                                                            metric_meter: @metric_meter,
         | 
| 99 | 
            +
                                                            client: @client
         | 
| 88 100 | 
             
                                                          ))
         | 
| 89 101 | 
             
                      queue.push([defn.proc.call(*args), nil])
         | 
| 90 | 
            -
                    rescue Exception => e # rubocop:disable Lint/RescueException Intentionally capturing all exceptions
         | 
| 102 | 
            +
                    rescue Exception => e # rubocop:disable Lint/RescueException -- Intentionally capturing all exceptions
         | 
| 91 103 | 
             
                      queue.push([nil, e])
         | 
| 92 104 | 
             
                    ensure
         | 
| 93 105 | 
             
                      executor.set_activity_context(defn, nil)
         | 
| @@ -102,28 +114,44 @@ module Temporalio | |
| 102 114 |  | 
| 103 115 | 
             
                  # @!visibility private
         | 
| 104 116 | 
             
                  class Context < Activity::Context
         | 
| 105 | 
            -
                    attr_reader :info, :cancellation, :worker_shutdown_cancellation, :payload_converter, :logger
         | 
| 117 | 
            +
                    attr_reader :info, :instance, :cancellation, :worker_shutdown_cancellation, :payload_converter, :logger
         | 
| 106 118 |  | 
| 107 119 | 
             
                    def initialize( # rubocop:disable Lint/MissingSuper
         | 
| 108 | 
            -
                      info | 
| 109 | 
            -
                       | 
| 110 | 
            -
                       | 
| 111 | 
            -
                       | 
| 112 | 
            -
                       | 
| 113 | 
            -
                       | 
| 120 | 
            +
                      info:,
         | 
| 121 | 
            +
                      instance:,
         | 
| 122 | 
            +
                      on_heartbeat:,
         | 
| 123 | 
            +
                      cancellation:,
         | 
| 124 | 
            +
                      worker_shutdown_cancellation:,
         | 
| 125 | 
            +
                      payload_converter:,
         | 
| 126 | 
            +
                      logger:,
         | 
| 127 | 
            +
                      metric_meter:,
         | 
| 128 | 
            +
                      client:
         | 
| 114 129 | 
             
                    )
         | 
| 115 130 | 
             
                      @info = info
         | 
| 131 | 
            +
                      @instance = instance
         | 
| 116 132 | 
             
                      @on_heartbeat = on_heartbeat
         | 
| 117 133 | 
             
                      @cancellation = cancellation
         | 
| 118 134 | 
             
                      @worker_shutdown_cancellation = worker_shutdown_cancellation
         | 
| 119 135 | 
             
                      @payload_converter = payload_converter
         | 
| 120 136 | 
             
                      @logger = logger
         | 
| 137 | 
            +
                      @metric_meter = metric_meter
         | 
| 138 | 
            +
                      @client = client
         | 
| 121 139 | 
             
                    end
         | 
| 122 140 |  | 
| 123 141 | 
             
                    # @!visibility private
         | 
| 124 142 | 
             
                    def heartbeat(*details)
         | 
| 125 143 | 
             
                      @on_heartbeat&.call(details)
         | 
| 126 144 | 
             
                    end
         | 
| 145 | 
            +
             | 
| 146 | 
            +
                    # @!visibility private
         | 
| 147 | 
            +
                    def metric_meter
         | 
| 148 | 
            +
                      @metric_meter or raise 'No metric meter configured in this test environment'
         | 
| 149 | 
            +
                    end
         | 
| 150 | 
            +
             | 
| 151 | 
            +
                    # @!visibility private
         | 
| 152 | 
            +
                    def client
         | 
| 153 | 
            +
                      @client or raise 'No client configured in this test environment'
         | 
| 154 | 
            +
                    end
         | 
| 127 155 | 
             
                  end
         | 
| 128 156 |  | 
| 129 157 | 
             
                  private_constant :Context
         | 
| @@ -10,6 +10,7 @@ require 'temporalio/converters' | |
| 10 10 | 
             
            require 'temporalio/internal/bridge/testing'
         | 
| 11 11 | 
             
            require 'temporalio/internal/proto_utils'
         | 
| 12 12 | 
             
            require 'temporalio/runtime'
         | 
| 13 | 
            +
            require 'temporalio/search_attributes'
         | 
| 13 14 | 
             
            require 'temporalio/version'
         | 
| 14 15 |  | 
| 15 16 | 
             
            module Temporalio
         | 
| @@ -34,8 +35,10 @@ module Temporalio | |
| 34 35 | 
             
                  # @param default_workflow_query_reject_condition [WorkflowQueryRejectCondition, nil] Default rejection condition
         | 
| 35 36 | 
             
                  #   for the client.
         | 
| 36 37 | 
             
                  # @param ip [String] IP to bind to.
         | 
| 37 | 
            -
                  # @param port [Integer, nil] Port to bind on, or  | 
| 38 | 
            +
                  # @param port [Integer, nil] Port to bind on, or `nil` for random.
         | 
| 38 39 | 
             
                  # @param ui [Boolean] If +true+, also starts the UI.
         | 
| 40 | 
            +
                  # @param ui_port [Integer, nil] Port to bind on if `ui` is true, or `nil` for random.
         | 
| 41 | 
            +
                  # @param search_attributes [Array<SearchAttributes::Key>] Search attributes to make available on start.
         | 
| 39 42 | 
             
                  # @param runtime [Runtime] Runtime for the server and client.
         | 
| 40 43 | 
             
                  # @param dev_server_existing_path [String, nil] Existing CLI path to use instead of downloading and caching to
         | 
| 41 44 | 
             
                  #   tmp.
         | 
| @@ -46,6 +49,8 @@ module Temporalio | |
| 46 49 | 
             
                  # @param dev_server_download_version [String] Version of dev server to download and cache.
         | 
| 47 50 | 
             
                  # @param dev_server_download_dest_dir [String, nil] Where to download. Defaults to tmp.
         | 
| 48 51 | 
             
                  # @param dev_server_extra_args [Array<String>] Any extra arguments for the CLI dev server.
         | 
| 52 | 
            +
                  # @param dev_server_download_ttl [Float, nil] How long the automatic download should be cached for. If nil, cached
         | 
| 53 | 
            +
                  #   indefinitely.
         | 
| 49 54 | 
             
                  #
         | 
| 50 55 | 
             
                  # @yield [environment] If a block is given, it is called with the environment and upon complete the environment is
         | 
| 51 56 | 
             
                  #   shutdown.
         | 
| @@ -62,6 +67,8 @@ module Temporalio | |
| 62 67 | 
             
                    ip: '127.0.0.1',
         | 
| 63 68 | 
             
                    port: nil,
         | 
| 64 69 | 
             
                    ui: false, # rubocop:disable Naming/MethodParameterName
         | 
| 70 | 
            +
                    ui_port: nil,
         | 
| 71 | 
            +
                    search_attributes: [],
         | 
| 65 72 | 
             
                    runtime: Runtime.default,
         | 
| 66 73 | 
             
                    dev_server_existing_path: nil,
         | 
| 67 74 | 
             
                    dev_server_database_filename: nil,
         | 
| @@ -70,8 +77,18 @@ module Temporalio | |
| 70 77 | 
             
                    dev_server_download_version: 'default',
         | 
| 71 78 | 
             
                    dev_server_download_dest_dir: nil,
         | 
| 72 79 | 
             
                    dev_server_extra_args: [],
         | 
| 80 | 
            +
                    dev_server_download_ttl: nil,
         | 
| 73 81 | 
             
                    &
         | 
| 74 82 | 
             
                  )
         | 
| 83 | 
            +
                    # Add search attribute args
         | 
| 84 | 
            +
                    unless search_attributes.empty?
         | 
| 85 | 
            +
                      dev_server_extra_args += search_attributes.flat_map do |key|
         | 
| 86 | 
            +
                        raise 'Search attribute must be Key' unless key.is_a?(SearchAttributes::Key)
         | 
| 87 | 
            +
             | 
| 88 | 
            +
                        ['--search-attribute', "#{key.name}=#{SearchAttributes::IndexedValueType::PROTO_NAMES[key.type]}"]
         | 
| 89 | 
            +
                      end
         | 
| 90 | 
            +
                    end
         | 
| 91 | 
            +
             | 
| 75 92 | 
             
                    server_options = Internal::Bridge::Testing::EphemeralServer::StartDevServerOptions.new(
         | 
| 76 93 | 
             
                      existing_path: dev_server_existing_path,
         | 
| 77 94 | 
             
                      sdk_name: 'sdk-ruby',
         | 
| @@ -83,9 +100,11 @@ module Temporalio | |
| 83 100 | 
             
                      port:,
         | 
| 84 101 | 
             
                      database_filename: dev_server_database_filename,
         | 
| 85 102 | 
             
                      ui:,
         | 
| 103 | 
            +
                      ui_port: ui ? ui_port : nil,
         | 
| 86 104 | 
             
                      log_format: dev_server_log_format,
         | 
| 87 105 | 
             
                      log_level: dev_server_log_level,
         | 
| 88 | 
            -
                      extra_args: dev_server_extra_args
         | 
| 106 | 
            +
                      extra_args: dev_server_extra_args,
         | 
| 107 | 
            +
                      download_ttl: dev_server_download_ttl
         | 
| 89 108 | 
             
                    )
         | 
| 90 109 | 
             
                    _with_core_server(
         | 
| 91 110 | 
             
                      core_server: Internal::Bridge::Testing::EphemeralServer.start_dev_server(
         | 
| @@ -122,6 +141,8 @@ module Temporalio | |
| 122 141 | 
             
                  # @param test_server_download_version [String] Version of test server to download and cache.
         | 
| 123 142 | 
             
                  # @param test_server_download_dest_dir [String, nil] Where to download. Defaults to tmp.
         | 
| 124 143 | 
             
                  # @param test_server_extra_args [Array<String>] Any extra arguments for the test server.
         | 
| 144 | 
            +
                  # @param test_server_download_ttl [Float, nil] How long the automatic download should be cached for. If nil,
         | 
| 145 | 
            +
                  #   cached indefinitely.
         | 
| 125 146 | 
             
                  #
         | 
| 126 147 | 
             
                  # @yield [environment] If a block is given, it is called with the environment and upon complete the environment is
         | 
| 127 148 | 
             
                  #   shutdown.
         | 
| @@ -140,6 +161,7 @@ module Temporalio | |
| 140 161 | 
             
                    test_server_download_version: 'default',
         | 
| 141 162 | 
             
                    test_server_download_dest_dir: nil,
         | 
| 142 163 | 
             
                    test_server_extra_args: [],
         | 
| 164 | 
            +
                    test_server_download_ttl: nil,
         | 
| 143 165 | 
             
                    &
         | 
| 144 166 | 
             
                  )
         | 
| 145 167 | 
             
                    server_options = Internal::Bridge::Testing::EphemeralServer::StartTestServerOptions.new(
         | 
| @@ -149,7 +171,8 @@ module Temporalio | |
| 149 171 | 
             
                      download_version: test_server_download_version,
         | 
| 150 172 | 
             
                      download_dest_dir: test_server_download_dest_dir,
         | 
| 151 173 | 
             
                      port:,
         | 
| 152 | 
            -
                      extra_args: test_server_extra_args
         | 
| 174 | 
            +
                      extra_args: test_server_extra_args,
         | 
| 175 | 
            +
                      download_ttl: test_server_download_ttl
         | 
| 153 176 | 
             
                    )
         | 
| 154 177 | 
             
                    _with_core_server(
         | 
| 155 178 | 
             
                      core_server: Internal::Bridge::Testing::EphemeralServer.start_test_server(
         | 
    
        data/lib/temporalio/version.rb
    CHANGED
    
    
| @@ -206,6 +206,7 @@ module Temporalio | |
| 206 206 | 
             
                      :activity,
         | 
| 207 207 | 
             
                      :args,
         | 
| 208 208 | 
             
                      :task_queue,
         | 
| 209 | 
            +
                      :summary,
         | 
| 209 210 | 
             
                      :schedule_to_close_timeout,
         | 
| 210 211 | 
             
                      :schedule_to_start_timeout,
         | 
| 211 212 | 
             
                      :start_to_close_timeout,
         | 
| @@ -270,6 +271,8 @@ module Temporalio | |
| 270 271 | 
             
                      :args,
         | 
| 271 272 | 
             
                      :id,
         | 
| 272 273 | 
             
                      :task_queue,
         | 
| 274 | 
            +
                      :static_summary,
         | 
| 275 | 
            +
                      :static_details,
         | 
| 273 276 | 
             
                      :cancellation,
         | 
| 274 277 | 
             
                      :cancellation_type,
         | 
| 275 278 | 
             
                      :parent_close_policy,
         |