gruf 2.7.1 → 2.8.0
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/CHANGELOG.md +4 -0
- data/lib/gruf/interceptors/instrumentation/request_logging/formatters/base.rb +3 -1
- data/lib/gruf/interceptors/instrumentation/request_logging/formatters/logstash.rb +3 -1
- data/lib/gruf/interceptors/instrumentation/request_logging/formatters/plain.rb +3 -1
- data/lib/gruf/interceptors/instrumentation/request_logging/interceptor.rb +1 -1
- data/lib/gruf/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05c56ef80530be6983b6a54c116f0ba6c378255688ced90d11b5bb1be69e7937
|
4
|
+
data.tar.gz: 72f3d26b4bc35a231e11198799c58823e5f4ff0f39a21798dddcb82d5c14fd68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7390293027865fa85e904f0c82bf106bb3596aa949ea5f0bb13668511475dfed75cfddc68efb2beb4a832507cd92db266c9fc3bf903f9ece8779a21843bf532e
|
7
|
+
data.tar.gz: 765c589bdf841074a7c6944006670bb72794483c427cee52562bf232563771a929e91b3de32ef8cb72c208bad62ebe4d2bdffa8d5f9daa70dc29562e6f54cce5
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@ Changelog for the gruf gem. This includes internal history before the gem was ma
|
|
2
2
|
|
3
3
|
### Pending release
|
4
4
|
|
5
|
+
### 2.8.0
|
6
|
+
|
7
|
+
- Pass the controller request object into the request logging formatters [#92]
|
8
|
+
|
5
9
|
### 2.7.1
|
6
10
|
|
7
11
|
- Add `channel_credentials` option to `Gruf::Client` and `default_channel_credentials` option to `Gruf::Configuration` [#85] [#87]
|
@@ -28,9 +28,11 @@ module Gruf
|
|
28
28
|
# Format the parameters into a loggable string. Must be implemented in every derivative class
|
29
29
|
#
|
30
30
|
# @param [Hash] _payload The incoming request payload
|
31
|
+
# @param [Gruf::Controllers::Request] request The current controller request
|
32
|
+
# @param [Gruf::Interceptors::Timer::Result] result The timed result of the response
|
31
33
|
# @return [String] The formatted string
|
32
34
|
#
|
33
|
-
def format(_payload)
|
35
|
+
def format(_payload, request:, result:)
|
34
36
|
raise NotImplementedError
|
35
37
|
end
|
36
38
|
end
|
@@ -30,9 +30,11 @@ module Gruf
|
|
30
30
|
# Format the request into a JSON-friendly payload
|
31
31
|
#
|
32
32
|
# @param [Hash] payload The incoming request payload
|
33
|
+
# @param [Gruf::Controllers::Request] request The current controller request
|
34
|
+
# @param [Gruf::Interceptors::Timer::Result] result The timed result of the response
|
33
35
|
# @return [String] The JSON representation of the payload
|
34
36
|
#
|
35
|
-
def format(payload)
|
37
|
+
def format(payload, request:, result:)
|
36
38
|
payload.merge(format: 'json').to_json
|
37
39
|
end
|
38
40
|
end
|
@@ -28,9 +28,11 @@ module Gruf
|
|
28
28
|
# Format the request by only outputting the message body and params (if set to log params)
|
29
29
|
#
|
30
30
|
# @param [Hash] payload The incoming request payload
|
31
|
+
# @param [Gruf::Controllers::Request] request The current controller request
|
32
|
+
# @param [Gruf::Interceptors::Timer::Result] result The timed result of the response
|
31
33
|
# @return [String] The formatted string
|
32
34
|
#
|
33
|
-
def format(payload)
|
35
|
+
def format(payload, request:, result:)
|
34
36
|
time = payload.fetch(:duration, 0)
|
35
37
|
grpc_status = payload.fetch(:grpc_status, 'GRPC::Ok')
|
36
38
|
route_key = payload.fetch(:method, 'unknown')
|
@@ -100,7 +100,7 @@ module Gruf
|
|
100
100
|
payload[:time] = Time.now.to_s
|
101
101
|
payload[:host] = Socket.gethostname
|
102
102
|
|
103
|
-
logger.send(type, formatter.format(payload))
|
103
|
+
logger.send(type, formatter.format(payload, request: request, result: result))
|
104
104
|
|
105
105
|
raise result.message unless result.successful?
|
106
106
|
|
data/lib/gruf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gruf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shaun McCormick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|