grpc_interceptors 0.2.0 → 0.2.1

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: c51b232898a2b8b008b4de2d02600c7fe1e49498d9928788ff7f8a57c91cdee2
4
- data.tar.gz: 302ffaeb0c448bd5e1c660bb614239bcd94dccf8df387228c739f5093b041290
3
+ metadata.gz: c4c60a6a961edc3c7fc953ade87a0a77fd447e55f8510e827a622770c4a267ca
4
+ data.tar.gz: eaff3d4c879c31d62bac9e9d09a1a4199e884639770ffe72dbc99c398fd6bf25
5
5
  SHA512:
6
- metadata.gz: 9c0fa8bb0b5abc00291d101ddc4f8e77a2652d955c9c838151d0ae6ab94d8458af00100f64fc54da5247b75c037f07b54e59477fae2c5bae4782dc872dc353ed
7
- data.tar.gz: 9934985ab2c5e87607b4f2caa32683e0e4f143a9d8666a37a3f0367e99383e03c6c66869f0a2e7998093689bc45f65c722173fc6d87ff124a41845ef38dc71ee
6
+ metadata.gz: e7296306ecc945d6fcb28161f16f836750f05e77aca7d18dac9ad9a3cd3e2619db3b588852fa3e4b3316c7b892e49ddf44673a9eab8d9f4fa7c24a5de3186811
7
+ data.tar.gz: d7777879bf82564ae53698c2a64e7ecb6c8daede6eb0be81596f97d78a54db789f3db36ff5ac968dd21c229dd1f508d7dea6aeac696d975f79e39fd30a12f534
data/README.md CHANGED
@@ -33,8 +33,6 @@ When the `LOG_LEVEL` env variable is set to `INFO` then the server logs out.
33
33
 
34
34
  When the `LOG_LEVEL` env variable is set to `DEBUG` then the server additionally adds the request to the log message. (Note, adding the response is currently blocked by [this gRPC issue](https://github.com/grpc/grpc/pull/26547).)
35
35
 
36
-
37
-
38
36
  ### StatsD metrics
39
37
 
40
38
  ```ruby
@@ -47,11 +45,12 @@ GRPC::RpcServer.new(
47
45
 
48
46
  The server emits a histogram metric called `grpc_latency_seconds` with the following tags:
49
47
 
50
- - `grpc_method` representing the called method
51
- - `grpc_service` representing the service
52
- - `grpc_type` representing the gRPC kind of method
48
+ - `grpc_method` representing the called method
49
+ - `grpc_service` representing the service
50
+ - `grpc_type` representing the gRPC kind of method
53
51
 
54
52
  #### [Experimental] A gauge metric of the server jobs queue
53
+
55
54
  ```
56
55
  # https://github.com/grpc/grpc/blob/v1.62.0/src/ruby/lib/grpc/generic/rpc_server.rb#L43C9-L43C21
57
56
  server.instance_variable_get(:@pool).jobs_waiting
@@ -62,7 +61,7 @@ server.instance_variable_get(:@pool).jobs_waiting
62
61
  ```ruby
63
62
  GRPC::RpcServer.new(
64
63
  interceptors: [
65
- GrpcInterceptors::Server::OpenTelemetryTracingInstrument.new
64
+ GrpcInterceptors::Server::OpenTelemetryTracingInterceptor.new
66
65
  ]
67
66
  )
68
67
  ```
@@ -76,7 +75,7 @@ GRPC::RpcServer.new(
76
75
  ```ruby
77
76
  GRPC::RpcServer.new(
78
77
  interceptors: [
79
- GrpcInterceptors::Client::OpenTelemetryTracingInstrument.new
78
+ GrpcInterceptors::Client::OpenTelemetryTracingInterceptor.new
80
79
  ]
81
80
  )
82
81
  ```
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../client'
3
+ require_relative '../kind'
4
4
  require_relative '../common/grpc_helper'
5
5
  require_relative '../common/logging'
6
6
 
@@ -18,7 +18,7 @@ module GrpcInterceptors
18
18
  )
19
19
  Common::Logging.yield_and_log(
20
20
  logger: @logger, request: request, method: method,
21
- method_type: 'unary', kind: GrpcInterceptors::Client::KIND, &block
21
+ method_type: 'unary', kind: GrpcInterceptors::Kind::CLIENT, &block
22
22
  )
23
23
  end
24
24
 
@@ -37,7 +37,7 @@ module GrpcInterceptors
37
37
  )
38
38
  Common::Logging.yield_and_log(
39
39
  logger: @logger, request: request, method: method,
40
- method_type: 'server_stream', kind: GrpcInterceptors::Client::KIND, &block
40
+ method_type: 'server_stream', kind: GrpcInterceptors::Kind::CLIENT, &block
41
41
  )
42
42
  end
43
43
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../client'
3
+ require_relative '../kind'
4
4
  require_relative '../common/grpc_helper'
5
5
  require_relative '../common/opentelemetry_helper'
6
6
 
@@ -11,7 +11,7 @@ module GrpcInterceptors
11
11
  attributes = Common::OpenTelemetryHelper.tracing_attributes(method)
12
12
 
13
13
  Common::OpenTelemetryHelper.tracer.in_span(
14
- method, kind: GrpcInterceptors::Client::KIND, attributes: attributes
14
+ method, kind: GrpcInterceptors::Kind::CLIENT, attributes: attributes
15
15
  ) do
16
16
  OpenTelemetry.propagation.inject(metadata)
17
17
  yield
@@ -26,7 +26,7 @@ module GrpcInterceptors
26
26
  attributes = Common::OpenTelemetryHelper.tracing_attributes(method)
27
27
 
28
28
  Common::OpenTelemetryHelper.tracer.in_span(
29
- method, kind: GrpcInterceptors::Client::KIND, attributes: attributes
29
+ method, kind: GrpcInterceptors::Kind::CLIENT, attributes: attributes
30
30
  ) do
31
31
  OpenTelemetry.propagation.inject(metadata)
32
32
  yield
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GrpcInterceptors
4
- module Client
5
- KIND = :client
4
+ module Kind
5
+ CLIENT = :client
6
+ SERVER = :server
6
7
  end
7
8
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../client'
3
+ require_relative '../kind'
4
4
  require_relative '../common/grpc_helper'
5
5
  require_relative '../common/logging'
6
6
 
@@ -16,7 +16,7 @@ module GrpcInterceptors
16
16
  def request_response(request: nil, call: nil, method: nil, &block)
17
17
  Common::Logging.yield_and_log(
18
18
  logger: @logger, request: request, method: method,
19
- method_type: 'unary', kind: GrpcInterceptors::Server::KIND, &block
19
+ method_type: 'unary', kind: GrpcInterceptors::Kind::SERVER, &block
20
20
  )
21
21
  end
22
22
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../client'
3
+ require_relative '../kind'
4
4
  require_relative '../common/grpc_helper'
5
5
  require_relative '../common/opentelemetry_helper'
6
6
 
@@ -17,7 +17,7 @@ module GrpcInterceptors
17
17
  Common::OpenTelemetryHelper.tracer.in_span(
18
18
  route_name,
19
19
  attributes: attributes,
20
- kind: GrpcInterceptors::Server::KIND,
20
+ kind: GrpcInterceptors::Kind::SERVER,
21
21
  &block
22
22
  )
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grpc_interceptors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - michal-kazmierczak
@@ -257,14 +257,13 @@ files:
257
257
  - LICENSE
258
258
  - README.md
259
259
  - lib/grpc_interceptors.rb
260
- - lib/grpc_interceptors/client.rb
261
260
  - lib/grpc_interceptors/client/logging_interceptor.rb
262
261
  - lib/grpc_interceptors/client/opentelemetry_tracing_interceptor.rb
263
262
  - lib/grpc_interceptors/common/grpc_helper.rb
264
263
  - lib/grpc_interceptors/common/log_payload.rb
265
264
  - lib/grpc_interceptors/common/logging.rb
266
265
  - lib/grpc_interceptors/common/opentelemetry_helper.rb
267
- - lib/grpc_interceptors/server.rb
266
+ - lib/grpc_interceptors/kind.rb
268
267
  - lib/grpc_interceptors/server/logging_interceptor.rb
269
268
  - lib/grpc_interceptors/server/opentelemetry_tracing_interceptor.rb
270
269
  - lib/grpc_interceptors/server/statsd_metrics.rb
@@ -288,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
288
287
  - !ruby/object:Gem::Version
289
288
  version: '0'
290
289
  requirements: []
291
- rubygems_version: 4.0.3
290
+ rubygems_version: 3.6.9
292
291
  specification_version: 4
293
292
  summary: A collection of Ruby interceptors (middlewares) for gRPC servers and clients.
294
293
  test_files: []
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module GrpcInterceptors
4
- module Server
5
- KIND = :server
6
- end
7
- end