istox 0.1.152.1.test7 → 0.1.152.1.test8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54697f049a3402e004f28c51bd0cc5e35c460eba6b741c10afa1525ad46f3cc8
4
- data.tar.gz: 2efb0188abcbc03af97dba5a43fa6885b3914977bea7bf0f029e4d6c6dfa3ef5
3
+ metadata.gz: 259900b656cd17776d5fb9b8d665991a839ff67c006a01a0eeefef277af9ba03
4
+ data.tar.gz: 92e4ebb68b52ccc811c9620cf521265fdf083b33d90ad2770bba1ff150c25a66
5
5
  SHA512:
6
- metadata.gz: 24a9e39c4525f3e4fdb5e19774b85b90f3f5a97c1860515380d0d84239615941484ce72e2a006ba10c0a5a60e285950e77ae7e56cde59f7de77ff5dd36837311
7
- data.tar.gz: ccc14dd3d9965d22b936001fb9648e29c8881fc2a63f9e49c2550c3dcc7820cbae5187fd34feb8793ca3d80b3e63711cf9b76d1b327c1beb0f6071e0713cabfe
6
+ metadata.gz: 4330c1d731b6abd7ce878462704b937e8e1cf3aa1a3a466f28026428f0119269da9b1c2d4e1d3859093cf93cc9df81aacb0ce6c881d2c69d7a8d34c813002dfa
7
+ data.tar.gz: d1bfa3b30c49421d6c630ca4df7d08865658157228adb478031b2f03c4b7420f01edf0d3403045db01aaf3db957d858e20d388a08548aaca00f6c3ddf2ae724c
@@ -5,6 +5,20 @@ module Istox
5
5
  module Xray
6
6
  class GrpcClientXrayInterceptor < ::Gruf::Interceptors::ClientInterceptor
7
7
  def call(request_context:)
8
+ no_segment = false
9
+
10
+ begin
11
+ Xray.recorder.current_segment
12
+ rescue XRay::ContextMissingError
13
+ no_segment = true
14
+ end
15
+
16
+ ## usually we have active segment for client interceptor
17
+ ## but in some special case we might not have segment initiated
18
+ ## eg. when running from rails console,
19
+ ## in those case we will initiate the segment here manully
20
+ XRay.recorder.begin_segment('GrpcRequest') if no_segment
21
+
8
22
  XRay.recorder.begin_subsegment("GrpcRequest.#{request_context.method}")
9
23
 
10
24
  request_context.metadata[:xray_trace_id] = XRay.recorder.current_segment.trace_id
@@ -12,6 +26,8 @@ module Istox
12
26
  yield
13
27
 
14
28
  XRay.recorder.end_subsegment
29
+
30
+ XRay.recorder.end_segment if no_segment
15
31
  rescue StandardError => e
16
32
  log.error e
17
33
  raise e
data/lib/istox/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Istox
2
- VERSION = '0.1.152.1.test7'.freeze
2
+ VERSION = '0.1.152.1.test8'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: istox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.152.1.test7
4
+ version: 0.1.152.1.test8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siong Leng