Skip to content

smax_from_valkey: --merge option, error handling, scripts README#21

Open
mpound wants to merge 4 commits into
mainfrom
smax-scripts
Open

smax_from_valkey: --merge option, error handling, scripts README#21
mpound wants to merge 4 commits into
mainfrom
smax-scripts

Conversation

@mpound

@mpound mpound commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • smax_from_valkey.py error handling: Variables whose smax_pull query fails are now omitted from output (previously written as {"size": "?", "smax_type": "?", "_error": "..."} which would pollute smax.json). Failure count reported to stderr; --verbose lists the names.
  • smax_from_valkey.py --merge: New option deep-merges generated entries into an existing smax.json. smax.json values take precedence on conflicts, preserving validated descriptions, units, and thresholds while adding new keys. Output goes to --output.
  • scripts/README.md: New reference doc covering all scripts — dump_redis, compare_monitor_points, smax_from_valkey (including merge workflow), fakeobs, simple_smax_check, and test files.
  • recursewithtreelib.py: Fix broken import paths (Marc).
  • 9 new TestDeepMerge tests and 5 new TestBuildSubtreeErrors tests. Total: 223 tests passing.

Typical workflow enabled by --merge

# 1. Dump all Valkey leaves
uv run scripts/dump_redis.py --flat --strip > docs/all_monitor_points.txt

# 2. Find what is missing from smax.json
uv run scripts/compare_monitor_points.py --missing > valkeynotsmax.txt

# 3. Generate entries and merge directly into smax.json
uv run scripts/smax_from_valkey.py valkeynotsmax.txt \
    --merge --output smax_updated.json --verbose

# 4. Review, add descriptions/units, replace conf/smax.json

Test plan

  • uv run pytest — 223 tests pass
  • uv run scripts/smax_from_valkey.py valkeynotsmax.txt --merge --output /tmp/test.json --verbose with a live Valkey server

🤖 Generated with Claude Code

mpound and others added 4 commits June 4, 2026 15:44
Adds deep_merge(base, overlay) which recursively merges two JSON dicts,
with base (smax.json) taking precedence on conflicts.  This preserves
validated descriptions, units, and thresholds while adding new entries.

New CLI flag: --merge [SMAX_JSON] (default: conf/smax.json when flag is
present without argument).  The merged result is written to --output.

9 new tests in TestDeepMerge. Total: 223 tests passing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers dump_redis, compare_monitor_points, smax_from_valkey (including
--merge workflow), fakeobs, simple_smax_check, and test coverage.
Includes the typical end-to-end workflow for updating smax.json.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant