Skip to content

feat(metrics): Provide the ability to view elastic/opensearch indexes, size, and health within the platform (#18070) - #18334

Open
scarletmerlin123 wants to merge 1 commit into
OpenCTI-Platform:masterfrom
fbicyber:issue/18070
Open

scarletmerlin123 wants to merge 1 commit into
OpenCTI-Platform:masterfrom
fbicyber:issue/18070

Conversation

@scarletmerlin123

@scarletmerlin123 scarletmerlin123 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

  • Create a new page under settings for administrators to view the current status of elastic/opensearch indexes
  • Update graphql schema to allow querying the cluster size
  • Add graphql query and resolver for returning the status of each index

Related issues

How to test this PR

  1. Navigate to the index metrics page from the settings section of the left nav
  2. Confirm that the elasticsearch indexes are displayed

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality
  • I wrote test cases for the relevant use cases (coverage and e2e)
  • I added/updated the relevant documentation (either on GitHub or on Notion)
  • Where necessary, I refactored code to improve the overall quality

Further comments

Please let me know if you have any thoughts on access restrictions or if this needs to move to be under data. I didn't want to introduce a new permission to manage so I reused existing permissions for now. I can add a new permission if you think thats the best option.

Copilot AI lite review requested due to automatic review settings September 17, 2026 13:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Resolve the GraphQL integer overflow risk, missing health/status data, authorization mismatches, and inconsistent index counts/status handling.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds an administrator-facing Elasticsearch/OpenSearch index metrics page with GraphQL support, health, size, and document statistics.

Changes:

  • Adds backend resolvers, schema, and index statistics retrieval.
  • Adds settings routing, navigation, summary cards, and metrics table.
  • Adds translations for supported languages.
File summaries
File Summary
opencti-platform/opencti-graphql/src/resolvers/elasticSearchMetrics.js Registers index metrics resolver.
opencti-platform/opencti-graphql/src/generated/graphql.ts Updates generated GraphQL types.
opencti-platform/opencti-graphql/src/domain/searchMetrics.js Exposes index metrics retrieval.
opencti-platform/opencti-graphql/src/database/engine.ts Retrieves and transforms index statistics.
opencti-platform/opencti-graphql/config/schema/opencti.graphql Defines index metrics schema.
opencti-platform/opencti-front/src/schema/relay.schema.graphql Updates frontend schema.
opencti-platform/opencti-front/src/private/components/settings/Root.tsx Adds settings route.
opencti-platform/opencti-front/src/private/components/settings/index_metrics/IndexMetricsTable.tsx Displays per-index metrics.
opencti-platform/opencti-front/src/private/components/settings/index_metrics/IndexMetricsSummary.tsx Displays cluster totals.
opencti-platform/opencti-front/src/private/components/settings/index_metrics/IndexMetrics.tsx Composes the metrics page.
opencti-platform/opencti-front/src/private/components/nav/useNavMenu.tsx Adds navigation entry.
opencti-platform/opencti-front/lang/front/zh.json Adds translations.
opencti-platform/opencti-front/lang/front/ru.json Adds translations.
opencti-platform/opencti-front/lang/front/ko.json Adds translations.
opencti-platform/opencti-front/lang/front/ja.json Adds translations.
opencti-platform/opencti-front/lang/front/it.json Adds translations.
opencti-platform/opencti-front/lang/front/fr.json Adds translations.
opencti-platform/opencti-front/lang/front/es.json Adds translations.
opencti-platform/opencti-front/lang/front/en.json Adds translations.
opencti-platform/opencti-front/lang/front/de.json Adds translations.
Review details

Suppressed comments (4)

opencti-platform/opencti-front/src/private/components/nav/useNavMenu.tsx:395

  • The menu grants this page with BYPASS, but the route grants it with SETTINGS_SUPPORT (Root.tsx:131). A user with only one of these capabilities will either see a menu item that redirects away or be able to open a page that is not listed; use one consistent authorization capability for both checks.
            { granted: isGrantedToManage, link: '/dashboard/settings/indexmetrics', label: t_i18n('Index metrics') },

opencti-platform/opencti-front/src/private/components/settings/Root.tsx:132

  • The navigation entry is shown to users with BYPASS, but this route only admits SETTINGS_SUPPORT. A user with the permission that makes the menu visible will therefore be redirected away after clicking it, while support users may be able to reach the page without seeing the menu. Use the same permission for the menu and route.
              <Security
                needs={[SETTINGS_SUPPORT]}
                placeholder={<Navigate to={fallbackUrl} />}

opencti-platform/opencti-front/src/private/components/settings/Root.tsx:132

  • This route admits users with SETTINGS_SUPPORT, but the page's GraphQL calls are protected by @auth(for: [MODULES]) (including the new dataIndexMetrics field and the existing elasticSearchMetrics field). A support-only user can therefore open this route and then receive authorization errors instead of the page. Align the route, navigation, and both GraphQL fields on the same capability.
              <Security
                needs={[SETTINGS_SUPPORT]}
                placeholder={<Navigate to={fallbackUrl} />}

opencti-platform/opencti-front/src/private/components/settings/index_metrics/IndexMetricsTable.tsx:73

  • Because the resolver currently returns no status for indices.stats(), this expression maps an unknown or missing value to Closed. That is misleading for failed/missing health data and hides the distinction between a closed index and an unavailable status; only render the closed state when status === 'close' and handle unknown values separately.
        <ItemBoolean
          status={status === 'open'}
          label={status === 'open' ? t_i18n('Open') : t_i18n('Closed')}
        />
  • Files reviewed: 19/20 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread opencti-platform/opencti-graphql/config/schema/opencti.graphql Outdated
Comment thread opencti-platform/opencti-graphql/src/database/engine.ts
…orm#18070)

feat(metrics): Create data table display of index metrics (OpenCTI-Platform#18070)

feat(metrics): update with copilot recommendations (OpenCTI-Platform#18070)
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.

feat(metrics): Provide the ability to view elastic/opensearch indexes, size, and health within the platform

2 participants