Skip to content

Commit b516d11

Browse files
fix: address hidden steep issues (#415)
* otel regression test * fix: address hidden steep issues * test: place steep ignore on block pass
1 parent 75c7132 commit b516d11

19 files changed

Lines changed: 202 additions & 39 deletions

File tree

temporalio/Steepfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ target :lib do
1515
signature 'sig'
1616
check 'lib'
1717
ignore 'lib/temporalio/api', 'lib/temporalio/internal/bridge/api'
18-
library 'uri', 'objspace'
18+
library 'uri', 'objspace', 'etc'
1919
configure_code_diagnostics do |hash|
2020
hash.update(common_diagnostics)
2121
end
@@ -24,7 +24,7 @@ end
2424
target :test do
2525
signature 'sig', 'test/sig'
2626
check 'test'
27-
library 'uri', 'objspace'
27+
library 'uri', 'objspace', 'etc'
2828
configure_code_diagnostics do |hash|
2929
hash.update(common_diagnostics)
3030
# Steep cannot infer some things, so we can ignore them in tests

temporalio/lib/temporalio/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def self._validate_plugins!(plugins)
216216
def initialize(
217217
connection:,
218218
namespace:,
219-
data_converter: DataConverter.default,
219+
data_converter: Converters::DataConverter.default,
220220
plugins: [],
221221
interceptors: [],
222222
logger: Logger.new($stdout, level: Logger::WARN),

temporalio/lib/temporalio/contrib/open_telemetry.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,15 @@ def start_update_with_start_workflow(input)
158158
# @!visibility private
159159
def signal_with_start_workflow(input)
160160
@root._with_started_span(
161-
name: "SignalWithStartWorkflow:#{input.workflow}",
161+
name: "SignalWithStartWorkflow:#{input.start_workflow_operation.options.workflow}",
162162
kind: :client,
163-
attributes: { 'temporalWorkflowID' => input.start_workflow_operation.options.id },
164-
outbound_input: input
163+
attributes: { 'temporalWorkflowID' => input.start_workflow_operation.options.id }
165164
) do
166-
# Also add to start headers
167-
if input.headers[@header_key]
168-
input.start_workflow_operation.options.headers[@header_key] = input.headers[@header_key]
169-
end
165+
# SignalWithStartWorkflowInput has no top-level headers field and instead uses
166+
# start_workflow_operation.options.headers.
167+
# So tracing context must be injected explicitly instead of relying
168+
# on _with_started_span.
169+
@root._apply_context_to_headers(input.start_workflow_operation.options.headers)
170170
super
171171
end
172172
end

temporalio/sig/open_telemetry.rbs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
module OpenTelemetry
2+
module Context
3+
def self.current: -> untyped
4+
def self.attach: (untyped context) -> untyped
5+
def self.detach: (untyped token) -> void
6+
7+
module Propagation
8+
class CompositeTextMapPropagator
9+
def self.compose_propagators: (Array[untyped] propagators) -> untyped
10+
end
11+
end
12+
end
13+
14+
module Baggage
15+
module Propagation
16+
class TextMapPropagator
17+
def initialize: -> void
18+
end
19+
end
20+
end
21+
22+
module Trace
23+
def self.with_span: [T] (untyped span) { -> T } -> T
24+
def self.current_span: (?untyped context) -> untyped
25+
def self.context_with_span: (untyped span) -> untyped
26+
27+
class Link
28+
def initialize: (untyped context) -> void
29+
end
30+
31+
module Status
32+
def self.error: (String description) -> untyped
33+
end
34+
35+
module Propagation
36+
module TraceContext
37+
class TextMapPropagator
38+
def initialize: -> void
39+
end
40+
end
41+
end
42+
43+
class Span
44+
INVALID: untyped
45+
end
46+
end
47+
end

temporalio/sig/temporalio/contrib/open_telemetry.rbs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ module Temporalio
2727
) { () -> T } -> T
2828
def _always_create_workflow_spans: -> bool
2929

30+
class ClientOutbound < Client::Interceptor::Outbound
31+
def initialize: (TracingInterceptor root, Client::Interceptor::Outbound next_interceptor) -> void
32+
end
33+
34+
class ActivityInbound < Worker::Interceptor::Activity::Inbound
35+
def initialize: (TracingInterceptor root, Worker::Interceptor::Activity::Inbound next_interceptor) -> void
36+
end
37+
3038
class WorkflowInbound < Worker::Interceptor::Workflow::Inbound
3139
def initialize: (TracingInterceptor root, Worker::Interceptor::Workflow::Inbound next_interceptor) -> void
3240

temporalio/sig/temporalio/converters/payload_converter/binary_null.rbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ module Temporalio
22
module Converters
33
class PayloadConverter
44
class BinaryNull < Encoding
5+
ENCODING: String
56
end
67
end
78
end
8-
end
9+
end

temporalio/sig/temporalio/converters/payload_converter/binary_plain.rbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ module Temporalio
22
module Converters
33
class PayloadConverter
44
class BinaryPlain < Encoding
5+
ENCODING: String
56
end
67
end
78
end
8-
end
9+
end

temporalio/sig/temporalio/converters/payload_converter/binary_protobuf.rbs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ module Temporalio
22
module Converters
33
class PayloadConverter
44
class BinaryProtobuf < Encoding
5+
ENCODING: String
56
end
67
end
78
end
8-
end
9+
end
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
module Temporalio
22
module Converters
33
class PayloadConverter
4-
class JsonPlain < Encoding
4+
class JSONPlain < Encoding
5+
ENCODING: String
6+
57
def initialize: (
6-
?Hash[Symbol, untyped] parse_options,
7-
?Hash[Symbol, untyped] generate_options
8+
?parse_options: Hash[Symbol, untyped],
9+
?generate_options: Hash[Symbol, untyped]
810
) -> void
911
end
1012
end
1113
end
12-
end
14+
end
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
module Temporalio
22
module Converters
33
class PayloadConverter
4-
class JsonProtobuf < Encoding
4+
class JSONProtobuf < Encoding
5+
ENCODING: String
56
end
67
end
78
end
8-
end
9+
end

0 commit comments

Comments
 (0)