Skip to content

Additional stats for jetstreams #352

Open
@darkrift

Description

@darkrift

What motivated this proposal?

We would like to have more jetstream stats exposed as prometheus, especially with regards to KV stores that are available from the monitoring endpoint of nats.

          "state": {
            "messages": 5888,
            "bytes": 1237453,
            "first_seq": 30,
            "first_ts": "2025-04-11T17:47:55.924261351Z",
            "last_seq": 11591,
            "last_ts": "2025-04-13T12:49:31.674456082Z",
            "num_subjects": 5888,
            "num_deleted": 5674,
            "consumer_count": 0
          }

the jszCollector is at least missing num_subjects and num_deleted from the StreamState struct

What is the proposed change?

Add the missing stats to the jszCollector

Who benefits from this change?

Everyone that wants to track the usage of their KV stores active entries. For instance, we are using a KV store for temporary entries that are deleted after some time (before the stream expiration settings). Using num_subjects - num_deleted would give us the number of "active" entries in the store.

What alternatives have you evaluated?

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalEnhancement idea or proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions