connectrpc-health 0.1.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f9d3081aa61a18bd5eee848e4b4ece3c169e84311f46f6c58aa0be14e22ad3d7
4
+ data.tar.gz: 95e1b23caeeebeb31e8535fd33e9a5832b280ab6f0fda6af8d7936213a09fb52
5
+ SHA512:
6
+ metadata.gz: d159fe31f974b6c7b9f1394412ea386eb1821fc187aab47882669f3453b5def99174f6a505b7357bae5bcb603774d5abbae89a023d8bc964de5a7ddcb62e2b36
7
+ data.tar.gz: d0a794e6819764f98701608afafb3e0e16e5d964837b69ce733dab932216fc1834ca1a6c8d6a57e168e96a9e3dd85f0eed9bad3ff7a9989fbc1cef7f2b876bc5
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jim Myhrberg
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,228 @@
1
+ <div align="center">
2
+
3
+ <img height="128px" width="128px" src="../../img/connectrpc-ruby.svg" alt="connectrpc-ruby logo">
4
+
5
+ # connectrpc-health
6
+
7
+ **The standard gRPC health service for ConnectRPC servers.**
8
+
9
+ [![RubyGems](https://img.shields.io/gem/v/connectrpc-health?logo=rubygems&logoColor=white&label=RubyGems)](https://rubygems.org/gems/connectrpc-health)
10
+ [![CI](https://img.shields.io/github/actions/workflow/status/jimeh/connectrpc-ruby/ci.yml?branch=main&logo=github&label=CI)](https://github.com/jimeh/connectrpc-ruby/actions/workflows/ci.yml)
11
+ [![Docs](https://img.shields.io/badge/Docs-guides-0969da?logo=markdown&logoColor=white)](https://github.com/jimeh/connectrpc-ruby/tree/main/docs)
12
+ [![License](https://img.shields.io/github/license/jimeh/connectrpc-ruby?label=License)](https://github.com/jimeh/connectrpc-ruby/blob/main/LICENSE)
13
+
14
+ </div>
15
+
16
+ `connectrpc-health` implements
17
+ [`grpc.health.v1.Health`](https://github.com/grpc/grpc/blob/master/doc/health-checking.md)
18
+ (`Check`, `List` and `Watch`) on a status registry that any thread or fiber can
19
+ update. Kubernetes gRPC probes, `grpc_health_probe`, load balancers and grpc-go
20
+ health clients can query the service, and the generated Ruby client calls it
21
+ over Connect or gRPC.
22
+
23
+ The package is experimental. See the [supported 0.x contract](../../docs/support.md)
24
+ for the target support profile, matched package versions, compatibility policy
25
+ and adoption gates.
26
+
27
+ ## Installation
28
+
29
+ ```ruby
30
+ gem "connectrpc-health", "~> 0.1.0"
31
+ ```
32
+
33
+ The runtime dependencies are `connectrpc ~> 0.1.0` and
34
+ `google-protobuf >= 4.36.2, < 5`. Core and the hosting packages do not depend
35
+ on this package.
36
+
37
+ ## Usage
38
+
39
+ ```ruby
40
+ require "connectrpc/health"
41
+
42
+ health = ConnectRPC::Health::Registry.new(max_watchers: 100)
43
+ health.set("demo.v1.DemoService", :serving)
44
+
45
+ server = ConnectRPC::Server.new(
46
+ services: [Demo::V1::DemoService::SERVICE, ConnectRPC::Health::SERVICE],
47
+ handlers: demo_handlers.merge(health.handlers),
48
+ binding: ConnectRPC::Bindings::GoogleProtobuf.new, protocol: :auto
49
+ )
50
+ ```
51
+
52
+ | Method | Behavior |
53
+ | --- | --- |
54
+ | `set(service, status)` | Stores `:unknown`, `:serving` or `:not_serving` and returns true. Returns false without a change after `shutdown`. |
55
+ | `status(service)` | The stored status, or nil for an unregistered name. |
56
+ | `shutdown` | Marks every entry `:not_serving` and ends Watch streams. Idempotent. |
57
+ | `shutdown?` | Whether `shutdown` ran. |
58
+ | `watcher_count` | Admitted Watch streams. |
59
+ | `handlers` | A frozen Hash of the Check, List and Watch handlers keyed by path. |
60
+
61
+ The overall server entry `""` starts `:serving`. Service names are Strings and
62
+ must be valid UTF-8; the registry stores frozen copies. Other names, statuses and
63
+ a `max_watchers:` that is not a positive Integer raise `ArgumentError`. There is
64
+ no unregister. `ConnectRPC::Health::SERVICE` is the generated
65
+ `Grpc::Health::V1::Health::SERVICE`.
66
+
67
+ - **Check** returns the stored status. An unregistered name fails `not_found`.
68
+ - **List** returns a snapshot of every entry. More than 100 entries fail
69
+ `resource_exhausted`, as grpc-go does.
70
+ - **Watch** sends the current status, or `SERVICE_UNKNOWN` for an unregistered
71
+ name, then each change. A slow stream sees only the latest status, never a
72
+ queue, and a status equal to the last one sent is skipped. More than
73
+ `max_watchers` concurrent streams fail `resource_exhausted` before any message.
74
+ A Watch deadline ends the stream with `deadline_exceeded`, and peer
75
+ cancellation ends it with `canceled`.
76
+
77
+ Status updates only signal the stream; each Watch handler sends on its own
78
+ reactor or thread. `set` from a plain thread wakes a watcher on an Async
79
+ reactor.
80
+
81
+ ## Hosts
82
+
83
+ | Host | Check and List | Watch |
84
+ | --- | --- | --- |
85
+ | Async Host (HTTP/2: h2c, TLS, mTLS) | Connect and gRPC | Connect and gRPC |
86
+ | Falcon HTTP/2 | Connect and gRPC | Connect and gRPC |
87
+ | Falcon HTTP/1.1 | Connect | Connect |
88
+ | Rack, Rails, Testing | Connect (gRPC-Web unary where enabled) | Rejected by protocol |
89
+
90
+ Portable adapters reject Watch the same way they reject any server stream:
91
+ Connect streaming media gets 415 before dispatch, a unary-encoded request to the
92
+ Watch path fails `unimplemented`, and a generated Watch call on a unary-only
93
+ transport fails locally with `ArgumentError`.
94
+
95
+ Kubernetes [`grpc:` probes](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-a-grpc-liveness-probe)
96
+ and `grpc_health_probe` need native gRPC, so serve health from the Async Host or
97
+ Falcon over HTTP/2. Kubernetes probes use plaintext h2c only. A second
98
+ plaintext `Host` on a probe port can share the registry with a TLS application
99
+ host; that separate port is also the recommended authentication boundary:
100
+
101
+ ```ruby
102
+ probe = ConnectRPC::Server.new(services: [ConnectRPC::Health::SERVICE], handlers: health.handlers,
103
+ binding: ConnectRPC::Bindings::GoogleProtobuf.new, protocol: :grpc)
104
+ ConnectRPC::Async::Host.new(server: probe, port: 8081).start
105
+ ```
106
+
107
+ With Falcon, each worker process builds its own server, so a registry is
108
+ worker-local. Set statuses inside each worker, for example while building
109
+ `connectrpc_server`.
110
+
111
+ ### Authentication
112
+
113
+ `invoker:` covers unary calls only; Watch bypasses it. To expose health behind
114
+ authentication, wrap the handlers so a denied call fails before it reaches the
115
+ registry. A denied Watch then reveals no status and allocates no watcher:
116
+
117
+ ```ruby
118
+ guarded = health.handlers.to_h do |path, handler|
119
+ [path, lambda do |*arguments, context|
120
+ raise ConnectRPC::Error.new(:unauthenticated, "credentials required") unless authorized?(context)
121
+
122
+ handler.call(*arguments, context)
123
+ end]
124
+ end
125
+ ```
126
+
127
+ ## Shutdown and drain
128
+
129
+ Call `health.shutdown` before `host.close(grace:)`. Every entry becomes
130
+ `NOT_SERVING`, existing Watch streams send `NOT_SERVING` if they have not
131
+ already sent it and end with OK, and later Watch calls fail `unavailable`
132
+ before sending any message. A message followed by a normal end would reset the
133
+ grpc-go client's backoff and cause tight retry loops during drain. Graceful
134
+ close then finishes well before grace expires. Final delivery is best effort,
135
+ bounded by the host's grace. grpc-go's own server keeps Watch streams open after
136
+ `Shutdown`; this registry ends them so hosts can drain.
137
+
138
+ A host that closes without `health.shutdown` releases its watchers through
139
+ grace expiry, forced close or connection loss.
140
+
141
+ ### Watch streams the server cannot see end
142
+
143
+ Peer `RST_STREAM(CANCEL)`, HTTP/2 connection loss and host retirement release a
144
+ watcher immediately. Other HTTP/2 reset codes and an HTTP/1.1 client that
145
+ disappears while idle signal nothing to the handler. Such a watcher is released
146
+ when its next send attempt fails, at connection retirement or at
147
+ `shutdown`. Only a change that differs from the last status sent triggers a
148
+ send; changes that coalesce back to it before the stream runs send nothing.
149
+ `max_watchers` bounds that cost; there is no separate Watch
150
+ lifetime limit.
151
+
152
+ ## grpc gem load order
153
+
154
+ The generated files use the canonical feature name
155
+ `grpc/health/v1/health_pb`, which the `grpc` gem shares. This package's
156
+ descriptor is a superset that adds List. `require "connectrpc/health"` loads
157
+ its own file by path, even when the `grpc` gem comes first on the load path,
158
+ and the `grpc` gem's later require of that feature name reuses it. When an older descriptor without List is already loaded,
159
+ `require "connectrpc/health"` raises a `LoadError` that asks you to require it
160
+ before the grpc gem's health files.
161
+
162
+ ## Schema
163
+
164
+ `proto/grpc/health/v1/health.proto` is the unchanged canonical schema from
165
+ grpc/grpc-proto at a pinned commit; [`proto/README.md`](proto/README.md) records
166
+ the commit, SHA256 and license. `mise run generation:build` regenerates
167
+ `lib/grpc/health/v1/` and `rbs/grpc_health_v1/grpc/health/v1/`, and
168
+ `mise run generation:check` checks them. Never edit the generated files by hand.
169
+
170
+ ## Development
171
+
172
+ From the repository root use `mise run health:setup`, `health:test`,
173
+ `health:check`, `health:build`, `health:package`, `health:interop` and
174
+ `health:verify`. The independent development bundle resolves the newest allowed
175
+ versions and includes the local Rack, Async, Falcon and testing packages for
176
+ real-host specs. Caches and archives are in `vendor/health`, and coverage is in
177
+ `coverage/health/<Ruby>/`. Both pinned Ruby 3.4.12 and 4.0.9 CI leaves run
178
+ `health:verify`.
179
+
180
+ `health:interop` runs grpc-go's standard `grpc_health_v1` client from
181
+ `interop/grpc` against the Async Host and real Falcon workers over h2c, TLS and
182
+ mTLS, and runs the same client script against grpc-go's reference
183
+ `health.NewServer()`. The reference has no watcher count, and after `Shutdown`
184
+ it keeps streams open and admits new watchers; the script records those two
185
+ differences. `floors:health` repeats specs and package checks with every
186
+ runtime dependency at its gemspec floor.
187
+
188
+ ## Static signatures
189
+
190
+ This package owns `sig/` and its discovery manifest. Add
191
+ `library "connectrpc-health"` to a strict Steep target with this gem installed
192
+ to type the registry and `ConnectRPC::Health::SERVICE`.
193
+
194
+ The generated `grpc.health.v1` message, client and handler factory signatures
195
+ are an explicit opt-in in `rbs/grpc_health_v1`, outside normal gem discovery.
196
+ The generated messages subclass `Google::Protobuf::AbstractMessage`, which only
197
+ core's opt-in `rbs/google_protobuf_4_36` bridge (or your own protobuf runtime
198
+ signatures) declares. Steep 2.1.0 builds `library` signatures before project
199
+ `signature` paths, so shipping them in `sig/` would break the library itself.
200
+ To type calls on the generated client or messages, add both directories as
201
+ Steepfile-relative `signature` paths:
202
+
203
+ ```ruby
204
+ require "pathname"
205
+ bridges = { "connectrpc-health" => "rbs/grpc_health_v1", "connectrpc" => "rbs/google_protobuf_4_36" }
206
+ .map do |name, directory|
207
+ Pathname(Gem::Specification.find_by_name(name).full_gem_path).join(directory)
208
+ .relative_path_from(Pathname(__dir__)).to_s
209
+ end
210
+
211
+ target :app do
212
+ library "connectrpc"
213
+ library "connectrpc-health"
214
+ signature "sig", *bridges
215
+ check "app"
216
+ configure_code_diagnostics(Steep::Diagnostic::Ruby.strict)
217
+ end
218
+ ```
219
+
220
+ See the [RBS guide](../../docs/rbs.md#opt-in-framework-compatibility).
221
+
222
+ ## License
223
+
224
+ Original project work is [MIT licensed](LICENSE), copyright 2026 Jim Myhrberg.
225
+ The vendored health schema and the code generated from it are Apache 2.0
226
+ licensed; see [`proto/LICENSE`](proto/LICENSE). All package archives pin
227
+ `allowed_push_host=https://rubygems.org`; these checks never publish or release
228
+ a gem.
@@ -0,0 +1,143 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ConnectRPC
4
+ module Health
5
+ # Per-service serving status for the standard grpc.health.v1 service.
6
+ # Status updates are safe from any thread or fiber. Watch handlers send only
7
+ # on their own stream's reactor/thread; updates signal them through one
8
+ # Mutex and a ConditionVariable per watcher, never by sending directly.
9
+ class Registry
10
+ STATUSES = %i[unknown serving not_serving].freeze
11
+ # grpc-go's List limit; larger registries fail resource_exhausted.
12
+ LIST_LIMIT = 100
13
+ WIRE = { unknown: :UNKNOWN, serving: :SERVING, not_serving: :NOT_SERVING,
14
+ service_unknown: :SERVICE_UNKNOWN }.freeze
15
+ private_constant :STATUSES, :LIST_LIMIT, :WIRE
16
+
17
+ attr_reader :handlers
18
+
19
+ def initialize(max_watchers: 100)
20
+ unless max_watchers.is_a?(Integer) && max_watchers.positive?
21
+ raise ArgumentError, "max_watchers must be a positive Integer"
22
+ end
23
+
24
+ @max_watchers = max_watchers
25
+ @mutex = Mutex.new
26
+ @statuses = { "" => :serving }
27
+ @watchers = []
28
+ @shutdown = false
29
+ @handlers = ::Grpc::Health::V1::Health.handlers(check: method(:check), list: method(:list),
30
+ watch: method(:watch)).freeze
31
+ end
32
+
33
+ # Returns false, without a change, after shutdown.
34
+ def set(service, status) # rubocop:disable Naming/PredicateMethod
35
+ name = service_name(service)
36
+ raise ArgumentError, "status must be :unknown, :serving or :not_serving" unless STATUSES.include?(status)
37
+
38
+ @mutex.synchronize do
39
+ return false if @shutdown
40
+
41
+ @statuses[name] = status
42
+ @watchers.each { |watcher| watcher.update(status) if watcher.service == name }
43
+ end
44
+ true
45
+ end
46
+
47
+ def status(service)
48
+ name = service_name(service)
49
+ @mutex.synchronize { @statuses[name] }
50
+ end
51
+
52
+ # Marks every entry not serving and ends existing Watch streams after
53
+ # their final status. Later Watch calls fail unavailable. Idempotent.
54
+ def shutdown
55
+ @mutex.synchronize do
56
+ next if @shutdown
57
+
58
+ @shutdown = true
59
+ @statuses.transform_values! { :not_serving }
60
+ @watchers.each { |watcher| watcher.close((:not_serving if @statuses.key?(watcher.service))) }
61
+ end
62
+ nil
63
+ end
64
+
65
+ def shutdown? = @mutex.synchronize { @shutdown }
66
+ def watcher_count = @mutex.synchronize { @watchers.size }
67
+
68
+ private
69
+
70
+ def service_name(service)
71
+ raise ArgumentError, "service must be a String" unless service.is_a?(String)
72
+
73
+ # encode always returns a copy, so the stored name is never shared.
74
+ name = service.encode(Encoding::UTF_8)
75
+ raise ArgumentError, "service must be valid UTF-8" unless name.valid_encoding?
76
+
77
+ name.freeze
78
+ rescue EncodingError
79
+ raise ArgumentError, "service must be valid UTF-8"
80
+ end
81
+
82
+ def response(status)
83
+ ::Grpc::Health::V1::HealthCheckResponse.new(status: WIRE.fetch(status))
84
+ end
85
+
86
+ def check(request, _context)
87
+ status = @mutex.synchronize { @statuses[request.service] }
88
+ raise Error.new(:not_found, "unknown service"), cause: nil unless status
89
+
90
+ response(status)
91
+ end
92
+
93
+ def list(_request, _context)
94
+ snapshot = @mutex.synchronize { @statuses.dup }
95
+ raise Error.new(:resource_exhausted, "health list exceeds #{LIST_LIMIT} services"), cause: nil if
96
+ snapshot.size > LIST_LIMIT
97
+
98
+ ::Grpc::Health::V1::HealthListResponse.new(statuses: snapshot.transform_values { |status| response(status) })
99
+ end
100
+
101
+ def watch(request, writer, context)
102
+ watcher = admit(request.service)
103
+ begin
104
+ # The listener may run synchronously here, so register it outside the
105
+ # non-reentrant mutex; the watcher re-checks its flag before waiting.
106
+ registration = context.on_cancel { watcher.cancel }
107
+ stream(watcher, writer, context)
108
+ ensure
109
+ registration&.unregister
110
+ @mutex.synchronize { @watchers.delete(watcher) }
111
+ end
112
+ end
113
+
114
+ def admit(service)
115
+ @mutex.synchronize do
116
+ raise Error.new(:unavailable, "health service is shutting down"), cause: nil if @shutdown
117
+ raise Error.new(:resource_exhausted, "too many health watchers"), cause: nil if
118
+ @watchers.size >= @max_watchers
119
+
120
+ watcher = Watcher.new(@mutex, service, @statuses.fetch(service, :service_unknown))
121
+ @watchers << watcher
122
+ watcher
123
+ end
124
+ end
125
+
126
+ # Context checks and sends happen outside the registry mutex.
127
+ def stream(watcher, writer, context)
128
+ last = nil
129
+ while (status = watcher.next_status(last, context.deadline))
130
+ case status
131
+ when :cancelled then fail_with(context, :canceled, "Call canceled")
132
+ when :expired then fail_with(context, :deadline_exceeded, "Deadline exceeded")
133
+ end
134
+ writer.send_message(response(status))
135
+ last = status
136
+ end
137
+ end
138
+
139
+ # Prefers the context's own arbitrated reason when it has one.
140
+ def fail_with(context, code, message) = context.check! || raise(Error.new(code, message), cause: nil)
141
+ end
142
+ end
143
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ConnectRPC
4
+ module Health
5
+ VERSION = "0.1.2" # x-release-please-version
6
+ end
7
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ConnectRPC
4
+ module Health
5
+ # One Watch stream's state, guarded by its registry's mutex. The pending
6
+ # slot holds only the latest unsent status, so slow streams coalesce.
7
+ class Watcher
8
+ attr_reader :service
9
+
10
+ def initialize(mutex, service, pending)
11
+ @mutex = mutex
12
+ @service = service
13
+ @pending = pending
14
+ @cancelled = false
15
+ @closing = false
16
+ @condition = ConditionVariable.new
17
+ end
18
+
19
+ # Callers hold the registry mutex.
20
+ def update(status)
21
+ @pending = status
22
+ @condition.signal
23
+ end
24
+
25
+ # Callers hold the registry mutex. A nil status ends without another message.
26
+ def close(status)
27
+ @pending = status if status
28
+ @closing = true
29
+ @condition.signal
30
+ end
31
+
32
+ # Runs in a cancellation listener, outside the registry mutex.
33
+ def cancel
34
+ @mutex.synchronize do
35
+ @cancelled = true
36
+ @condition.signal
37
+ end
38
+ end
39
+
40
+ # The next status to send, nil to end with OK, or :cancelled / :expired.
41
+ # Repeated statuses are skipped. Every flag is re-checked under the mutex
42
+ # before waiting, so a signal sent while the stream was busy is not lost.
43
+ def next_status(last, deadline)
44
+ @mutex.synchronize do
45
+ loop do
46
+ break :cancelled if @cancelled
47
+
48
+ pending = take_pending
49
+ break pending if pending && pending != last
50
+ break if @closing
51
+ break :expired if deadline&.expired?
52
+
53
+ @condition.wait(@mutex, deadline&.native_timeout)
54
+ end
55
+ end
56
+ end
57
+
58
+ private
59
+
60
+ def take_pending
61
+ pending = @pending
62
+ @pending = nil
63
+ pending
64
+ end
65
+ end
66
+ private_constant :Watcher
67
+ end
68
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "connectrpc"
4
+ require "google/protobuf"
5
+
6
+ # The generated files use the canonical feature name grpc/health/v1/health_pb,
7
+ # which the grpc gem shares with an older descriptor that lacks List. Load this
8
+ # package's own file by path, so the glue's feature-name require cannot resolve
9
+ # to the grpc gem's file when that comes first on the load path. An older
10
+ # descriptor already in the generated pool still breaks the List declarations.
11
+ pool = Google::Protobuf::DescriptorPool.generated_pool
12
+ require_relative "../grpc/health/v1/health_pb" unless pool.lookup("grpc.health.v1.HealthCheckRequest")
13
+ unless pool.lookup("grpc.health.v1.HealthListRequest")
14
+ raise LoadError, "An older grpc.health.v1 descriptor without List is already loaded; " \
15
+ "require \"connectrpc/health\" before the grpc gem's health files"
16
+ end
17
+
18
+ require "grpc/health/v1/health_connect"
19
+ require_relative "health/version"
20
+ require_relative "health/watcher"
21
+ require_relative "health/registry"
22
+
23
+ module ConnectRPC
24
+ module Health
25
+ SERVICE = ::Grpc::Health::V1::Health::SERVICE
26
+ end
27
+ end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated by protoc-gen-connectrpc-ruby. DO NOT EDIT!
4
+ # source: grpc/health/v1/health.proto
5
+
6
+ require "connectrpc"
7
+ require "grpc/health/v1/health_pb"
8
+
9
+ module Grpc
10
+ module Health
11
+ module V1
12
+ module Health
13
+ %w[SERVICE Client CHECK LIST WATCH].each do |name|
14
+ next unless const_defined?(name, false)
15
+
16
+ raise ::ArgumentError, "Generated service constant already defined: #{self}::#{name}"
17
+ end
18
+
19
+ CHECK = ::ConnectRPC::Method.new(
20
+ service: "grpc.health.v1.Health", name: "Check",
21
+ request_type: ::Google::Protobuf::DescriptorPool.generated_pool.lookup(
22
+ "grpc.health.v1.HealthCheckRequest"
23
+ ).msgclass,
24
+ response_type: ::Google::Protobuf::DescriptorPool.generated_pool.lookup(
25
+ "grpc.health.v1.HealthCheckResponse"
26
+ ).msgclass
27
+ )
28
+
29
+ LIST = ::ConnectRPC::Method.new(
30
+ service: "grpc.health.v1.Health", name: "List",
31
+ request_type: ::Google::Protobuf::DescriptorPool.generated_pool.lookup(
32
+ "grpc.health.v1.HealthListRequest"
33
+ ).msgclass,
34
+ response_type: ::Google::Protobuf::DescriptorPool.generated_pool.lookup(
35
+ "grpc.health.v1.HealthListResponse"
36
+ ).msgclass
37
+ )
38
+
39
+ WATCH = ::ConnectRPC::ServerStreamMethod.new(
40
+ service: "grpc.health.v1.Health", name: "Watch",
41
+ request_type: ::Google::Protobuf::DescriptorPool.generated_pool.lookup(
42
+ "grpc.health.v1.HealthCheckRequest"
43
+ ).msgclass,
44
+ response_type: ::Google::Protobuf::DescriptorPool.generated_pool.lookup(
45
+ "grpc.health.v1.HealthCheckResponse"
46
+ ).msgclass
47
+ )
48
+
49
+ SERVICE = ::ConnectRPC::Service.new(
50
+ name: "grpc.health.v1.Health", methods: [CHECK, LIST, WATCH]
51
+ )
52
+
53
+ class Client
54
+ def initialize(client:)
55
+ @client = client
56
+ end
57
+
58
+ def check(request, **options)
59
+ @client.call(CHECK, request, **options)
60
+ end
61
+
62
+ def list(request, **options)
63
+ @client.call(LIST, request, **options)
64
+ end
65
+
66
+ def watch(request, **options, &)
67
+ @client.server_stream(WATCH, request, **options, &)
68
+ end
69
+ end
70
+
71
+ def self.handlers(check:, list:, watch:)
72
+ raise ::ArgumentError, "check must respond to call" unless check.respond_to?(:call)
73
+ raise ::ArgumentError, "list must respond to call" unless list.respond_to?(:call)
74
+ raise ::ArgumentError, "watch must respond to call" unless watch.respond_to?(:call)
75
+
76
+ { CHECK.path => check, LIST.path => list, WATCH.path => watch }
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: grpc/health/v1/health.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+
8
+ descriptor_data = "\n\x1bgrpc/health/v1/health.proto\x12\x0egrpc.health.v1\"%\n\x12HealthCheckRequest\x12\x0f\n\x07service\x18\x01 \x01(\t\"\xa9\x01\n\x13HealthCheckResponse\x12\x41\n\x06status\x18\x01 \x01(\x0e\x32\x31.grpc.health.v1.HealthCheckResponse.ServingStatus\"O\n\rServingStatus\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x0b\n\x07SERVING\x10\x01\x12\x0f\n\x0bNOT_SERVING\x10\x02\x12\x13\n\x0fSERVICE_UNKNOWN\x10\x03\"\x13\n\x11HealthListRequest\"\xae\x01\n\x12HealthListResponse\x12\x42\n\x08statuses\x18\x01 \x03(\x0b\x32\x30.grpc.health.v1.HealthListResponse.StatusesEntry\x1aT\n\rStatusesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x32\n\x05value\x18\x02 \x01(\x0b\x32#.grpc.health.v1.HealthCheckResponse:\x02\x38\x01\x32\xfd\x01\n\x06Health\x12P\n\x05\x43heck\x12\".grpc.health.v1.HealthCheckRequest\x1a#.grpc.health.v1.HealthCheckResponse\x12M\n\x04List\x12!.grpc.health.v1.HealthListRequest\x1a\".grpc.health.v1.HealthListResponse\x12R\n\x05Watch\x12\".grpc.health.v1.HealthCheckRequest\x1a#.grpc.health.v1.HealthCheckResponse0\x01\x42p\n\x11io.grpc.health.v1B\x0bHealthProtoP\x01Z,google.golang.org/grpc/health/grpc_health_v1\xa2\x02\x0cGrpcHealthV1\xaa\x02\x0eGrpc.Health.V1b\x06proto3"
9
+
10
+ pool = ::Google::Protobuf::DescriptorPool.generated_pool
11
+ pool.add_serialized_file(descriptor_data)
12
+
13
+ module Grpc
14
+ module Health
15
+ module V1
16
+ HealthCheckRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.health.v1.HealthCheckRequest").msgclass
17
+ HealthCheckResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.health.v1.HealthCheckResponse").msgclass
18
+ HealthCheckResponse::ServingStatus = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.health.v1.HealthCheckResponse.ServingStatus").enummodule
19
+ HealthListRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.health.v1.HealthListRequest").msgclass
20
+ HealthListResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.health.v1.HealthListResponse").msgclass
21
+ end
22
+ end
23
+ end
data/proto/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
data/proto/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # gRPC health schema
2
+
3
+ `grpc/health/v1/health.proto` is the unchanged canonical gRPC schema from
4
+ [grpc/grpc-proto](https://github.com/grpc/grpc-proto) at commit
5
+ `2eb777aba6593c31e21f7f69a163486bdc793501`, SHA256
6
+ `164b670058855c6277a0511a14e2a302dd5a8ff899853ca6851b6b201a413d28`.
7
+ Source: https://github.com/grpc/grpc-proto/blob/2eb777aba6593c31e21f7f69a163486bdc793501/grpc/health/v1/health.proto
8
+
9
+ The schema is Apache 2.0 licensed and retains its copyright notice. The license
10
+ text from the same commit is in `LICENSE`. The generated `lib/grpc/health/v1/`
11
+ Ruby files and `rbs/grpc_health_v1/grpc/health/v1/` signatures are derived from
12
+ this schema.
13
+
14
+ `mise run generation:build` produces them with pinned protoc 36.2 and
15
+ `protoc-gen-connectrpc-ruby`. `mise run generation:check` checks byte parity,
16
+ the exact generated file sets and this schema's pinned SHA256. Original
17
+ ConnectRPC work remains MIT licensed, copyright 2026 Jim Myhrberg.
@@ -0,0 +1,92 @@
1
+ // Copyright 2015 The gRPC Authors
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ // The canonical version of this proto can be found at
16
+ // https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto
17
+
18
+ syntax = "proto3";
19
+
20
+ package grpc.health.v1;
21
+
22
+ option csharp_namespace = "Grpc.Health.V1";
23
+ option go_package = "google.golang.org/grpc/health/grpc_health_v1";
24
+ option java_multiple_files = true;
25
+ option java_outer_classname = "HealthProto";
26
+ option java_package = "io.grpc.health.v1";
27
+ option objc_class_prefix = "GrpcHealthV1";
28
+
29
+ message HealthCheckRequest {
30
+ string service = 1;
31
+ }
32
+
33
+ message HealthCheckResponse {
34
+ enum ServingStatus {
35
+ UNKNOWN = 0;
36
+ SERVING = 1;
37
+ NOT_SERVING = 2;
38
+ SERVICE_UNKNOWN = 3; // Used only by the Watch method.
39
+ }
40
+ ServingStatus status = 1;
41
+ }
42
+
43
+ message HealthListRequest {}
44
+
45
+ message HealthListResponse {
46
+ // statuses contains all the services and their respective status.
47
+ map<string, HealthCheckResponse> statuses = 1;
48
+ }
49
+
50
+ // Health is gRPC's mechanism for checking whether a server is able to handle
51
+ // RPCs. Its semantics are documented in
52
+ // https://github.com/grpc/grpc/blob/master/doc/health-checking.md.
53
+ service Health {
54
+ // Check gets the health of the specified service. If the requested service
55
+ // is unknown, the call will fail with status NOT_FOUND. If the caller does
56
+ // not specify a service name, the server should respond with its overall
57
+ // health status.
58
+ //
59
+ // Clients should set a deadline when calling Check, and can declare the
60
+ // server unhealthy if they do not receive a timely response.
61
+ rpc Check(HealthCheckRequest) returns (HealthCheckResponse);
62
+
63
+ // List provides a non-atomic snapshot of the health of all the available
64
+ // services.
65
+ //
66
+ // The server may respond with a RESOURCE_EXHAUSTED error if too many services
67
+ // exist.
68
+ //
69
+ // Clients should set a deadline when calling List, and can declare the server
70
+ // unhealthy if they do not receive a timely response.
71
+ //
72
+ // Clients should keep in mind that the list of health services exposed by an
73
+ // application can change over the lifetime of the process.
74
+ rpc List(HealthListRequest) returns (HealthListResponse);
75
+
76
+ // Performs a watch for the serving status of the requested service.
77
+ // The server will immediately send back a message indicating the current
78
+ // serving status. It will then subsequently send a new message whenever
79
+ // the service's serving status changes.
80
+ //
81
+ // If the requested service is unknown when the call is received, the
82
+ // server will send a message setting the serving status to
83
+ // SERVICE_UNKNOWN but will *not* terminate the call. If at some
84
+ // future point, the serving status of the service becomes known, the
85
+ // server will send a new message with the service's serving status.
86
+ //
87
+ // If the call terminates with status UNIMPLEMENTED, then clients
88
+ // should assume this method is not supported and should not retry the
89
+ // call. If the call terminates with any other status (including OK),
90
+ // clients should retry the call with appropriate exponential backoff.
91
+ rpc Watch(HealthCheckRequest) returns (stream HealthCheckResponse);
92
+ }
@@ -0,0 +1,22 @@
1
+ # Generated by protoc-gen-connectrpc-ruby. DO NOT EDIT!
2
+ # source: grpc/health/v1/health.proto
3
+
4
+ module Grpc
5
+ module Health
6
+ module V1
7
+ module Health
8
+ CHECK: ::ConnectRPC::Method[::Grpc::Health::V1::HealthCheckRequest, ::Grpc::Health::V1::HealthCheckResponse]
9
+ LIST: ::ConnectRPC::Method[::Grpc::Health::V1::HealthListRequest, ::Grpc::Health::V1::HealthListResponse]
10
+ WATCH: ::ConnectRPC::ServerStreamMethod[::Grpc::Health::V1::HealthCheckRequest, ::Grpc::Health::V1::HealthCheckResponse]
11
+ SERVICE: ::ConnectRPC::Service
12
+ class Client
13
+ def initialize: (client: ::ConnectRPC::Client) -> void
14
+ def check: (::Grpc::Health::V1::HealthCheckRequest request, ?metadata: ::ConnectRPC::metadata_input, ?timeout: ::Numeric?, ?cancellation: ::ConnectRPC::CancellationToken?) -> ::ConnectRPC::Response[::Grpc::Health::V1::HealthCheckResponse]
15
+ def list: (::Grpc::Health::V1::HealthListRequest request, ?metadata: ::ConnectRPC::metadata_input, ?timeout: ::Numeric?, ?cancellation: ::ConnectRPC::CancellationToken?) -> ::ConnectRPC::Response[::Grpc::Health::V1::HealthListResponse]
16
+ def watch: (::Grpc::Health::V1::HealthCheckRequest request, ?metadata: ::ConnectRPC::metadata_input, ?timeout: ::Numeric?, ?cancellation: ::ConnectRPC::CancellationToken?) { (::ConnectRPC::ResponseReader[::Grpc::Health::V1::HealthCheckResponse]) -> void } -> nil
17
+ end
18
+ def self.handlers: (check: ((^(::Grpc::Health::V1::HealthCheckRequest, ::ConnectRPC::Context) -> ::Grpc::Health::V1::HealthCheckResponse) | ::ConnectRPC::_Handler[::Grpc::Health::V1::HealthCheckRequest, ::Grpc::Health::V1::HealthCheckResponse]), list: ((^(::Grpc::Health::V1::HealthListRequest, ::ConnectRPC::Context) -> ::Grpc::Health::V1::HealthListResponse) | ::ConnectRPC::_Handler[::Grpc::Health::V1::HealthListRequest, ::Grpc::Health::V1::HealthListResponse]), watch: ((^(::Grpc::Health::V1::HealthCheckRequest, ::ConnectRPC::ResponseWriter[::Grpc::Health::V1::HealthCheckResponse], ::ConnectRPC::StreamingContext) -> void) | ::ConnectRPC::_ServerStreamHandler[::Grpc::Health::V1::HealthCheckRequest, ::Grpc::Health::V1::HealthCheckResponse])) -> ::Hash[::String, ::ConnectRPC::_Handler[::Grpc::Health::V1::HealthCheckRequest, ::Grpc::Health::V1::HealthCheckResponse] | ::ConnectRPC::_Handler[::Grpc::Health::V1::HealthListRequest, ::Grpc::Health::V1::HealthListResponse] | ::ConnectRPC::_ServerStreamHandler[::Grpc::Health::V1::HealthCheckRequest, ::Grpc::Health::V1::HealthCheckResponse]]
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,133 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # This RBS interface is provided for convenience, on a best-effort basis.
3
+ # The library is the definitive source for the API contract; if the RBS file
4
+ # and the library's behavior differ, the library behavior is authoritative.
5
+ # We welcome fixes to change the RBS file to match.
6
+ # source: grpc/health/v1/health.proto
7
+
8
+ module Grpc
9
+ module Health
10
+ module V1
11
+ class HealthCheckRequest < ::Google::Protobuf::AbstractMessage
12
+ include ::Google::Protobuf::_MessageClass[::Grpc::Health::V1::HealthCheckRequest]
13
+
14
+ attr_reader service(): ::String
15
+ attr_writer service(): ::String | ::Symbol
16
+ def clear_service: () -> void
17
+
18
+ type init_map = {
19
+ service: (::String | ::Symbol)?,
20
+ "service" => (::String | ::Symbol)?,
21
+ }
22
+
23
+ def initialize: (?init_map initial_value) -> void
24
+
25
+ def []:
26
+ ("service" name) -> ::String
27
+
28
+ def []=:
29
+ ("service" name, (::String | ::Symbol) value) -> void
30
+ end
31
+
32
+ class HealthCheckResponse < ::Google::Protobuf::AbstractMessage
33
+ module ServingStatus
34
+ extend ::Google::Protobuf::_EnumModule
35
+
36
+ UNKNOWN: 0
37
+
38
+ SERVING: 1
39
+
40
+ NOT_SERVING: 2
41
+
42
+ SERVICE_UNKNOWN: 3
43
+
44
+ def self.lookup:
45
+ (0 number) -> :UNKNOWN
46
+ | (1 number) -> :SERVING
47
+ | (2 number) -> :NOT_SERVING
48
+ | (3 number) -> :SERVICE_UNKNOWN
49
+ | (::int number) -> names?
50
+ | ...
51
+
52
+ def self.resolve:
53
+ (:UNKNOWN name) -> 0
54
+ | (:SERVING name) -> 1
55
+ | (:NOT_SERVING name) -> 2
56
+ | (:SERVICE_UNKNOWN name) -> 3
57
+ | (::Symbol name) -> numbers?
58
+ | ...
59
+
60
+ type names = :UNKNOWN | :SERVING | :NOT_SERVING | :SERVICE_UNKNOWN
61
+
62
+ type strings = "UNKNOWN" | "SERVING" | "NOT_SERVING" | "SERVICE_UNKNOWN"
63
+
64
+ type numbers = 0 | 1 | 2 | 3
65
+ end
66
+
67
+ include ::Google::Protobuf::_MessageClass[::Grpc::Health::V1::HealthCheckResponse]
68
+
69
+ attr_reader status(): ::Grpc::Health::V1::HealthCheckResponse::ServingStatus::names | ::Integer
70
+ attr_writer status(): ::Grpc::Health::V1::HealthCheckResponse::ServingStatus::names | ::Grpc::Health::V1::HealthCheckResponse::ServingStatus::strings | ::Integer | ::Float
71
+ attr_reader status_const(): ::Integer
72
+ def clear_status: () -> void
73
+
74
+ type init_map = {
75
+ status: (::Grpc::Health::V1::HealthCheckResponse::ServingStatus::names | ::Grpc::Health::V1::HealthCheckResponse::ServingStatus::strings | ::Integer | ::Float)?,
76
+ "status" => (::Grpc::Health::V1::HealthCheckResponse::ServingStatus::names | ::Grpc::Health::V1::HealthCheckResponse::ServingStatus::strings | ::Integer | ::Float)?,
77
+ }
78
+
79
+ def initialize: (?init_map initial_value) -> void
80
+
81
+ def []:
82
+ ("status" name) -> (::Grpc::Health::V1::HealthCheckResponse::ServingStatus::names | ::Integer)
83
+
84
+ def []=:
85
+ ("status" name, (::Grpc::Health::V1::HealthCheckResponse::ServingStatus::names | ::Grpc::Health::V1::HealthCheckResponse::ServingStatus::strings | ::Integer | ::Float) value) -> void
86
+ end
87
+
88
+ class HealthListRequest < ::Google::Protobuf::AbstractMessage
89
+ include ::Google::Protobuf::_MessageClass[::Grpc::Health::V1::HealthListRequest]
90
+
91
+ type init_map = {
92
+ }
93
+
94
+ def initialize: (?init_map initial_value) -> void
95
+ end
96
+
97
+ class HealthListResponse < ::Google::Protobuf::AbstractMessage
98
+ include ::Google::Protobuf::_MessageClass[::Grpc::Health::V1::HealthListResponse]
99
+
100
+ # statuses contains all the services and their respective status.
101
+ attr_accessor statuses(): ::Google::Protobuf::Map[::String, ::Grpc::Health::V1::HealthCheckResponse, ::String | ::Symbol, ::Grpc::Health::V1::HealthCheckResponse]
102
+ def clear_statuses: () -> void
103
+
104
+ type init_map = {
105
+ statuses: ::Hash[::String | ::Symbol, ::Grpc::Health::V1::HealthCheckResponse]?,
106
+ "statuses" => ::Hash[::String | ::Symbol, ::Grpc::Health::V1::HealthCheckResponse]?,
107
+ }
108
+
109
+ def initialize: (?init_map initial_value) -> void
110
+
111
+ def []:
112
+ ("statuses" name) -> (::Google::Protobuf::Map[::String, ::Grpc::Health::V1::HealthCheckResponse, ::String | ::Symbol, ::Grpc::Health::V1::HealthCheckResponse])
113
+
114
+ def []=:
115
+ ("statuses" name, (::Google::Protobuf::Map[::String, ::Grpc::Health::V1::HealthCheckResponse, ::String | ::Symbol, ::Grpc::Health::V1::HealthCheckResponse]) value) -> void
116
+ end
117
+ end
118
+ end
119
+ end
120
+
121
+ module Google
122
+ module Protobuf
123
+ class DescriptorPool
124
+ def lookup:
125
+ ("grpc.health.v1.HealthCheckRequest" name) -> (::Google::Protobuf::Descriptor & ::Google::Protobuf::_SpecificDescriptor[singleton(::Grpc::Health::V1::HealthCheckRequest)])
126
+ | ("grpc.health.v1.HealthCheckResponse" name) -> (::Google::Protobuf::Descriptor & ::Google::Protobuf::_SpecificDescriptor[singleton(::Grpc::Health::V1::HealthCheckResponse)])
127
+ | ("grpc.health.v1.HealthCheckResponse.ServingStatus" name) -> (::Google::Protobuf::EnumDescriptor & ::Google::Protobuf::_SpecificEnumDescriptor[singleton(::Grpc::Health::V1::HealthCheckResponse::ServingStatus)])
128
+ | ("grpc.health.v1.HealthListRequest" name) -> (::Google::Protobuf::Descriptor & ::Google::Protobuf::_SpecificDescriptor[singleton(::Grpc::Health::V1::HealthListRequest)])
129
+ | ("grpc.health.v1.HealthListResponse" name) -> (::Google::Protobuf::Descriptor & ::Google::Protobuf::_SpecificDescriptor[singleton(::Grpc::Health::V1::HealthListResponse)])
130
+ | ...
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,19 @@
1
+ module ConnectRPC
2
+ module Health
3
+ VERSION: String
4
+ SERVICE: ::ConnectRPC::Service
5
+
6
+ type status = :unknown | :serving | :not_serving
7
+
8
+ class Registry
9
+ def initialize: (?max_watchers: Integer) -> void
10
+ def set: (String service, status status) -> bool
11
+ def status: (String service) -> status?
12
+ def shutdown: () -> nil
13
+ def shutdown?: () -> bool
14
+ def watcher_count: () -> Integer
15
+ # Check, List and Watch keyed by path, for merging into Server handlers.
16
+ def handlers: () -> ::Hash[::String, ::ConnectRPC::registered_handler]
17
+ end
18
+ end
19
+ end
data/sig/manifest.yaml ADDED
@@ -0,0 +1,2 @@
1
+ dependencies:
2
+ - name: connectrpc
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: connectrpc-health
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - jimeh
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2026-11-16 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: connectrpc
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: 0.1.0
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: 0.1.0
26
+ - !ruby/object:Gem::Dependency
27
+ name: google-protobuf
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 4.36.2
33
+ - - "<"
34
+ - !ruby/object:Gem::Version
35
+ version: '5'
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 4.36.2
43
+ - - "<"
44
+ - !ruby/object:Gem::Version
45
+ version: '5'
46
+ description: Check, List and Watch for grpc.health.v1 with a thread- and fiber-safe
47
+ status registry. Experimental.
48
+ executables: []
49
+ extensions: []
50
+ extra_rdoc_files: []
51
+ files:
52
+ - LICENSE
53
+ - README.md
54
+ - lib/connectrpc/health.rb
55
+ - lib/connectrpc/health/registry.rb
56
+ - lib/connectrpc/health/version.rb
57
+ - lib/connectrpc/health/watcher.rb
58
+ - lib/grpc/health/v1/health_connect.rb
59
+ - lib/grpc/health/v1/health_pb.rb
60
+ - proto/LICENSE
61
+ - proto/README.md
62
+ - proto/grpc/health/v1/health.proto
63
+ - rbs/grpc_health_v1/grpc/health/v1/health_connect.rbs
64
+ - rbs/grpc_health_v1/grpc/health/v1/health_pb.rbs
65
+ - sig/connectrpc-health.rbs
66
+ - sig/manifest.yaml
67
+ homepage: https://github.com/jimeh/connectrpc-ruby
68
+ licenses:
69
+ - MIT
70
+ - Apache-2.0
71
+ metadata:
72
+ allowed_push_host: https://rubygems.org
73
+ rubygems_mfa_required: 'true'
74
+ source_code_uri: https://github.com/jimeh/connectrpc-ruby
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '3.4'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubygems_version: 3.6.9
90
+ specification_version: 4
91
+ summary: Optional standard gRPC health service (grpc.health.v1) for ConnectRPC servers
92
+ test_files: []