prosody 0.1.1 → 0.1.3

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: 0f289892abe26b82d26930f960b62c85099389e346cfa529bcc9813b0b15bf35
4
- data.tar.gz: 8b872d6abeb6de9bd875ba38e06756b9b5d5bf3bd474ead62e1d455d44c57d25
3
+ metadata.gz: 860e51b041d404b7b12b4cd15fd7bd7b29c96b1c45fe7b302d6300ab534a6995
4
+ data.tar.gz: afa8af17fdb47106755a92b1fb577f207e2c4775dcab673e6e4e0c88c5203c30
5
5
  SHA512:
6
- metadata.gz: 80d93d0985b60c0202229de769b8015a4cb28bc1d7ee9d5fe20c0d35d50e4aa4e8420de283a78d1264ebf512ffd19af126a3627441540ffb1af23d2dd2451324
7
- data.tar.gz: f244a973e52b2b7ed2cb0b3913eb11e42a2e4d40396eb4a4dc8216cd34d40f703a35b276b121b4a5beec3d926900c1cec67d6979826bad20234f6ec58a094929
6
+ metadata.gz: a80186ed25d2dfddcc6693ac7e8e4d27dca16d99dfa40462f3188012803f8b07cfbadaece2dc9b65c8a66bb8794111d5720eaf8b280b55ece0b460719b8352e2
7
+ data.tar.gz: 81f46464005e4aaa87e0a3f5712e8a988f850eaa72380864b30e87b334011727c98da847f78abc73d25f83556f51aac1429d456ad30a7aa37dd6eea247b356ec
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "0.1.1"
2
+ ".": "0.1.3"
3
3
  }
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.3](https://github.com/prosody-events/prosody-rb/compare/prosody/v0.1.2...prosody/v0.1.3) (2026-04-21)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **tracing:** set error status on on_message and on_timer spans ([#14](https://github.com/prosody-events/prosody-rb/issues/14)) ([849c021](https://github.com/prosody-events/prosody-rb/commit/849c0212b88d1069fc728ab38e9e05d79408c093))
9
+
10
+ ## [0.1.2](https://github.com/prosody-events/prosody-rb/compare/prosody/v0.1.1...prosody/v0.1.2) (2026-04-20)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **deps:** upgrade prosody to 0.1.2 ([#12](https://github.com/prosody-events/prosody-rb/issues/12)) ([381a5d9](https://github.com/prosody-events/prosody-rb/commit/381a5d9b53092680bb81bef406b3180ec6ace305))
16
+
3
17
  ## [0.1.1](https://github.com/prosody-events/prosody-rb/compare/prosody/v0.1.0...prosody/v0.1.1) (2026-04-14)
4
18
 
5
19
 
data/Cargo.lock CHANGED
@@ -1701,7 +1701,7 @@ dependencies = [
1701
1701
  "futures",
1702
1702
  "magnus",
1703
1703
  "opentelemetry",
1704
- "prosody 0.1.1",
1704
+ "prosody 0.1.2",
1705
1705
  "rb-sys",
1706
1706
  "serde",
1707
1707
  "serde-untagged",
@@ -1717,9 +1717,9 @@ dependencies = [
1717
1717
 
1718
1718
  [[package]]
1719
1719
  name = "prosody"
1720
- version = "0.1.1"
1720
+ version = "0.1.2"
1721
1721
  source = "registry+https://github.com/rust-lang/crates.io-index"
1722
- checksum = "cf07bd61886febe163f11b58a99e1d02d5b9ea56b1bb43af63e3c94251e5123b"
1722
+ checksum = "31165aa5c07d25b92ab22a47d9400b20b1115f702b55c4c0325d51e285903b83"
1723
1723
  dependencies = [
1724
1724
  "ahash",
1725
1725
  "aho-corasick",
@@ -2215,9 +2215,9 @@ dependencies = [
2215
2215
 
2216
2216
  [[package]]
2217
2217
  name = "sdd"
2218
- version = "4.8.3"
2218
+ version = "4.8.6"
2219
2219
  source = "registry+https://github.com/rust-lang/crates.io-index"
2220
- checksum = "0ec3c6d3fde776a6aadfda5991a2e14ba161c9bbe317da88732a5ded4ac4c493"
2220
+ checksum = "e5f0e40a01b94e35d1dacbcfbe5bfd3d31e37d9590b2e6d86a82b0e87bd4f551"
2221
2221
  dependencies = [
2222
2222
  "saa",
2223
2223
  ]
@@ -2561,9 +2561,9 @@ dependencies = [
2561
2561
 
2562
2562
  [[package]]
2563
2563
  name = "tokio"
2564
- version = "1.52.0"
2564
+ version = "1.52.1"
2565
2565
  source = "registry+https://github.com/rust-lang/crates.io-index"
2566
- checksum = "a91135f59b1cbf38c91e73cf3386fca9bb77915c45ce2771460c9d92f0f3d776"
2566
+ checksum = "b67dee974fe86fd92cc45b7a95fdd2f99a36a6d7b0d431a231178d3d670bbcc6"
2567
2567
  dependencies = [
2568
2568
  "bytes",
2569
2569
  "libc",
@@ -2833,9 +2833,9 @@ checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c"
2833
2833
 
2834
2834
  [[package]]
2835
2835
  name = "typenum"
2836
- version = "1.19.0"
2836
+ version = "1.20.0"
2837
2837
  source = "registry+https://github.com/rust-lang/crates.io-index"
2838
- checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"
2838
+ checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de"
2839
2839
 
2840
2840
  [[package]]
2841
2841
  name = "unarray"
@@ -2875,9 +2875,9 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
2875
2875
 
2876
2876
  [[package]]
2877
2877
  name = "uuid"
2878
- version = "1.23.0"
2878
+ version = "1.23.1"
2879
2879
  source = "registry+https://github.com/rust-lang/crates.io-index"
2880
- checksum = "5ac8b6f42ead25368cf5b098aeb3dc8a1a2c05a3eee8a9a1a68c640edbfc79d9"
2880
+ checksum = "ddd74a9687298c6858e9b88ec8935ec45d22e8fd5e6394fa1bd4e99a87789c76"
2881
2881
  dependencies = [
2882
2882
  "getrandom 0.4.2",
2883
2883
  "js-sys",
@@ -2981,11 +2981,11 @@ dependencies = [
2981
2981
 
2982
2982
  [[package]]
2983
2983
  name = "wasip2"
2984
- version = "1.0.2+wasi-0.2.9"
2984
+ version = "1.0.3+wasi-0.2.9"
2985
2985
  source = "registry+https://github.com/rust-lang/crates.io-index"
2986
- checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5"
2986
+ checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6"
2987
2987
  dependencies = [
2988
- "wit-bindgen",
2988
+ "wit-bindgen 0.57.1",
2989
2989
  ]
2990
2990
 
2991
2991
  [[package]]
@@ -2994,7 +2994,7 @@ version = "0.4.0+wasi-0.3.0-rc-2026-01-06"
2994
2994
  source = "registry+https://github.com/rust-lang/crates.io-index"
2995
2995
  checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5"
2996
2996
  dependencies = [
2997
- "wit-bindgen",
2997
+ "wit-bindgen 0.51.0",
2998
2998
  ]
2999
2999
 
3000
3000
  [[package]]
@@ -3318,6 +3318,12 @@ dependencies = [
3318
3318
  "wit-bindgen-rust-macro",
3319
3319
  ]
3320
3320
 
3321
+ [[package]]
3322
+ name = "wit-bindgen"
3323
+ version = "0.57.1"
3324
+ source = "registry+https://github.com/rust-lang/crates.io-index"
3325
+ checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"
3326
+
3321
3327
  [[package]]
3322
3328
  name = "wit-bindgen-core"
3323
3329
  version = "0.51.0"
data/README.md CHANGED
@@ -225,6 +225,7 @@ When a handler fails, retry with exponential backoff:
225
225
  | `defer_failure_threshold` / `PROSODY_DEFER_FAILURE_THRESHOLD` | Disable deferral when failure rate exceeds this | 0.9 |
226
226
  | `defer_failure_window` / `PROSODY_DEFER_FAILURE_WINDOW` | Measure failure rate over this time window | 5m |
227
227
  | `defer_cache_size` / `PROSODY_DEFER_CACHE_SIZE` | Track this many deferred keys in memory | 1024 |
228
+ | `defer_store_cache_size` / `PROSODY_DEFER_STORE_CACHE_SIZE` | Maximum deferred store cache entries per Cassandra defer store | 8192 |
228
229
  | `defer_seek_timeout` / `PROSODY_DEFER_SEEK_TIMEOUT` | Timeout when loading deferred messages | 30s |
229
230
  | `defer_discard_threshold` / `PROSODY_DEFER_DISCARD_THRESHOLD` | Read optimization (rarely needs changing) | 100 |
230
231
 
@@ -0,0 +1,67 @@
1
+ services:
2
+ lgtm:
3
+ image: grafana/otel-lgtm:latest
4
+ ports:
5
+ - "3000:3000" # Grafana UI
6
+ - "4317:4317" # OTLP gRPC ingest
7
+ - "4318:4318" # OTLP HTTP ingest
8
+ - "3200:3200" # Tempo API
9
+ volumes:
10
+ - lgtm_data:/data
11
+ environment:
12
+ GF_PATHS_DATA: /data/grafana
13
+
14
+ kafka:
15
+ image: apache/kafka:latest
16
+ ports:
17
+ - "9094:9094"
18
+ volumes:
19
+ - "kafka_data:/var/lib/kafka/data"
20
+ environment:
21
+ # KRaft settings
22
+ KAFKA_NODE_ID: 0
23
+ KAFKA_PROCESS_ROLES: controller,broker
24
+ KAFKA_CONTROLLER_QUORUM_VOTERS: 0@kafka:9093
25
+ # Listeners
26
+ KAFKA_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094
27
+ KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,EXTERNAL://localhost:9094
28
+ KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,EXTERNAL:PLAINTEXT,PLAINTEXT:PLAINTEXT
29
+ KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
30
+ KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
31
+ # Single-node settings - required for internal topics
32
+ KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
33
+ KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
34
+ KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
35
+ healthcheck:
36
+ test: [ "CMD-SHELL", "/opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --list" ]
37
+ interval: 15s
38
+ timeout: 10s
39
+ retries: 15
40
+ cassandra:
41
+ image: cassandra:latest
42
+ ports:
43
+ - "9042:9042"
44
+ volumes:
45
+ - cassandra_data:/var/lib/cassandra
46
+ healthcheck:
47
+ test: [ "CMD-SHELL", "cqlsh -e 'SELECT cluster_name FROM system.local;'" ]
48
+ interval: 15s
49
+ timeout: 10s
50
+ retries: 15
51
+ console:
52
+ image: docker.redpanda.com/redpandadata/console:latest
53
+ entrypoint: /bin/sh
54
+ command: -c 'echo "$$CONSOLE_CONFIG_FILE" > /tmp/config.yml; /app/console'
55
+ environment:
56
+ CONFIG_FILEPATH: /tmp/config.yml
57
+ CONSOLE_CONFIG_FILE: |
58
+ kafka:
59
+ brokers: ["kafka:9092"]
60
+ ports:
61
+ - "8080:8080"
62
+ depends_on:
63
+ - kafka
64
+ volumes:
65
+ kafka_data:
66
+ cassandra_data:
67
+ lgtm_data:
@@ -26,8 +26,8 @@ impl AsyncCallback {
26
26
  /// # Arguments
27
27
  ///
28
28
  /// * `queue` - A Ruby Queue object that will receive values from Rust
29
- /// * `bridge` - The bridge used to defer cleanup of the wrapped queue
30
- /// value onto the Ruby thread when the callback is dropped
29
+ /// * `bridge` - The bridge used to defer cleanup of the wrapped queue value
30
+ /// onto the Ruby thread when the callback is dropped
31
31
  pub fn from_queue(queue: Value, bridge: Bridge) -> Self {
32
32
  Self {
33
33
  queue: ThreadSafeValue::new(queue, bridge),
@@ -175,6 +175,10 @@ pub struct NativeConfiguration {
175
175
  /// Cache size for defer middleware.
176
176
  defer_cache_size: Option<u32>,
177
177
 
178
+ /// Maximum number of deferred store entries kept in the write-through cache
179
+ /// per Cassandra defer store.
180
+ defer_store_cache_size: Option<u32>,
181
+
178
182
  /// Timeout for Kafka seek operations (in seconds).
179
183
  defer_seek_timeout: Option<f32>,
180
184
 
@@ -651,6 +655,10 @@ impl<'a> From<&'a NativeConfiguration> for DeferConfigurationBuilder {
651
655
  builder.cache_size(*cache_size as usize);
652
656
  }
653
657
 
658
+ if let Some(store_cache_size) = &config.defer_store_cache_size {
659
+ builder.store_cache_size(*store_cache_size as usize);
660
+ }
661
+
654
662
  if let Some(seek_timeout) = &config.defer_seek_timeout {
655
663
  builder.seek_timeout(Duration::from_secs_f32(*seek_timeout));
656
664
  }
@@ -21,6 +21,7 @@ use futures::pin_mut;
21
21
  use magnus::value::ReprValue;
22
22
  use magnus::{Error, Ruby, Value};
23
23
  use opentelemetry::propagation::TextMapCompositePropagator;
24
+ use opentelemetry::trace::Status;
24
25
  use prosody::consumer::event_context::EventContext;
25
26
  use prosody::consumer::message::ConsumerMessage;
26
27
  use prosody::consumer::middleware::FallibleHandler;
@@ -33,6 +34,7 @@ use std::sync::Arc;
33
34
  use thiserror::Error;
34
35
  use tokio::select;
35
36
  use tracing::{Instrument, info_span};
37
+ use tracing_opentelemetry::OpenTelemetrySpanExt;
36
38
 
37
39
  mod context;
38
40
  mod message;
@@ -179,11 +181,13 @@ impl FallibleHandler for RubyHandler {
179
181
  // Wait for either task completion or shutdown signal
180
182
  select! {
181
183
  result = &mut result_future => {
182
- result?;
184
+ result.inspect_err(|e| cloned_span.set_status(Status::error(e.to_string())))?;
183
185
  }
184
186
  () = cancel_future => {
185
- // If cancellation requested, cancel the task and wait for it to complete
186
- task_handle.cancellation_token.cancel(&self.bridge).await?;
187
+ // A cancel() failure is a genuine bridge error; mark the span.
188
+ // The subsequent result_future error is expected cancellation, not a handler bug.
189
+ task_handle.cancellation_token.cancel(&self.bridge).await
190
+ .inspect_err(|e| cloned_span.set_status(Status::error(e.to_string())))?;
187
191
  result_future.await?;
188
192
  }
189
193
  }
@@ -262,11 +266,13 @@ impl FallibleHandler for RubyHandler {
262
266
  // Wait for either task completion or shutdown signal
263
267
  select! {
264
268
  result = &mut result_future => {
265
- result?;
269
+ result.inspect_err(|e| cloned_span.set_status(Status::error(e.to_string())))?;
266
270
  }
267
271
  () = cancel_future => {
268
- // If cancellation requested, cancel the task and wait for it to complete
269
- task_handle.cancellation_token.cancel(&self.bridge).await?;
272
+ // A cancel() failure is a genuine bridge error; mark the span.
273
+ // The subsequent result_future error is expected cancellation, not a handler bug.
274
+ task_handle.cancellation_token.cancel(&self.bridge).await
275
+ .inspect_err(|e| cloned_span.set_status(Status::error(e.to_string())))?;
270
276
  result_future.await?;
271
277
  }
272
278
  }
@@ -26,8 +26,8 @@ impl CancellationToken {
26
26
  /// # Arguments
27
27
  ///
28
28
  /// * `token` - A Ruby value that responds to the `cancel` method
29
- /// * `bridge` - The bridge used to defer cleanup of the wrapped token
30
- /// value onto the Ruby thread when the token is dropped
29
+ /// * `bridge` - The bridge used to defer cleanup of the wrapped token value
30
+ /// onto the Ruby thread when the token is dropped
31
31
  pub fn new(token: Value, bridge: Bridge) -> Self {
32
32
  Self {
33
33
  token: ThreadSafeValue::new(token, bridge),
@@ -244,6 +244,9 @@ module Prosody
244
244
  # Cache size for defer middleware.
245
245
  config_param :defer_cache_size, converter: ->(v) { Integer(v) }
246
246
 
247
+ # Maximum deferred store cache entries per Cassandra defer store. Env: PROSODY_DEFER_STORE_CACHE_SIZE
248
+ config_param :defer_store_cache_size, converter: ->(v) { Integer(v) }
249
+
247
250
  # Timeout for Kafka seek operations (in seconds).
248
251
  config_param :defer_seek_timeout, converter: ->(v) { duration_converter(v) }
249
252
 
@@ -6,5 +6,5 @@ module Prosody
6
6
  # This version number follows semantic versioning and is used by the
7
7
  # gem system to identify the library version. It should be updated
8
8
  # according to semver guidelines when making releases.
9
- VERSION = "0.1.1"
9
+ VERSION = "0.1.3"
10
10
  end
@@ -202,6 +202,10 @@ module Prosody
202
202
  def defer_cache_size: () -> Integer?
203
203
  def defer_cache_size=: (Integer | _ToInt) -> Integer
204
204
 
205
+ # Maximum deferred store cache entries. Env: PROSODY_DEFER_STORE_CACHE_SIZE
206
+ def defer_store_cache_size: () -> Integer?
207
+ def defer_store_cache_size=: (Integer | _ToInt) -> Integer
208
+
205
209
  # Defer seek timeout (seconds)
206
210
  def defer_seek_timeout: () -> Float?
207
211
  def defer_seek_timeout=: (Numeric) -> Float
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prosody
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Griffith
@@ -131,6 +131,7 @@ files:
131
131
  - Makefile
132
132
  - README.md
133
133
  - Rakefile
134
+ - docker-compose.yaml
134
135
  - ext/prosody/Cargo.toml
135
136
  - ext/prosody/extconf.rb
136
137
  - ext/prosody/src/admin.rs