diff --git a/locales/en/common.json b/locales/en/common.json index 7e0e3e425..cf081d4e4 100644 --- a/locales/en/common.json +++ b/locales/en/common.json @@ -46,6 +46,7 @@ "FILTER_TOPIC": "Topic", "FROM": "From", "HELP": "Help", + "HEAP_DUMP": "Heap Dump", "HOUR": "Hour", "HOUR_one": "Hour", "HOUR_other": "Hours", @@ -96,6 +97,7 @@ "TARGET": "Target", "TEMPLATE": "Template", "TEST": "Test", + "THREAD_DUMP": "Thread Dump", "TIME": "Time", "TIMEZONE": "Timezone", "TO": "To", diff --git a/locales/en/public.json b/locales/en/public.json index 82440d550..792ac9f9f 100644 --- a/locales/en/public.json +++ b/locales/en/public.json @@ -233,6 +233,7 @@ "ENABLE_SWITCH_HELPER_TEXT": "Rules take effect when created if enabled and will be matched against all discovered target applications immediately. When new target applications appear they are checked against all enabled rules. Disabled rules have no effect but are available to be enabled in the future.", "EVALUATING_EXPRESSION": "Evaluating Match Expression...", "FAILING_EVALUATION": "The expression matching failed.", + "HEAP_DUMP_SWITCH_HELPER_TEXT": "Trigger a heap dump in all matching targets.", "INITIAL_DELAY_HELPER_TEXT": "Initial delay before archiving starts. The first archived copy will be made this long after the Recording is started. The second archived copy will occur one Archival period later.", "MATCH_EXPRESSION_HELPER_TEXT": "Enter a Match Expression. This is a Common Expression Language (CEL) code snippet that is evaluated against each target application to determine whether the rule should be applied.", "MATCH_EXPRESSION_HINT_BODY": "Try an expression like:", @@ -244,6 +245,7 @@ "PRESERVED_ARCHIVES_HELPER_TEXT": "The number of Archived Recording copies to preserve in archives for each target application affected by this rule.", "TEMPLATE_HELPER_TEXT": "The Event Template to be applied by this Rule against matching target applications.", "TEMPLATE_HINT": "A Template must be selected.", + "THREAD_DUMP_SWITCH_HELPER_TEXT": "Trigger a thread dump in all matching targets", "WARNING_NO_MATCH": "Warning: Match Expression matches no targets." }, "CredentialTestTable": { diff --git a/src/app/Rules/CreateRule.tsx b/src/app/Rules/CreateRule.tsx index 277a7da83..d350adf07 100644 --- a/src/app/Rules/CreateRule.tsx +++ b/src/app/Rules/CreateRule.tsx @@ -110,6 +110,8 @@ export const CreateRuleForm: React.FC = ({ onExit }) => { initialDelay: 0, initialDelayUnit: 1, preservedArchives: 0, + threaddump: false, + heapdump: false, }); const [templates, setTemplates] = React.useState([]); const [loading, setLoading] = React.useState(false); @@ -238,6 +240,16 @@ export const CreateRuleForm: React.FC = ({ onExit }) => { [setFormData], ); + const handleThreadDumpChange = React.useCallback( + (_, threaddump: boolean) => setFormData((old) => ({ ...old, threaddump })), + [setFormData], + ); + + const handleHeapDumpChange = React.useCallback( + (_, heapdump: boolean) => setFormData((old) => ({ ...old, heapdump })), + [setFormData], + ); + const handleAutoAnalyzeChange = React.useCallback( (_, autoanalyze: boolean) => setAutoanalyze(autoanalyze), [setAutoanalyze], @@ -308,6 +320,8 @@ export const CreateRuleForm: React.FC = ({ onExit }) => { maxAgeUnit, maxSize, maxSizeUnit, + threaddump, + heapdump, } = formData; if (nameValid !== ValidatedOptions.success) { notificationMessages.push(`Rule name ${name} is invalid`); @@ -337,6 +351,8 @@ export const CreateRuleForm: React.FC = ({ onExit }) => { maxAgeSeconds: maxAge * maxAgeUnit, maxSizeBytes: maxSize * maxSizeUnit, metadata, + threadDump: threaddump, + heapDump: heapdump, }; setLoading(true); addSubscription( @@ -547,6 +563,34 @@ export const CreateRuleForm: React.FC = ({ onExit }) => { + + + + + {t('CreateRule.THREAD_DUMP_SWITCH_HELPER_TEXT')} + + + + + + + + {t('CreateRule.HEAP_DUMP_SWITCH_HELPER_TEXT')} + + + = () => { keyPaths: ['options'], sortable: false, }, + { + title: t('THREAD_DUMP'), + keyPaths: ['threaddump'], + sortable: false, + }, + { + title: t('HEAP_DUMP'), + keyPaths: ['dump'], + sortable: false, + }, ], [t], ); @@ -438,6 +448,12 @@ export const RulesTable: React.FC = () => { )} + + {`${r.threadDump}`} + + + {`${r.heapDump}`} +