Skip to content

Commit 0f9d471

Browse files
chore: daily sync of plugin metadata and READMEs [automated]
1 parent f71f33d commit 0f9d471

8 files changed

Lines changed: 71 additions & 20 deletions

File tree

plugins/advanced-alchemy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ compatibility:
1616
litestar: '>=2.0.0'
1717
icon: advanced-alchemy.png
1818
stars: 693
19-
monthly_downloads: 109904
19+
monthly_downloads: 115882
2020
latest_version: 1.8.0
2121
updated_at: '2025-10-28T21:01:30'
2222
created_at: '2023-09-17T17:39:42'

plugins/litestar-asyncpg.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ compatibility:
1616
litestar: '>=2.0.0'
1717
icon: litestar-asyncpg.svg
1818
stars: 14
19-
monthly_downloads: 801
19+
monthly_downloads: 663
2020
latest_version: 0.5.0
2121
updated_at: '2025-06-24T16:45:09'
2222
created_at: '2023-10-01T23:31:27'

plugins/litestar-granian.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ compatibility:
1616
litestar: '>=2.0.0'
1717
icon: litestar-granian.png
1818
stars: 38
19-
monthly_downloads: 15296
19+
monthly_downloads: 15952
2020
latest_version: 0.14.2
2121
updated_at: '2025-08-06T19:54:57'
2222
created_at: '2023-10-02T01:42:04'

plugins/litestar-htmx.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ compatibility:
1616
litestar: '>=2.0.0'
1717
icon: litestar-htmx.svg
1818
stars: 12
19-
monthly_downloads: 1067484
19+
monthly_downloads: 1094616
2020
latest_version: 0.5.0
2121
updated_at: '2025-06-11T21:19:45'
2222
created_at: '2024-10-20T17:49:03'

plugins/litestar-saq.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ compatibility:
1616
litestar: '>=2.0.0'
1717
icon: _default_icon.svg
1818
stars: 26
19-
monthly_downloads: 19121
20-
latest_version: 0.5.3
21-
updated_at: '2025-05-05T14:54:31'
19+
monthly_downloads: 22476
20+
latest_version: 0.6.0
21+
updated_at: '2025-12-02T23:39:38'
2222
created_at: '2023-10-04T03:57:48'
2323
python_compatibility_raw: '>=3.9'
2424
python_compatibility:

plugins/litestar-vite.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ compatibility:
1616
litestar: '>=2.0.0'
1717
icon: litestar-vite.svg
1818
stars: 26
19-
monthly_downloads: 14278
19+
monthly_downloads: 15952
2020
latest_version: 0.14.2
2121
updated_at: '2025-08-06T19:54:57'
2222
created_at: '2023-10-02T01:42:04'

plugins/sqlspec.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ compatibility:
1616
litestar: '>=2.0.0'
1717
icon: _default_icon.svg
1818
stars: 48
19-
monthly_downloads: 2487
19+
monthly_downloads: 2510
2020
latest_version: 0.31.0
2121
updated_at: '2025-11-25T15:19:25'
2222
created_at: '2024-10-30T00:48:46'

readmes/litestar-saq.md

Lines changed: 62 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,29 @@
66
pip install litestar-saq
77
```
88

9+
For OpenTelemetry support:
10+
11+
```shell
12+
pip install litestar-saq[otel]
13+
```
14+
915
## Usage
1016

1117
Here is a basic application that demonstrates how to use the plugin.
1218

1319
```python
14-
from __future__ import annotations
15-
1620
from litestar import Litestar
17-
1821
from litestar_saq import QueueConfig, SAQConfig, SAQPlugin
1922

20-
saq = SAQPlugin(config=SAQConfig(dsn="redis://localhost:6397/0", queue_configs=[QueueConfig(name="samples")]))
23+
saq = SAQPlugin(
24+
config=SAQConfig(
25+
use_server_lifespan=True,
26+
queue_configs=[
27+
QueueConfig(name="samples", dsn="redis://localhost:6379/0")
28+
],
29+
)
30+
)
2131
app = Litestar(plugins=[saq])
22-
23-
2432
```
2533

2634
You can start a background worker with the following command now:
@@ -29,7 +37,7 @@ You can start a background worker with the following command now:
2937
litestar --app-dir=examples/ --app basic:app workers run
3038
Using Litestar app from env: 'basic:app'
3139
Starting SAQ Workers ──────────────────────────────────────────────────────────────────
32-
INFO - 2023-10-04 17:39:03,255 - saq - worker - Worker starting: Queue<redis=Redis<ConnectionPool<Connection<host=localhost,port=6397,db=0>>>, name='samples'>
40+
INFO - 2023-10-04 17:39:03,255 - saq - worker - Worker starting: Queue<redis=Redis<ConnectionPool<Connection<host=localhost,port=6379,db=0>>>, name='samples'>
3341
INFO - 2023-10-04 17:39:06,545 - saq - worker - Worker shutting down
3442
```
3543

@@ -39,7 +47,7 @@ You can also start the process for only specific queues. This is helpful if you
3947
litestar --app-dir=examples/ --app basic:app workers run --queues sample
4048
Using Litestar app from env: 'basic:app'
4149
Starting SAQ Workers ──────────────────────────────────────────────────────────────────
42-
INFO - 2023-10-04 17:39:03,255 - saq - worker - Worker starting: Queue<redis=Redis<ConnectionPool<Connection<host=localhost,port=6397,db=0>>>, name='samples'>
50+
INFO - 2023-10-04 17:39:03,255 - saq - worker - Worker starting: Queue<redis=Redis<ConnectionPool<Connection<host=localhost,port=6379,db=0>>>, name='samples'>
4351
INFO - 2023-10-04 17:39:06,545 - saq - worker - Worker shutting down
4452
```
4553

@@ -49,16 +57,59 @@ If you are starting the process for only specific queues and still want to read
4957
import os
5058
from saq import Queue
5159

52-
5360
def get_queue_directly(queue_name: str, redis_url: str) -> Queue:
5461
return Queue.from_url(redis_url, name=queue_name)
5562

5663
redis_url = os.getenv("REDIS_URL")
5764
queue = get_queue_directly("queue-in-other-process", redis_url)
65+
5866
# Get queue info
5967
info = await queue.info(jobs=True)
68+
6069
# Enqueue new task
61-
queue.enqueue(
62-
....
70+
await queue.enqueue("task_name", arg1="value1")
71+
```
72+
73+
## Monitored Jobs
74+
75+
For long-running tasks, use the `monitored_job` decorator to automatically send heartbeats and prevent SAQ from marking jobs as stuck:
76+
77+
```python
78+
from litestar_saq import monitored_job
79+
80+
@monitored_job() # Auto-calculates interval from job.heartbeat
81+
async def long_running_task(ctx):
82+
await process_large_dataset()
83+
return {"status": "complete"}
84+
85+
@monitored_job(interval=30.0) # Explicit 30-second interval
86+
async def train_model(ctx, model_id: str):
87+
for epoch in range(100):
88+
await train_epoch(model)
89+
return {"model_id": model_id}
90+
```
91+
92+
## OpenTelemetry Integration
93+
94+
litestar-saq supports optional OpenTelemetry instrumentation for distributed tracing.
95+
96+
### Configuration
97+
98+
```python
99+
from litestar_saq import SAQConfig, QueueConfig
100+
101+
config = SAQConfig(
102+
queue_configs=[QueueConfig(dsn="redis://localhost:6379/0")],
103+
enable_otel=None, # Auto-detect (default) - enabled if OTEL installed AND Litestar OpenTelemetryPlugin is active
104+
# enable_otel=True, # Force enable (raises error if not installed)
105+
# enable_otel=False, # Force disable
63106
)
64107
```
108+
109+
When enabled, the plugin creates:
110+
111+
- **CONSUMER spans** for job processing
112+
- **PRODUCER spans** for job enqueue operations
113+
- **Automatic context propagation** across process boundaries
114+
115+
Spans follow [OpenTelemetry messaging semantic conventions](https://opentelemetry.io/docs/specs/semconv/messaging/) with `messaging.system = "saq"`.

0 commit comments

Comments
 (0)