Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,12 @@ export const PatternAnalysisSettings: FC<PatternAnalysisSettingsProps> = ({
values={{ minimumTimeRangeOption, categoryCount }}
/>
</>
) : null}
) : (
<FormattedMessage
id="xpack.aiops.logCategorization.embeddableMenu.totalPatternsMessage2"
defaultMessage="No additional time will be added to the range you specified with the time selector."
/>
)}
</>
}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import { i18n } from '@kbn/i18n';
import type { unitOfTime } from 'moment';

export const DEFAULT_MINIMUM_TIME_RANGE_OPTION: MinimumTimeRangeOption = 'No minimum';
Copy link
Copy Markdown
Contributor

@peteharverson peteharverson Aug 23, 2024

Choose a reason for hiding this comment

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

I think we could do with some clarification in the UI as to what 'No minimum' means? Possibly some text in the help tooltip, and some text below the 'Minimum time range' field if they have 'No minimum' selected. e.g. does it mean it will search right back to the start of the data in the data view, or just to the start date set in the time picker.

Screenshot 2024-08-23 at 17 18 28

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah I agree. I'm not sure what the text should say for the No minimum option.
The time range used will match the time picker ?
No additional time will be added to the range selected ?

@szabosteve do you have any ideas?

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.

@jgowdyelastic @peteharverson
I'd change the dropdown label to Use selected time.
And the helper text – if needed – could be something like:
The time range you specified using the time selector will be used for the analysis.
What do you think?

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.

I like the idea of changing the label in the dropdown from 'No minimum' to 'Use selected time' (or even 'Use range selected in time picker' to clarify which selected time?).

The only issue with The time range you specified using the time selector will be used for the analysis. for the help text is that it then begs the question of why wouldn't the analysis always used the selected time range? Maybe something along the lines of No additional time be added. ?

Very difficult to explain concisely what this setting relates to!

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.

What about the following as the helper text?
No additional time is added to the range you specified with the time selector.

However, if the selector label is changed to Use range specified in time selector or something along these lines, then I don't think a helper text is necessary.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Text updated to:
image

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.

Nit - I think the form help texts normally end with a .


export type MinimumTimeRangeOption = 'No minimum' | '1 week' | '1 month' | '3 months' | '6 months';

type MinimumTimeRange = Record<
Expand All @@ -17,7 +19,7 @@ type MinimumTimeRange = Record<
export const MINIMUM_TIME_RANGE: MinimumTimeRange = {
'No minimum': {
label: i18n.translate('xpack.aiops.logCategorization.minimumTimeRange.noMin', {
defaultMessage: 'No minimum',
defaultMessage: 'Use range specified in time selector',
}),
factor: 0,
unit: 'w',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useStorage } from '@kbn/ml-local-storage';
import type { MappingRuntimeFields } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { useAiopsAppContext } from '../../../hooks/use_aiops_app_context';
import type { MinimumTimeRangeOption } from './minimum_time_range';
import { MINIMUM_TIME_RANGE } from './minimum_time_range';
import { DEFAULT_MINIMUM_TIME_RANGE_OPTION, MINIMUM_TIME_RANGE } from './minimum_time_range';
import type { AiOpsKey, AiOpsStorageMapped } from '../../../types/storage';
import { AIOPS_PATTERN_ANALYSIS_MINIMUM_TIME_RANGE_PREFERENCE } from '../../../types/storage';

Expand Down Expand Up @@ -85,7 +85,7 @@ export function useMinimumTimeRange() {
const [minimumTimeRangeOption, setMinimumTimeRangeOption] = useStorage<
AiOpsKey,
AiOpsStorageMapped<typeof AIOPS_PATTERN_ANALYSIS_MINIMUM_TIME_RANGE_PREFERENCE>
>(AIOPS_PATTERN_ANALYSIS_MINIMUM_TIME_RANGE_PREFERENCE, '1 week');
>(AIOPS_PATTERN_ANALYSIS_MINIMUM_TIME_RANGE_PREFERENCE, DEFAULT_MINIMUM_TIME_RANGE_OPTION);

const cancelRequest = useCallback(() => {
abortController.current.abort();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ import {
DEFAULT_PROBABILITY,
RANDOM_SAMPLER_OPTION,
} from '../../components/log_categorization/sampling_menu/random_sampler';
import type { MinimumTimeRangeOption } from '../../components/log_categorization/log_categorization_for_embeddable/minimum_time_range';
import {
DEFAULT_MINIMUM_TIME_RANGE_OPTION,
type MinimumTimeRangeOption,
} from '../../components/log_categorization/log_categorization_for_embeddable/minimum_time_range';
import { getMessageField } from '../../components/log_categorization/utils';
import { FieldSelector } from '../../components/log_categorization/log_categorization_for_embeddable/field_selector';
import { SamplingPanel } from '../../components/log_categorization/sampling_menu/sampling_panel';
Expand Down Expand Up @@ -67,7 +70,7 @@ export const PatternAnalysisEmbeddableInitializer: FC<PatternAnalysisInitializer
const [formInput, setFormInput] = useState<PatternAnalysisEmbeddableRuntimeState>(
pick(
initialInput ?? {
minimumTimeRangeOption: '1 week',
minimumTimeRangeOption: DEFAULT_MINIMUM_TIME_RANGE_OPTION,
randomSamplerMode: RANDOM_SAMPLER_OPTION.ON_AUTOMATIC,
randomSamplerProbability: DEFAULT_PROBABILITY,
},
Expand Down