gruf 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +6 -0
- data/lib/gruf/interceptors/instrumentation/request_logging/interceptor.rb +22 -2
- data/lib/gruf/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1af99f62622489376979d133e0c11fe33957a3937941193187508158bfb73398
|
4
|
+
data.tar.gz: 4b280b7a654de95dc0fc2d7ce8562baace9a9bd46861ccd59178682814a43e23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75f137a4d62bbbc3169338517c12c9b2bb3bb8a60def87ee7f0ee096cad9f8752660ed7a4367f118d7dfa05c87901a1fd543ee728a9ac273816b2014feb0f6fa
|
7
|
+
data.tar.gz: 3337ab3f9da018e445e245beaaa2d4af7307d31d9182f758e4e6adcbb348c31fd7862bafce81e2eabca7ba02d7b7b678bf0abaa782ffedc8b77a6adb0339a59d
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@ Changelog for the gruf gem. This includes internal history before the gem was ma
|
|
2
2
|
|
3
3
|
### Pending release
|
4
4
|
|
5
|
+
### 2.4.0
|
6
|
+
|
7
|
+
- Added a hash of error log levels to RequestLogging interceptor, mapping error code to level of logging to use. To
|
8
|
+
override the level of logging per error response, provide a map of codes to log level in options, key :log_levels.
|
9
|
+
The default is :error log level.
|
10
|
+
|
5
11
|
### 2.3.0
|
6
12
|
|
7
13
|
- Add Gruf::Interceptors::ClientInterceptor for intercepting outbound client calls
|
@@ -37,6 +37,22 @@ module Gruf
|
|
37
37
|
#
|
38
38
|
class Interceptor < ::Gruf::Interceptors::ServerInterceptor
|
39
39
|
|
40
|
+
# Default mappings of codes to log levels...
|
41
|
+
LOG_LEVEL_MAP = { 'GRPC::Ok' => :info,
|
42
|
+
'GRPC::InvalidArgument' => :info,
|
43
|
+
'GRPC::NotFound' => :info,
|
44
|
+
'GRPC::AlreadyExists' => :info,
|
45
|
+
'GRPC::OutOfRange' => :info,
|
46
|
+
'GRPC::Unauthenticated' => :warn,
|
47
|
+
'GRPC::PermissionDenied' => :warn,
|
48
|
+
'GRPC::Unknown' => :error,
|
49
|
+
'GRPC::Internal' => :error,
|
50
|
+
'GRPC::DataLoss' => :error,
|
51
|
+
'GRPC::FailedPrecondition' => :error,
|
52
|
+
'GRPC::Unavailable' => :error,
|
53
|
+
'GRPC::DeadlineExceeded' => :error,
|
54
|
+
'GRPC::Cancelled' => :error }.freeze
|
55
|
+
|
40
56
|
###
|
41
57
|
# Log the request, sending it to the appropriate formatter
|
42
58
|
#
|
@@ -49,11 +65,15 @@ module Gruf
|
|
49
65
|
yield
|
50
66
|
end
|
51
67
|
|
68
|
+
# Fetch log level options and merge with default...
|
69
|
+
log_level_map = LOG_LEVEL_MAP.merge(options.fetch(:log_levels, {}))
|
70
|
+
|
71
|
+
# A result is either successful, or, some level of feedback handled in the else block...
|
52
72
|
if result.successful?
|
53
|
-
type =
|
73
|
+
type = :info
|
54
74
|
status_name = 'GRPC::Ok'
|
55
75
|
else
|
56
|
-
type =
|
76
|
+
type = log_level_map[result.message_class_name] || :error
|
57
77
|
status_name = result.message_class_name
|
58
78
|
end
|
59
79
|
|
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.4.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: 2018-
|
11
|
+
date: 2018-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
175
|
version: '0'
|
176
176
|
requirements: []
|
177
177
|
rubyforge_project:
|
178
|
-
rubygems_version: 2.
|
178
|
+
rubygems_version: 2.7.7
|
179
179
|
signing_key:
|
180
180
|
specification_version: 4
|
181
181
|
summary: gRPC Ruby Framework
|