8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/sbmt/outbox/middleware/open_telemetry/tracing_create_item_middleware.rb', line 8
def call(item_class, item_attributes)
return yield unless defined?(::OpenTelemetry)
span_attributes = {
"messaging.system" => "outbox",
"messaging.outbox.box_type" => item_class.box_type.to_s,
"messaging.outbox.box_name" => item_class.box_name,
"messaging.outbox.owner" => item_class.owner,
"messaging.destination" => item_class.name,
"messaging.destination_kind" => "database"
}
options = item_attributes[:options] ||= {}
= options[:headers] || options["headers"]
||= options[:headers] ||= {}
tracer.in_span(span_name(item_class), attributes: span_attributes.compact, kind: :producer) do
::OpenTelemetry.propagation.inject()
yield
end
end
|