System Plugin¶
The tangram_system plugin provides a background service that monitors and broadcasts server metrics like CPU load, RAM usage, and uptime. These metrics are displayed in the frontend UI.
How It Works¶
- The plugin's
pyproject.tomlregisters itspluginobject via thetangram_core.pluginsentry point. - This
pluginobject uses the@plugin.register_service()decorator to mark therun_systemfunction as a background service. - When
tangram servestarts, the core framework discovers and runs therun_systemservice. - It publishes these metrics as JSON payloads to the
to:system:update-nodeRedis channel. - The core
tangramfrontend is subscribed to thesystemWebSocket channel. Thechannelservice forwards these Redis messages to the UI, where components likeSystemInfo.vueupdate to display the live data.
Redis Events¶
| Direction | Channel | Event/Command | Payload |
|---|---|---|---|
| Output | to:system:update-node |
PUBLISH |
{"el": "uptime" \| "cpu_load" \| ..., "value": "..."} |