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 +4 -4
- data/lib/istox/helpers/xray/grpc_client_xray_interceptor.rb +16 -0
- data/lib/istox/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 259900b656cd17776d5fb9b8d665991a839ff67c006a01a0eeefef277af9ba03
|
|
4
|
+
data.tar.gz: 92e4ebb68b52ccc811c9620cf521265fdf083b33d90ad2770bba1ff150c25a66
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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