@gravito/zenith 1.0.1 → 1.1.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/ECOSYSTEM_EXPANSION_RFC.md +130 -0
  3. package/dist/bin.js +11945 -4241
  4. package/dist/client/assets/index-BSMp8oq_.js +436 -0
  5. package/dist/client/assets/index-BwxlHx-_.css +1 -0
  6. package/dist/client/index.html +2 -2
  7. package/dist/server/index.js +11945 -4241
  8. package/package.json +1 -1
  9. package/scripts/verify-throttle.ts +6 -2
  10. package/scripts/worker.ts +2 -1
  11. package/src/client/Layout.tsx +10 -0
  12. package/src/client/Sidebar.tsx +9 -0
  13. package/src/client/ThroughputChart.tsx +9 -0
  14. package/src/client/WorkerStatus.tsx +14 -3
  15. package/src/client/components/BrandIcons.tsx +30 -0
  16. package/src/client/components/ConfirmDialog.tsx +24 -0
  17. package/src/client/components/JobInspector.tsx +18 -0
  18. package/src/client/components/LogArchiveModal.tsx +51 -2
  19. package/src/client/components/NotificationBell.tsx +9 -0
  20. package/src/client/components/PageHeader.tsx +9 -0
  21. package/src/client/components/Toaster.tsx +10 -0
  22. package/src/client/components/UserProfileDropdown.tsx +9 -0
  23. package/src/client/contexts/AuthContext.tsx +12 -0
  24. package/src/client/contexts/NotificationContext.tsx +25 -0
  25. package/src/client/pages/LoginPage.tsx +9 -0
  26. package/src/client/pages/MetricsPage.tsx +9 -0
  27. package/src/client/pages/OverviewPage.tsx +9 -0
  28. package/src/client/pages/PulsePage.tsx +10 -0
  29. package/src/client/pages/QueuesPage.tsx +9 -0
  30. package/src/client/pages/SchedulesPage.tsx +9 -0
  31. package/src/client/pages/SettingsPage.tsx +9 -0
  32. package/src/client/pages/WorkersPage.tsx +10 -0
  33. package/src/client/utils.ts +9 -0
  34. package/src/server/config/ServerConfigManager.ts +87 -0
  35. package/src/server/index.ts +19 -18
  36. package/src/server/services/AlertService.ts +16 -3
  37. package/src/server/services/LogStreamProcessor.ts +93 -0
  38. package/src/server/services/MaintenanceScheduler.ts +78 -0
  39. package/src/server/services/PulseService.ts +12 -1
  40. package/src/server/services/QueueMetricsCollector.ts +138 -0
  41. package/src/server/services/QueueService.ts +29 -283
  42. package/src/shared/types.ts +126 -27
  43. package/vite.config.ts +1 -1
  44. package/DEMO.md +0 -156
  45. package/dist/client/assets/index-C332gZ-J.css +0 -1
  46. package/dist/client/assets/index-D4HibwTK.js +0 -436
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @gravito/zenith
2
2
 
3
+ ## 1.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @gravito/atlas@2.1.0
9
+ - @gravito/stream@1.0.3
10
+
11
+ ## 1.1.0
12
+
13
+ ### Minor Changes
14
+
15
+ - Implement several more examples and fix module issues, including:
16
+ - Support middleware in core route definitions.
17
+ - Improve Atlas driver loading and dependency injection.
18
+ - Add PostgreSQL support to Ecommerce MVC example.
19
+ - Fix internal type resolution issues across packages.
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies
24
+ - @gravito/atlas@1.2.0
25
+ - @gravito/quasar@1.2.0
26
+ - @gravito/stream@1.0.2
27
+
3
28
  ## 1.0.1
4
29
 
5
30
  ### Patch Changes
@@ -0,0 +1,130 @@
1
+ # Zenith Ecosystem Expansion RFC
2
+
3
+ **Status**: Draft
4
+ **Date**: 2026-01-10
5
+ **Goal**: Expand Zenith monitoring capabilities beyond Gravito/Laravel to Python, Node.js, and Go ecosystems.
6
+
7
+ ---
8
+
9
+ ## 1. Executive Summary
10
+
11
+ Gravito Zenith (Flux Console) is a unified control plane for background job processing. Currently, it supports **Gravito Stream** (Native) and **Laravel Queues** (via `laravel-zenith`). To become a true polyglot observability platform, we need to implement connectors for other popular queue systems.
12
+
13
+ This RFC defines the **Universal Zenith Protocol (UZP)** and proposes implementation roadmaps for Python (Celery) and Node.js (BullMQ).
14
+
15
+ ---
16
+
17
+ ## 2. The Universal Zenith Protocol (UZP)
18
+
19
+ Any background job system can be monitored by Zenith if it implements the following Redis-based interfaces.
20
+
21
+ ### 2.1. Discovery (Heartbeat)
22
+ Workers must announce their presence every 30 seconds to avoid being marked as "Offline".
23
+
24
+ * **Command**: `SETEX flux_console:worker:<worker_id> 60 <payload>`
25
+ * **Payload (JSON)**:
26
+ ```json
27
+ {
28
+ "id": "celery@worker-1",
29
+ "hostname": "pod-xyz",
30
+ "pid": 1234,
31
+ "uptime": 3600,
32
+ "queues": ["high", "default"],
33
+ "concurrency": 4,
34
+ "memory": { "rss": "50MB", "heapUsed": "N/A" },
35
+ "framework": "celery", // "laravel", "bullmq", "asynq"
36
+ "language": "python", // "php", "typescript", "go"
37
+ "timestamp": "2026-01-10T12:00:00Z"
38
+ }
39
+ ```
40
+
41
+ ### 2.2. Event Stream (Logs)
42
+ Workers publish lifecycle events to a shared Pub/Sub channel.
43
+
44
+ * **Command**: `PUBLISH flux_console:logs <payload>`
45
+ * **Payload (JSON)**:
46
+ ```json
47
+ {
48
+ "level": "info", // "info" (start), "success", "error"
49
+ "message": "Processing Task: tasks.send_email",
50
+ "workerId": "celery@worker-1",
51
+ "queue": "default",
52
+ "jobId": "uuid-v4",
53
+ "timestamp": "2026-01-10T12:00:01Z",
54
+ "metadata": {
55
+ "attempt": 1,
56
+ "latency": 45 // ms (for success/error events)
57
+ }
58
+ }
59
+ ```
60
+
61
+ ### 2.3. Metrics (Optional but Recommended)
62
+ Connectors should increment counters for throughput aggregation.
63
+
64
+ * `INCR flux_console:metrics:processed`
65
+ * `INCR flux_console:metrics:failed`
66
+
67
+ ---
68
+
69
+ ## 3. Implementation Plan: Python (Celery)
70
+
71
+ **Target**: `gravito/zenith-celery` (PyPI Package)
72
+
73
+ ### Architecture
74
+ Celery has a rich Signal system. We can hook into `worker_ready`, `task_prerun`, `task_success`, and `task_failure`.
75
+
76
+ ### Component Design
77
+ 1. **ZenithMonitor**: A Celery Bootstep that starts a background thread for Heartbeats.
78
+ 2. **SignalHandlers**:
79
+ * `task_prerun`: Publish `level: info` log.
80
+ * `task_success`: Publish `level: success` log + metrics.
81
+ * `task_failure`: Publish `level: error` log with traceback.
82
+
83
+ ### Configuration
84
+ ```python
85
+ # celery.py
86
+ app.conf.zenith_redis_url = "redis://localhost:6379/0"
87
+ app.conf.zenith_enabled = True
88
+ ```
89
+
90
+ ---
91
+
92
+ ## 4. Implementation Plan: Node.js (BullMQ)
93
+
94
+ **Target**: `@gravito/zenith-bullmq` (NPM Package)
95
+
96
+ *Note: Gravito Stream is based on BullMQ principles but internal. This adapter allows *standard* BullMQ instances (e.g., in a NestJS app) to report to Zenith.*
97
+
98
+ ### Architecture
99
+ BullMQ uses `QueueEvents` (which listens to Redis streams). A separate "Monitor" process is the best approach to avoid modifying the worker code too much.
100
+
101
+ ### Component Design
102
+ 1. **ZenithMonitor Class**:
103
+ ```typescript
104
+ const monitor = new ZenithMonitor({
105
+ connection: redisOptions,
106
+ queues: ['email', 'reports']
107
+ });
108
+ monitor.start();
109
+ ```
110
+ 2. It listens to BullMQ global events (completed, failed) and bridges them to UZP.
111
+ 3. **Heartbeat**: Since BullMQ workers don't have a central registry, the Monitor acts as a "Virtual Worker" or we require users to instantiate a `ZenithWorker` wrapper.
112
+
113
+ ---
114
+
115
+ ## 5. Implementation Plan: Go (Asynq)
116
+
117
+ **Target**: `github.com/gravito-framework/zenith-asynq`
118
+
119
+ ### Architecture
120
+ Asynq provides `Server` middleware.
121
+
122
+ ### Component Design
123
+ 1. **Middleware**: `zenith.NewMiddleware(redisClient)`.
124
+ 2. Wraps handler execution to capture Start/Success/Fail times.
125
+ 3. Publishes to Redis asynchronously.
126
+
127
+ ---
128
+
129
+ ## 6. Future Work: Rust (Faktory?)
130
+ (To be determined based on demand)