feat(metrics): Provide the ability to view elastic/opensearch indexes, size, and health within the platform (#18070) - #18334
scarletmerlin123 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟡 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 withSETTINGS_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 admitsSETTINGS_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 newdataIndexMetricsfield and the existingelasticSearchMetricsfield). 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 toClosed. 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 whenstatus === '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.
…orm#18070) feat(metrics): Create data table display of index metrics (OpenCTI-Platform#18070) feat(metrics): update with copilot recommendations (OpenCTI-Platform#18070)
5340efe to
7a1cf3c
Compare
Proposed changes
Related issues
How to test this PR
Checklist
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.