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

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

Conversation

jgowdyelastic
Copy link
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
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
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
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
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


import { mlJobService } from 'plugins/ml/services/job_service';

function getLink(location, jobs) {
let from = 0;
let to = 0;
if (jobs.length === 1) {
from = jobs[0].earliestTimeStamp.string;
to = jobs[0].latestTimeStamp.string;
from = jobs[0].earliestTimeStampMs;
Copy link
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
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
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
Contributor

💔 Build Failed

@jgowdyelastic
Copy link
Member Author

retest

@elasticmachine
Copy link
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