Valkey ≥ 9.0 reports a per-database keys_with_volatile_items counter in INFO keyspace that
Metricbeat's redis.keyspace metricset does not collect. Please add it as
redis.keyspace.keys_with_volatile_items (long), alongside the existing keys, expires, and
avg_ttl. It is the Valkey analogue of the subexpiry field added for Redis ≥ 7.4 in #47971.
Example INFO keyspace line on Valkey ≥ 9.0:
db0:keys=1000,expires=200,avg_ttl=0,keys_with_volatile_items=0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Implementation: add the field (optional) to the keyspace schema in
metricbeat/module/redis/keyspace/data.go and to _meta/fields.yml. On main the parser already
accepts the 4-field line (post-#47971), so this is purely additive:
var schema = s.Schema{
"keys": c.Int("keys"),
"expires": c.Int("expires"),
"avg_ttl": c.Int("avg_ttl"),
"subexpiry": c.Int("subexpiry", s.Optional), // Redis >= 7.4
"keys_with_volatile_items": c.Int("keys_with_volatile_items", s.Optional), // Valkey >= 9.0
}
While here, consider replacing the len(dbInfo) == 3 || len(dbInfo) == 4 guard in
parseKeyspaceStats with len(dbInfo) >= 3, so future keyspace fields don't need another patch —
the parser is name-based and the schema only extracts fields it knows.
Describe a specific use case for the enhancement or feature:
Monitoring Valkey / ElastiCache 9.0 with Metricbeat — surfacing the per-database
keys_with_volatile_items counter next to the other redis.keyspace stats.
Note: on releases before #47971 (8.19.x–9.3.x) the
keyspacemetricset drops all events on
Valkey ≥ 9.0, which is why this field currently can't be collected there. That regression is
tracked separately.