leopard 0.2.10 → 0.3.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: 61ef512c45c7a77049bcb82926d8f77f30986d3e63cad9f500f6bfc729968448
4
- data.tar.gz: b27aeba2b9a28e286420dfe5a32be1cfc22792cd7d68c317178b7b463adbf9d9
3
+ metadata.gz: 79ba04039c1795930b780fe4d958bc4cac050d641f079222f6c07737fd3a9f67
4
+ data.tar.gz: 2327bd745905c55a56c6ee7b1e6f5a00f9f2c69a86b63402d50dac5b1f09d3b3
5
5
  SHA512:
6
- metadata.gz: b49256564d284e559c04e52bc689eeb5113d9ddc7d3fa4279c5d6bcca19501bc297595ab2f7481eb12a47b3cf7dffbe5a98fa7e7fc57f32357023ebc1296bc8c
7
- data.tar.gz: dd3a974237972a781b51aa24ba3295e4be1ac49a56d2a9e5f3dc678db716cb7ec3f7813ce5a41e3eb224129ea7b795c7c01efa863ca991a050e69c026dd920c4
6
+ metadata.gz: e3fa984d0d8742e780ed80619beb2333f7caa41f7435459c3d34d4cd5f883427c0f791e8e35547494f2c421cee65346b9119f30075800e52effbff1aff5bbf9f
7
+ data.tar.gz: c7c4332092d9ef57586b52f273518e4b40444e6a9b4fa8804ad0073a89f6fc35900c273d79a62efe283f6650c46bf50ddb25ab1ace09f2954de64cfd70a9690d
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "0.2.10"
2
+ ".": "0.3.1"
3
3
  }
data/.version.txt CHANGED
@@ -1 +1 @@
1
- 0.2.10
1
+ 0.3.1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,62 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.1](https://github.com/rubyists/leopard/compare/v0.3.0...v0.3.1) (2026-10-08)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * Add empty line ([aedb08d](https://github.com/rubyists/leopard/commit/aedb08d7760beea26cd237c646a0860b04c25a68))
9
+ * enable jetstream endpoint to resolve stream from subject and add error logs ([1cdeaf6](https://github.com/rubyists/leopard/commit/1cdeaf699c15f6fffdd5de70cdf243325c5a0431))
10
+ * Enable jetstream endpoint to resolve stream from subject and add error logs ([923dda5](https://github.com/rubyists/leopard/commit/923dda50850698d4bc2f358c49ade4f15d0d104b))
11
+ * Pass endpoint name when durable is not available ([06e88c7](https://github.com/rubyists/leopard/commit/06e88c7a520c0f6dfec0f88110a039bea9b4c56f))
12
+ * Remove ensure_consumer and fallback on pull_subscrbe to resolve stream ([909230c](https://github.com/rubyists/leopard/commit/909230ca55b85b42fda3703aa06cb00e4726b089))
13
+ * Update integration test to reflect reliance on pull_subscribe ([b39fe75](https://github.com/rubyists/leopard/commit/b39fe75c9142dbdb2358e01d5ba6d96ec777c938))
14
+
15
+ ## [0.3.0](https://github.com/rubyists/leopard/compare/v0.2.11...v0.3.0) (2026-09-18)
16
+
17
+
18
+ ### ⚠ BREAKING CHANGES
19
+
20
+ * Big move to use kwargs as the initializer for classes which include us ([#28](https://github.com/rubyists/leopard/issues/28))
21
+
22
+ ### Features
23
+
24
+ * add NATS service discovery tools ([#58](https://github.com/rubyists/leopard/issues/58)) ([#59](https://github.com/rubyists/leopard/issues/59)) ([382d5e7](https://github.com/rubyists/leopard/commit/382d5e7e19367796145bec07e4bda686268905ae))
25
+ * add nats_jetstream_consumer to provide the feature requested in issue [#44](https://github.com/rubyists/leopard/issues/44) ([#45](https://github.com/rubyists/leopard/issues/45)) ([9372aa4](https://github.com/rubyists/leopard/commit/9372aa4ce59b130e7143905ce5e8065519778861))
26
+ * add optional prometheus metrics endpoint with saturation metrics ([#42](https://github.com/rubyists/leopard/issues/42)) ([fcd767a](https://github.com/rubyists/leopard/commit/fcd767ab5438c92bf50800d50027b43b7d0f9f0e))
27
+ * Adds gemspec and gemfile ([#1](https://github.com/rubyists/leopard/issues/1)) ([972dc72](https://github.com/rubyists/leopard/commit/972dc72de804ca10db5cf869d0ea996a94ac9722))
28
+ * Adds graceful shutdown when INT/TERM/QUIT signal is received ([#18](https://github.com/rubyists/leopard/issues/18)) ([ce03fb0](https://github.com/rubyists/leopard/commit/ce03fb00afcbbadadc413766b62df9451f7b73b8))
29
+ * Adds rakefile back ([#3](https://github.com/rubyists/leopard/issues/3)) ([271592c](https://github.com/rubyists/leopard/commit/271592c357e07d58de085297850533eaae60a285))
30
+ * Adds settings to module ([9ff0942](https://github.com/rubyists/leopard/commit/9ff0942dddd86bf4f97bc82626cc7bb35e4115ac))
31
+ * Basic functionality for serving apis ([#4](https://github.com/rubyists/leopard/issues/4)) ([9ff0942](https://github.com/rubyists/leopard/commit/9ff0942dddd86bf4f97bc82626cc7bb35e4115ac))
32
+ * improved leopard saturation metrics ([2303ef2](https://github.com/rubyists/leopard/commit/2303ef223b6b8150d728d827592744bbc75fc1a3))
33
+ * improved leopard saturation metrics ([c143056](https://github.com/rubyists/leopard/commit/c143056683f694eba1704acb84139095887515f4))
34
+ * Initial readme ([4ea9f34](https://github.com/rubyists/leopard/commit/4ea9f341c9df6096b8df3595ff6a075eb9b5c4f6))
35
+ * serialize error payloads ([e87f709](https://github.com/rubyists/leopard/commit/e87f709949baef3fdb001605e2ecce10b1fa3b02))
36
+ * serialize error payloads ([7fdc19f](https://github.com/rubyists/leopard/commit/7fdc19f0419756f21765a9ccb280701a1b9700df))
37
+ * surface handler results to middleware chain ([#47](https://github.com/rubyists/leopard/issues/47)) ([eb046f2](https://github.com/rubyists/leopard/commit/eb046f245cfd3c773167e24b5690308ebb67ff87))
38
+
39
+
40
+ ### Bug Fixes
41
+
42
+ * [#35](https://github.com/rubyists/leopard/issues/35) - Limits the backtrace to 4 lines in our exceptions ([#36](https://github.com/rubyists/leopard/issues/36)) ([df0fee8](https://github.com/rubyists/leopard/commit/df0fee8373fc0088cd61abcc3e6d963e957730b6))
43
+ * Allow non blocking all the way down to the instance level ([#27](https://github.com/rubyists/leopard/issues/27)) ([01748a5](https://github.com/rubyists/leopard/commit/01748a56bc927ee1dbc70d2351fd12037e5b4bef))
44
+ * Big move to use kwargs as the initializer for classes which include us ([#28](https://github.com/rubyists/leopard/issues/28)) ([72293b4](https://github.com/rubyists/leopard/commit/72293b434998679fe3ff2d467a6a39c11a325b5a))
45
+ * content type calculation ([0af4b0b](https://github.com/rubyists/leopard/commit/0af4b0ba3c322ad734730f45eac925a73a760c73))
46
+ * Corrects gemname in publish-gem.sh ([9ff0942](https://github.com/rubyists/leopard/commit/9ff0942dddd86bf4f97bc82626cc7bb35e4115ac))
47
+ * Corrects the version ([#7](https://github.com/rubyists/leopard/issues/7)) ([a3de532](https://github.com/rubyists/leopard/commit/a3de5320a8c54e9ca6724b6e90812bb5b1b7d150))
48
+ * **deps:** remove upper bound from semantic_logger dependency ([#54](https://github.com/rubyists/leopard/issues/54)) ([0b9f154](https://github.com/rubyists/leopard/commit/0b9f154f1b2ec1961dbb176954551b6f9caf16f0))
49
+ * Do not leak SemanticLogger settings outside of isolation ([#30](https://github.com/rubyists/leopard/issues/30)) ([524595c](https://github.com/rubyists/leopard/commit/524595c37f114ec28f40abc841ecb3c7b6579f5a))
50
+ * Ensure we exit after saying Bye Bye ([#33](https://github.com/rubyists/leopard/issues/33)) ([11a7584](https://github.com/rubyists/leopard/commit/11a7584dd88e7c7fb4dbfde613b8186dc4253892))
51
+ * Fixes the gem publisher, and adds missing .version.txt ([#11](https://github.com/rubyists/leopard/issues/11)) ([3dcbd3c](https://github.com/rubyists/leopard/commit/3dcbd3c1d687e04ce5fde85fef5c2d1c10a8a4cc))
52
+ * Have to build the gem before we can find it, doh ([#13](https://github.com/rubyists/leopard/issues/13)) ([62053e9](https://github.com/rubyists/leopard/commit/62053e9d2332d37d4d5697035a35adc71833eccd))
53
+ * only serialize for metrics ([b7c81a6](https://github.com/rubyists/leopard/commit/b7c81a6dd44c326aec57c4e32971e87b4ca75eab))
54
+ * preserve respond_with_error payloads ([#40](https://github.com/rubyists/leopard/issues/40)) ([f5c0d46](https://github.com/rubyists/leopard/commit/f5c0d463ec85556c731da1251897f27f2816310b))
55
+ * Remove sequel cruft in ci config ([#9](https://github.com/rubyists/leopard/issues/9)) ([09a43e2](https://github.com/rubyists/leopard/commit/09a43e23c309167c56095dd608af9d79ff4f9b19))
56
+ * Run in blocking mode, not just non-blocking ([#15](https://github.com/rubyists/leopard/issues/15)) ([a659145](https://github.com/rubyists/leopard/commit/a659145d8a04efe3b3932b99ab4c11ef0ba2025e))
57
+ * set metrics JSON content type ([24196d1](https://github.com/rubyists/leopard/commit/24196d1307dab4153beb1c4142c7cf5ca786d336))
58
+ * Stop sending code argument to respond_with_error, it does not accept it ([#23](https://github.com/rubyists/leopard/issues/23)) ([9d87b8c](https://github.com/rubyists/leopard/commit/9d87b8c308a1fdff72769863711bb6bb942b3677))
59
+
3
60
  ## [0.2.10](https://github.com/rubyists/leopard/compare/v0.2.9...v0.2.10) (2026-09-16)
4
61
 
5
62
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'socket'
4
4
  require 'erb'
5
+ require 'json'
5
6
 
6
7
  module Rubyists
7
8
  module Leopard
@@ -62,8 +63,11 @@ module Rubyists
62
63
  def write_metrics_response(client, request_line, workers)
63
64
  if request_line&.start_with?('GET /metrics')
64
65
  body = prometheus_metrics(workers)
66
+ content_type = body.is_a?(String) ? 'text/plain; version=0.0.4' : 'application/json'
67
+ body = JSON.generate(body) unless body.is_a?(String)
68
+
65
69
  client.write "HTTP/1.1 200 OK\r\n" \
66
- "Content-Type: text/plain; version=0.0.4\r\n" \
70
+ "Content-Type: #{content_type}\r\n" \
67
71
  "Content-Length: #{body.bytesize}\r\n\r\n#{body}"
68
72
  else
69
73
  client.write "HTTP/1.1 404 Not Found\r\nContent-Length: 0\r\n\r\n"
@@ -69,33 +69,27 @@ module Rubyists
69
69
  subscription = build_subscription(endpoint)
70
70
  subscriptions << subscription
71
71
  threads << @thread_factory.new { consume_endpoint(subscription, endpoint) }
72
+ rescue StandardError => e
73
+ @logger.error "JetStream endpoint #{endpoint.name} failed to start: ", e
74
+ raise
72
75
  end
73
76
 
74
- # Ensures the durable consumer exists and creates a pull subscription for it.
77
+ # Creates a pull subscription for the endpoint's durable consumer.
78
+ #
79
+ # No stream is passed, so nats-pure resolves the stream from the subject and adds the durable consumer
80
+ # (using {#consumer_config}) when it does not already exist.
75
81
  #
76
82
  # @param endpoint [NatsJetstreamEndpoint] The endpoint configuration to subscribe to.
77
83
  #
78
84
  # @return [Object] The JetStream pull subscription.
79
85
  def build_subscription(endpoint)
80
- ensure_consumer(endpoint)
81
86
  @jetstream.pull_subscribe(
82
87
  endpoint.subject,
83
- endpoint.durable,
84
- stream: endpoint.stream,
88
+ endpoint.durable || endpoint.name,
89
+ config: consumer_config(endpoint),
85
90
  )
86
91
  end
87
92
 
88
- # Verifies that the durable consumer exists, creating it when missing.
89
- #
90
- # @param endpoint [NatsJetstreamEndpoint] The endpoint configuration to ensure.
91
- #
92
- # @return [Object] Consumer metadata from `consumer_info` or `add_consumer`.
93
- def ensure_consumer(endpoint)
94
- @jetstream.consumer_info(endpoint.stream, endpoint.durable)
95
- rescue NATS::JetStream::Error::NotFound
96
- @jetstream.add_consumer(endpoint.stream, consumer_config(endpoint))
97
- end
98
-
99
93
  # Builds the JetStream consumer configuration for an endpoint.
100
94
  #
101
95
  # @param endpoint [NatsJetstreamEndpoint] The endpoint configuration to translate.
@@ -3,7 +3,7 @@
3
3
  module Rubyists
4
4
  module Leopard
5
5
  # x-release-please-start-version
6
- VERSION = '0.2.10'
6
+ VERSION = '0.3.1'
7
7
  # x-release-please-end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leopard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - bougyman