Repository navigation
feat: groups=matching, dotted paths and selectors on /hosts - #243
Merged
Merged
Conversation
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Ways for a reader to ask for less, all on existing routes:
groups=all|matching|noneonGET /sources/{id}/dataset(sources and views).matching: only the groups of the returned hosts, member lists cut to them, plus the parents of kept groups (walked up),childrencut to kept groups. Group vars untouched (minusexclude_fields).none: nogroupskey.allstays the default: nothing changes for existing consumers.fields,exclude_fieldsandfilterkeys — dataset route, views and builtin endpoints (csv columns too):fields=monitor.name,filter=monitor.status=DOWN.host=,group=,filter=onGET /sources/{id}/hosts(sources and views), selecting exactly as/datasetdoes; names only. Malformed filter = 400.Why
A narrow dataset read carried every group with its full member list. On a source of ~1,000 hosts and 40 groups:
groups=all(default)groups=matchinggroups=noneAnd
fieldscould only pick top-level keys, so a source keeping everything under one key couldn't be trimmed at all (3,047,870 B → 100,303 B withfields=<object>.name&groups=none).How
domain/var_path.rs:lookup(filter) andVarSelect(fields/exclude_fields), shared by every route.domain/group_trim.rs: thematchingselection, generic over owned and borrowed names.GroupsModeadded to the OpenAPI schemas;groupsis part of the filtered ETag.Tests
groups=matching|none|<bad>, default unchanged, dotted fields/exclude (group vars too), dotted filter,/hostsselectors and 400.cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo test: 700 passed.