# Add the Valkey keys\_with\_volatile\_items keyspace metric

**URL:** <https://discuss.elastic.co/t/add-the-valkey-keys-with-volatile-items-keyspace-metric/389280>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [August 6, 2026, 1:59pm UTC](https://discuss.elastic.co/t/add-the-valkey-keys-with-volatile-items-keyspace-metric/389280 "2026-08-06T13:59:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aglowienka](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aglowienka/32/148010_2.png) [@aglowienka](https://discuss.elastic.co/u/aglowienka)\
**Post date:** [August 6, 2026, 1:59pm UTC](https://discuss.elastic.co/t/add-the-valkey-keys-with-volatile-items-keyspace-metric/389280/1 "2026-08-06T13:59:02Z")

</div>

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](https://github.com/elastic/beats/pull/47971).

Example `INFO keyspace` line on Valkey ≥ 9.0:

```auto
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](https://github.com/elastic/beats/pull/47971)), so this is purely additive:

```go
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](https://github.com/elastic/beats/pull/47971) (8.19.x–9.3.x) the `keyspace` metricset drops **all** events on  
> Valkey ≥ 9.0, which is why this field currently can't be collected there. That regression is  
> tracked separately.

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [August 6, 2026, 2:02pm UTC](https://discuss.elastic.co/t/add-the-valkey-keys-with-volatile-items-keyspace-metric/389280/2 "2026-08-06T14:02:43Z")

</div>

Hello and welcome,

Did you open an issue in Github? The forum is more for questions, for these kind of requests the right channel would be opening a Feature Request Issue in the repository.

---

<div class="post-metadata">

**Author:** ![aglowienka](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aglowienka/32/148010_2.png) [@aglowienka](https://discuss.elastic.co/u/aglowienka)\
**Post date:** [August 6, 2026, 3:05pm UTC](https://discuss.elastic.co/t/add-the-valkey-keys-with-volatile-items-keyspace-metric/389280/3 "2026-08-06T15:05:17Z")

</div>

Yes. However, due to inactivity there I checked the CONTRIBUTING.md, and linked contributing guidelines which states:

> If you have a bugfix or new feature that you would like to contribute, please start by opening a topic on the [forums](https://discuss.elastic.co/c/beats).

Issue: [[Metricbeat][Redis] Add the Valkey keys\_with\_volatile\_items keyspace metric · Issue #52179 · elastic/beats · GitHub](https://github.com/elastic/beats/issues/52179)

PR: [[Metricbeat][Redis] Add the Valkey keys\_with\_volatile\_items keyspace field by aglowienka · Pull Request #52181 · elastic/beats · GitHub](https://github.com/elastic/beats/pull/52181)
