fix(ui): extract PROFILER_METRIC options behind ProfilerMetricsClassBase - #31934
Conversation
The profiler settings modal's per-column metrics picker read PROFILER_METRIC directly, giving downstream distributions that add their own profiler metrics no seam to extend the picker's option list short of forking the modal. Extract the lookup behind ProfilerMetricsClassBase (same pattern as the existing *ClassBase utilities), so it can be overridden the same way. No behavior change for OSS: getProfilerMetricOptions() returns the same PROFILER_METRIC array as before.
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
✅ Playwright Results — workflow succeededValidated commit ✅ 790 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 51m 41s ⏱️ Max setup 4m 10s · max shard execution 18m 18s · max shard-job elapsed before upload 21m 21s · reporting 4s 🌐 214.79 requests/attempt · 2.60 app boots/UI scenario · 12.66% common-shard skew Optimization targets still in progress:
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
|
| Count | Rule |
|---|---|
| 9 | react-hooks/exhaustive-deps |
| 8 | sonarjs/no-duplicate-string |
| 2 | sonarjs/cyclomatic-complexity |
| 1 | sonarjs/no-nested-conditional |
| 1 | jsx-a11y/no-autofocus |
All findings
| Location | Rule | Message | |
|---|---|---|---|
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:137:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:154:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:181:5 |
sonarjs/cyclomatic-complexity |
{"message":"Function has a complexity of 12 which is greater than 10 authorized.","cost":2,"secondaryLocations":[{"line":181,"column":4,"endLine":181,"endColumn |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:288:32 |
sonarjs/cyclomatic-complexity |
{"message":"Function has a complexity of 11 which is greater than 10 authorized.","cost":1,"secondaryLocations":[{"line":288,"column":31,"endLine":288,"endColum |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:306:11 |
sonarjs/no-nested-conditional |
Extract this nested ternary operation into an independent statement. |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:346:25 |
sonarjs/no-duplicate-string |
Define a constant instead of duplicating this literal 3 times. |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:366:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has missing dependencies: 'onVisibilityChange', 'partitionIntervalType', 't', and 'tableId'. Either include them or remove the dependency |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:373:6 |
react-hooks/exhaustive-deps |
React Hook useCallback has missing dependencies: 'onVisibilityChange' and 'updateInitialConfig'. Either include them or remove the dependency array. If 'onVisib |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:380:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'handleStateChange'. Either include it or remove the dependency array. |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:388:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'handleStateChange'. Either include it or remove the dependency array. |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:395:6 |
react-hooks/exhaustive-deps |
React Hook useCallback has a missing dependency: 'handleStateChange'. Either include it or remove the dependency array. |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:430:5 |
react-hooks/exhaustive-deps |
React Hook useCallback has missing dependencies: 'form' and 'handleStateChange'. Either include them or remove the dependency array. |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:450:6 |
react-hooks/exhaustive-deps |
React Hook useEffect has a missing dependency: 'fetchProfileConfig'. Either include it or remove the dependency array. |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:488:24 |
sonarjs/no-duplicate-string |
Define a constant instead of duplicating this literal 5 times. |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:494:17 |
jsx-a11y/no-autofocus |
The autoFocus prop should not be used, as it can reduce usability and accessibility for users. |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:511:27 |
sonarjs/no-duplicate-string |
Define a constant instead of duplicating this literal 5 times. |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:700:34 |
sonarjs/no-duplicate-string |
Define a constant instead of duplicating this literal 7 times. |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:816:30 |
sonarjs/no-duplicate-string |
Define a constant instead of duplicating this literal 3 times. |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:817:39 |
sonarjs/no-duplicate-string |
Define a constant instead of duplicating this literal 6 times. |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:837:40 |
sonarjs/no-duplicate-string |
Define a constant instead of duplicating this literal 3 times. |
| 🟡 | src/components/Database/Profiler/TableProfiler/ProfilerSettingsModal/ProfilerSettingsModal.tsx:851:30 |
sonarjs/no-duplicate-string |
Define a constant instead of duplicating this literal 3 times. |
Fix locally (fast - only checks files changed in this branch):
make ui-checkstyle-changedWithout __esModule: true, Babel's CJS/ESM interop double-wraps the mock's default export, so profilerMetricsClassBase.getProfilerMetricOptions() resolves to undefined at runtime. Passed locally (different jest/babel config) but failed in CI: "TypeError: ProfilerMetricsClassBase_1.default.getProfilerMetricOptions is not a function".
Code Review ✅ ApprovedExtracts PROFILER_METRIC options behind the new ProfilerMetricsClassBase singleton to allow downstream metric extensions in the profiler settings modal. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|



Fixes open-metadata/openmetadata-collate#6076

Summary
ProfilerSettingsModal.tsx) read thePROFILER_METRICconstant directly. Downstream distributions that ship additional profiler metrics (e.g. Collate) have no way to add them to this picker without forking the modal, because a plain exported array has no override seam — unlike every other extensible piece of UI in this codebase, which goes through anXClassBasesingleton.ProfilerMetricsClassBase(utils/ProfilerMetricsClassBase.ts), following the exact same shape as the existingTagClassBase/ProfilerConfigurationClassBase/etc. utilities: a class with agetProfilerMetricOptions()method, exported as a singleton default export.ProfilerSettingsModal.tsxnow callsprofilerMetricsClassBase.getProfilerMetricOptions()instead of importingPROFILER_METRICdirectly. No behavior change for OSS — it returns the same array.ProfilerSettingsModal.test.tsx's mocks accordingly.Test plan
yarn test ProfilerSettingsModal— existing tests should pass unmodified in behavioryarn tsc:check/yarn lint:fixon the 3 changed filesGreptile Summary
The PR routes the profiler settings modal’s metric list through an extensible
ProfilerMetricsClassBasesingleton while preserving the existing OSS options.Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Reviews (3): Last reviewed commit: "fix(test): mark ProfilerMetricsClassBase..." | Re-trigger Greptile