Skip to content

Add cached metrics endpoint for index sets - #27640

Open
xd4rker wants to merge 2 commits into
masterfrom
feat/index-set-entity-metrics
Open

xd4rker wants to merge 2 commits into
masterfrom
feat/index-set-entity-metrics

Conversation

@xd4rker

@xd4rker xd4rker commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

/nocl This is part of an upcoming feature where a changelog will be introduced.

Closes https://github.com/Graylog2/graylog-plugin-enterprise/issues/15843

Description

Adds a cached metrics endpoint for index sets, GET /system/indices/index_sets/metrics, which returns index_count, document_count, size_bytes, field_count and deflector_health for a list of index set IDs.

The endpoint reuses the entity metrics cache that serves the inputs and streams tables. It batches cluster calls across the requested index sets, caches values in MongoDB with per-field TTLs, and checks indexsets:read for each ID. The upcoming index sets table will fetch metrics once per page for the visible columns.

Deflector health currently uses an aggregate result. Per-index-set health will follow separately.

How Has This Been Tested?

Manual testing instructions

  1. List the index sets and note a few IDs: GET /api/system/indices/index_sets.
  2. Request metrics for them, for example GET /api/system/indices/index_sets/metrics?index_set_ids=<id1>&index_set_ids=<id2>&fields=index_count&fields=document_count&fields=size_bytes&fields=field_count&fields=deflector_health. The response has one entry per ID with the requested fields.
  3. Compare the numbers with GET /api/system/indices/index_sets/<id>/stats and with the field count shown on the index set's field types page. They should match.
  4. Repeat the request. It is now served from MongoDB, visible as documents with entity_type: "index_sets" in the metrics_cache collection, each field with its own computed_at. Stats and field counts refresh after 5 minutes, health after 1 minute.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have requested a documentation update.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant