-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Rollups] Rollup support in Kibana, phase 1 #21117
Conversation
3be85a2
to
189d35c
Compare
fdc5de7
to
53595bd
Compare
2dc728d
to
094edbd
Compare
a19825e
to
5d5c431
Compare
5d5c431
to
bbb021e
Compare
cd48774
to
25aa4bf
Compare
cb61f6a
to
ef9f2df
Compare
@maryia-lapata I've localized the copy in |
81480f2
to
0743e30
Compare
@@ -245,12 +252,15 @@ export class StepIndexPatternComponent extends Component { | |||
const errorMessage = intl.formatMessage( | |||
{ | |||
id: 'kbn.management.createIndexPattern.step.invalidCharactersErrorMessage', | |||
defaultMessage: 'An index pattern cannot contain spaces or the characters: {characterList}' | |||
defaultMessage: 'A ${indexPatternName} cannot contain spaces or the characters: {characterList}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove $
sign. Placeholders should be presented just in curly braces.
const label = intl.formatMessage({ | ||
|
||
const infoLabel = intl.formatMessage({ | ||
id: 'kbn.management.editIndexPattern.fields.table.additionalInfo', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a description of label type to the id. Since it's a label for aria-label
attribute, id should end with AriaLabel
.
kbn.management.editIndexPattern.fields.table.additionalInfoAriaLabel
id: 'kbn.management.editIndexPattern.fields.table.additionalInfo', | ||
defaultMessage: 'Additional field information' | ||
}); | ||
const timeLabel = intl.formatMessage({ | ||
id: 'kbn.management.editIndexPattern.fields.table.primaryTimeAria', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Please update the id according to Guideline: kbn.management.editIndexPattern.fields.table.primaryTimeAriaLabel
</a> | ||
</li> | ||
</ul> | ||
<div id="indexPatternListReact" role="region" aria-label="Index patterns"></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, this aria-label
attribute should be translated as well.
indexPatternCreationOptions | ||
}) => ( | ||
<CreateButton options={indexPatternCreationOptions}> | ||
Create index pattern |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose that Create index pattern
should be translated as well.
renderJobs() { | ||
const { jobs } = this.props; | ||
const jobItems = jobs.map(({ id, status }) => { | ||
const statusText = status === 'started' ? ' (started)' : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(started)
should be translated.
<EuiButton | ||
data-test-subj="jobActionMenuButton" | ||
iconSide={iconSide} | ||
aria-label={`${entity} options`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please translate aria-label
attribute.
|
||
const columns = [{ | ||
field: 'name', | ||
name: 'Field', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please translate this label.
|
||
const columns = [{ | ||
field: 'name', | ||
name: 'Field', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please translate this field.
truncateText: true, | ||
sortable: true, | ||
}, { | ||
name: 'Types', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some more comments
@@ -36,22 +36,36 @@ function addJsonFieldToIndexPattern(target, sourceString, fieldName, indexName) | |||
try { | |||
target[fieldName] = JSON.parse(sourceString); | |||
} catch (error) { | |||
throw new Error(`Error encountered parsing ${fieldName} for index pattern ${indexName}: ${error.message}`); | |||
throw new Error( | |||
`Error encountered parsing ${fieldName} for index pattern ${indexName}: ${error.message}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if a user can see this message, it should be translated as well.
); | ||
}; | ||
|
||
export const TabJson = injectI18n(TabJsonUi); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no translated labels, so it's no reason to wrap the component with injectI18n
<EuiFlexItem> | ||
<EuiDescriptionListTitle> | ||
<FormattedMessage | ||
id="xpack.rollupJobs.jobDetails.tabSummary.itemDocumentsProcessed.label" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: To be consistent with other code, please follow to naming convention described in Guideline. Please use camelcase for the message type: xpack.rollupJobs.jobDetails.tabSummary.itemDocumentsProcessedLabel
<EuiFlexItem> | ||
<EuiDescriptionListTitle> | ||
<FormattedMessage | ||
id="xpack.rollupJobs.jobDetails.tabSummary.itemPagesProcessed.label" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: xpack.rollupJobs.jobDetails.tabSummary.itemPagesProcessedLabel
@cjcenizal |
@cjcenizal in the last phase consider adding a user friendly version to the cron pattern. the field should be named like in the wizard: Schedule (or we can use frequency) |
This comment has been minimized.
This comment has been minimized.
💚 Build Succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went digging around in some of the places that @cjcenizal pointed out and found somethings that I think should be addressed, but nothing earth shattering.
I'm a little shocked to not find a single test in the rollup UI. Thankfully there are tests for the server libs, but there should absolutely be more unit tests in the UI and some functional tests to verify baseline functionality end-to-end.
I know we're trying to get this in for 6.5, and since most of this logic is out of the critical path it shouldn't be too problematic, I'm fine if y'all merge this and work to address testing/feedback in follow up PRs, but I'm going to have to trust that you follow through with that as I won't be able to verify everything is taken care of.
let _http; | ||
|
||
export function setHttp(http) { | ||
_http = http; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, why not use kfetch
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're blocked by #22594 (interceptor parity between kfetch and $http). We originally used kfetch and then switched to $http for this reason.
}; | ||
|
||
export function getOrdinalValue(number) { | ||
// TODO: This is breaking reporting pdf generation. Possibly due to phantom not setting locale, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an issue for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created #24770
|
||
function removeEmptyValues(object) { | ||
Object.keys(object).forEach(key => { | ||
if (object[key] == null || object[key].trim() === '') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think relying on the values in object
to be either undefined, null, or a string is slightly risky. String(object[key]).trim() === ''
would probably be a bit safer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you clarify what you meant by "safer"? Are you concerned about object
being of type Object
or number
?
} | ||
|
||
const extractedQueryParams = {}; | ||
const queryParamPairs = queryString.split('?')[1].split('&').map(paramString => paramString.split('=')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please use require('query_string').parse()
instead of reimplementing query string parsing without tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try { | ||
await sendStartJobsRequest(jobIds); | ||
} catch (error) { | ||
return toastNotifications.addDanger(error.data.message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not confident that errors will always have a data.message
property, we should probably use a helper of some sort that uses that when available, and defaults to something like error.stack
when it isn't...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[ newJob ] = await Promise.all([ | ||
sendCreateJobRequest(serializeJob(jobConfig)), | ||
// Wait at least half a second to avoid a weird flicker of the saving feedback. | ||
new Promise(resolve => setTimeout(resolve, 500)), |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
new Promise(resolve => setTimeout(resolve, 500)), | ||
]); | ||
} catch (error) { | ||
const { statusCode, data } = error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are lots of situations where error here is not coming from the API, so I think we should handle those errors differently rather than assuming every error will be an HTTP response.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { statusCode, data } = error; | ||
|
||
// Some errors have statusCode directly available but some are under a data property. | ||
switch (statusCode || data.statusCode) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes more sense as a if ((statusCode || data.statusCode) === 409)
block with an early return, followed by the default case and an early return, rather than a switch statement with a floating return
after it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { isLoading, jobs, jobLoadError } = this.props; | ||
|
||
let content; | ||
if (jobLoadError && jobLoadError.status === 403) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have a jobLoadError and it's not because of a permission error, we should probably do something besides load an empty screen, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import dateMath from '@kbn/datemath'; | ||
|
||
import { InvalidEsCalendarIntervalError } from './invalid_es_calendar_interval_error'; | ||
import { InvalidEsIntervalFormatError } from './invalid_es_interval_format_error'; | ||
|
||
const ES_INTERVAL_STRING_REGEX = new RegExp( | ||
'^([1-9][0-9]*)\\s*(' + dateMath.units.join('|') + ')$' | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to https://github.com/elastic/kibana/blob/master/packages/kbn-datemath/src/index.js#L25 m
is a mixed type unit, meaning a single minute is a "calendar" unit type, right? Does that mean that the datemath module is wrong or this module is wrong?
Also why is this not part of the datemath module? Feels like it's pretty closely related.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we either hashed this out or it is being addressed in #24671? Let me know if this is actually a separate issue.
💚 Build Succeeded |
…to allow rollups to avoid normalizing ES interval units (#24428)
* add rollups link to Kibana home * copy change * copy edit * Making rollup jobs empty message match home page copy * copy edit * copy edit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commenting out works to prevent creation of rollup index pattern. Code LGTM.
💚 Build Succeeded |
💚 Build Succeeded |
Enabled: - View/Manage/Create rollup jobs Disabled: - Create a rollup index pattern - Create rollup visualizations - Add rollup visualizations to dashboards - View raw rollup documents in Discover
Meta issue: #20004
Overview
This PR introduces rollup support to Kibana. Specifically, the ability to:
Testing plan
Please refer to this document for detailed information and testing strategy for each aspect of rollup support: Rollups testing plan
Rollup job management