skip None values in filtered output for dot notation

This commit is contained in:
Josh Hawkins 2026-03-29 12:38:39 -05:00
parent 83c10e3647
commit ee20b0219e

View File

@ -94,9 +94,14 @@ class StatsEmitter(threading.Thread):
first_value = next(iter(parent.values()), None)
if isinstance(first_value, dict):
# Filter each nested entry to only requested fields
# Filter each nested entry to only requested fields,
# omitting None values to preserve key-absence semantics
selected[parent_key] = {
entry_key: {field: entry.get(field) for field in child_keys}
entry_key: {
field: val
for field in child_keys
if (val := entry.get(field)) is not None
}
for entry_key, entry in parent.items()
}
else: