Skip to content

[ML] Fixing issue with incorrect timezones in jobs list#22714

Merged
jgowdyelastic merged 4 commits intoelastic:masterfrom
jgowdyelastic:removing-server-side-moment-usage-for-jobs-list-times
Sep 5, 2018
Merged

[ML] Fixing issue with incorrect timezones in jobs list#22714
jgowdyelastic merged 4 commits intoelastic:masterfrom
jgowdyelastic:removing-server-side-moment-usage-for-jobs-list-times

Conversation

@jgowdyelastic
Copy link
Copy Markdown
Member

@jgowdyelastic jgowdyelastic commented Sep 5, 2018

Fixes issue where some of the job times in the jobs list are local to the server rather than the browser.
This was caused by moment being used on the server to create the time string in the jobs summary endpoint (the data used to create the table).

This PR removes this server side use of moment and just passes across the epoch seconds.
The browser then runs it through moment at display time.

@jgowdyelastic jgowdyelastic added bug Fixes for quality problems that affect the customer experience review v7.0.0 :ml Feature:Anomaly Detection ML anomaly detection v6.5.0 v6.4.1 labels Sep 5, 2018
@jgowdyelastic jgowdyelastic self-assigned this Sep 5, 2018
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/ml-ui

}

// if either of the dates are empty, set them to undefined
// if either of the dates are zero, set them to undefined
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.

Does this comment still apply, so that now is passed to the target page if the job has no results?

// moment will convert undefined to now.
from = (from === '') ? undefined : from;
to = (to === '') ? undefined : to;
const fromString = moment(from).format(TIME_FORMAT);
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.

The from and to variables refer to the time in seconds, but this usage of moment expects the value in ms. Are the variables holding ms values rather than s as their name would imply?

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.

good spot. earliestTimeStampSeconds should be earliestTimeStampMs

if (jobs.length === 1) {
from = jobs[0].earliestTimeStamp.string;
to = jobs[0].latestTimeStamp.string;
from = jobs[0].earliestTimeStampMs;
Copy link
Copy Markdown
Contributor

@peteharverson peteharverson Sep 5, 2018

Choose a reason for hiding this comment

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

Nit, but 'timestamp' is generally one word, so I think these should be earliestTimestampMs and latestTimestampMs!

Copy link
Copy Markdown
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Copy Markdown
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

LGTM

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@jgowdyelastic
Copy link
Copy Markdown
Member Author

retest

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@jgowdyelastic jgowdyelastic merged commit 23ed213 into elastic:master Sep 5, 2018
jgowdyelastic added a commit to jgowdyelastic/kibana that referenced this pull request Sep 5, 2018
* [ML] Fixing issue with incorrect timezones in jobs list

* refactoring min and max calculation

* changes based on review

* changing TimeStamp to Timestamp
jgowdyelastic added a commit to jgowdyelastic/kibana that referenced this pull request Sep 5, 2018
* [ML] Fixing issue with incorrect timezones in jobs list

* refactoring min and max calculation

* changes based on review

* changing TimeStamp to Timestamp
jgowdyelastic added a commit that referenced this pull request Sep 5, 2018
)

* [ML] Fixing issue with incorrect timezones in jobs list

* refactoring min and max calculation

* changes based on review

* changing TimeStamp to Timestamp
jgowdyelastic added a commit that referenced this pull request Sep 5, 2018
)

* [ML] Fixing issue with incorrect timezones in jobs list

* refactoring min and max calculation

* changes based on review

* changing TimeStamp to Timestamp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Fixes for quality problems that affect the customer experience Feature:Anomaly Detection ML anomaly detection :ml review v6.4.1 v6.5.0 v7.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants