feat(redis): add slowlog panel and integrate with backend APIs#1484
feat(redis): add slowlog panel and integrate with backend APIs#1484dal1wg wants to merge 3 commits into
Conversation
t8y2
left a comment
There was a problem hiding this comment.
PR #1484: feat(redis): add slowlog panel and integrate with backend APIs
+541/-4, 13 files | CI: pass | Mergeable: MERGEABLE
🔴 Must Fix
crates/dbx-core/src/db/redis_driver.rs:1280:get_slowlog()skips entries with fewer than 5 fields, butSLOWLOG GETonly added client address/name fields in Redis 4.0. Redis 2.2.12-3.x, and some Redis Software/Cloud responses, can return the older 4-field entry shape. On those servers this panel will show an empty slow log even when entries exist. Please acceptfields.len() >= 4and treatclient_addr/client_nameas optional.
🟡 Suggestions
-
apps/desktop/src/components/redis/RedisSlowlogPanel.vue:46: cluster node values are encoded as"host:port"and later split on":", which breaks IPv6 hosts. Prefer storing the selected endpoint object or using a stable serialized value like JSON. -
crates/dbx-core/src/db/redis_driver.rs:1336: empty bulk-string arguments are converted toNone, so a slowlog command likeSET key ""displays asSET key. Binary/non-UTF-8 args are also dropped. Reusing the existing Redis display conversion would make command rendering more faithful.
✅ Well Done
The backend routes, Tauri commands, HTTP client, and API forwarding are wired consistently. Cluster mode also correctly queries a selected node rather than pretending slowlog is cluster-global.
Verdict
Request changes for the Redis slowlog parser compatibility issue. CI is green, but the 4-field slowlog shape is a real behavior regression for older or non-OSS-compatible Redis deployments.
|
Understood. I will fix it. |



Purpose
Add a Slow Log panel for Redis connections, enabling users to retrieve and display SLOWLOG entries from the
current Redis server. The panel is integrated as the 4th tab in the existing Redis sidebar (Key Detail /
Command Line / PubSub / Slow Log), maintaining consistent UI styling.
Changes
Rust Backend (6 files)
crates/dbx-core/src/db/redis_driver.rsRedisSlowlogEntrystruct with fields: id, timestamp, duration_micros, command, client_addr,client_name
get_slowlog()function to executeSLOWLOG GET <count>and parse the nested array responseredis_raw_value_to_optional_string()andredis_value_to_u64()connect_cluster_node()visibility topubfor direct node connections in cluster modecrates/dbx-core/src/redis_ops.rsredis_slowlog_get_core(): supports standalone direct query, cluster+node direct query, andcluster without node (returns empty); skips
select_dbas SLOWLOG is a server-level commandredis_cluster_master_nodes_core(): returns cluster master node list (empty for sentinel)src-tauri/src/commands/redis_cmd.rsredis_slowlog_getandredis_cluster_master_nodesTauri commandssrc-tauri/src/lib.rsinvoke_handlercrates/dbx-web/src/main.rsPOST /redis/slowlog-getandPOST /redis/cluster-master-nodescrates/dbx-web/src/routes/redis.rsSlowlogGetRequestandClusterNodesRequestrequest structsslowlog_getandcluster_master_nodeshandler functionsFrontend (5 files)
apps/desktop/src/lib/tauri.tsRedisSlowlogEntryandRedisNodeEndpointtype definitionsredisSlowlogGet()andredisClusterMasterNodes()function implementationsapps/desktop/src/lib/http.tsapps/desktop/src/lib/api.tsapps/desktop/src/components/redis/RedisSlowlogPanel.vue(new)aligned
RecycleScrollerfor large result setsYYYY-MM-DD HH:mm:ss, null values displayed asNILapps/desktop/src/components/redis/RedisKeyBrowser.vueRedisSidePaneltype to include"slowlog"Internationalization (2 files)
apps/desktop/src/i18n/locales/en.ts— Added 15 slowlog translation keysapps/desktop/src/i18n/locales/zh-CN.ts— Added 15 slowlog translation keysRelated Issue
Close #1481