Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.8] [ML] Add job timing stats to anomaly jobs (#65696) #65891

Merged
merged 1 commit into from
May 8, 2020
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 @@ -165,6 +165,15 @@ export function extractJobDetails(job) {
items: filterObjects(job.model_size_stats).map(formatValues),
};

const jobTimingStats = {
id: 'jobTimingStats',
title: i18n.translate('xpack.ml.jobsList.jobDetails.jobTimingStatsTitle', {
defaultMessage: 'Job timing stats',
}),
position: 'left',
items: filterObjects(job.timing_stats).map(formatValues),
};

const datafeedTimingStats = {
id: 'datafeedTimingStats',
title: i18n.translate('xpack.ml.jobsList.jobDetails.datafeedTimingStatsTitle', {
Expand Down Expand Up @@ -192,6 +201,7 @@ export function extractJobDetails(job) {
datafeed,
counts,
modelSizeStats,
jobTimingStats,
datafeedTimingStats,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ export function formatValues([key, value]) {
// numbers rounded to 3 decimal places
case 'average_search_time_per_bucket_ms':
case 'exponential_average_search_time_per_hour_ms':
case 'total_bucket_processing_time_ms':
case 'minimum_bucket_processing_time_ms':
case 'maximum_bucket_processing_time_ms':
case 'average_bucket_processing_time_ms':
case 'exponential_average_bucket_processing_time_ms':
case 'exponential_average_bucket_processing_time_per_hour_ms':
value = typeof value === 'number' ? roundToDecimalPlace(value, 3).toLocaleString() : value;
break;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export class JobDetails extends Component {
datafeed,
counts,
modelSizeStats,
jobTimingStats,
datafeedTimingStats,
} = extractJobDetails(job);

Expand Down Expand Up @@ -102,7 +103,7 @@ export class JobDetails extends Component {
content: (
<JobDetailsPane
data-test-subj="mlJobDetails-counts"
sections={[counts, modelSizeStats]}
sections={[counts, modelSizeStats, jobTimingStats]}
/>
),
},
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/ml/public/application/services/job_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ class JobService {
delete tempJob.open_time;
delete tempJob.established_model_memory;
delete tempJob.calendars;
delete tempJob.timing_stats;
delete tempJob.forecasts_stats;

delete tempJob.analysis_config.use_per_partition_normalization;

Expand Down
6 changes: 2 additions & 4 deletions x-pack/plugins/ml/server/models/job_service/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export function jobsProvider(callAsCurrentUser: APICaller) {
// create jobs objects containing job stats, datafeeds, datafeed stats and calendars
if (jobResults && jobResults.jobs) {
jobResults.jobs.forEach(job => {
const tempJob = job as CombinedJobWithStats;
let tempJob = job as CombinedJobWithStats;

const calendars: string[] = [
...(calendarsByJobId[tempJob.job_id] || []),
Expand All @@ -341,9 +341,7 @@ export function jobsProvider(callAsCurrentUser: APICaller) {
if (jobStatsResults && jobStatsResults.jobs) {
const jobStats = jobStatsResults.jobs.find(js => js.job_id === tempJob.job_id);
if (jobStats !== undefined) {
tempJob.state = jobStats.state;
tempJob.data_counts = jobStats.data_counts;
tempJob.model_size_stats = jobStats.model_size_stats;
tempJob = { ...tempJob, ...jobStats };
if (jobStats.node) {
tempJob.node = jobStats.node;
}
Expand Down