forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🌊 Move streams to platform (elastic#211893)
This PR moves the `streams` and `streams_app` plugins into platform so they can be used in other solutions in the future. This PR is not actually making it available in other solutions yet since we are still discussing the release plans. ## Inlined helpers As discussed before, this PR inlines a couple simple helper methods for query building, time zone normalization, a header portal helper and a data plugin timefilter state react integration hook as there is no good place for these outside of the observability solution. ## streams_app plugin The streams_app plugin is not actually registering anything, instead it simply exports a component that renders the app which needs to be consumed by another plugin to turn it into a registered app - for now, `observability_streams_wrapper` takes over this job. ## observability_streams_wrapper plugin While 99% of the streams logic is moved into the `platform/shared/streams_app`, two bits are left behind in `observability_streams_wrapper`: * The actual app registration * Integration with the observability_shared `PageTemplate` component Once we decide streams should be displayed outside of the observability solution, it's probably not necessary anymore to decouple app definition and registration like this because it will always be visible no matter the solution. Once this is the case, the navigation registration can be moved into the central `observability` plugin, like it's handled with other apps like infra. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
876959f
commit 8a9bb36
Showing
238 changed files
with
819 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
58 changes: 58 additions & 0 deletions
58
x-pack/platform/plugins/shared/streams/server/routes/esql/query_helpers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import type { estypes } from '@elastic/elasticsearch'; | ||
import { fromKueryExpression, toElasticsearchQuery } from '@kbn/es-query'; | ||
|
||
function excludeTiersQuery( | ||
excludedDataTiers: Array<'data_frozen' | 'data_cold' | 'data_warm' | 'data_hot'> | ||
): estypes.QueryDslQueryContainer[] { | ||
return [ | ||
{ | ||
bool: { | ||
must_not: [ | ||
{ | ||
terms: { | ||
_tier: excludedDataTiers, | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
]; | ||
} | ||
|
||
export function excludeFrozenQuery(): estypes.QueryDslQueryContainer[] { | ||
return excludeTiersQuery(['data_frozen']); | ||
} | ||
|
||
export function kqlQuery(kql?: string): estypes.QueryDslQueryContainer[] { | ||
if (!kql) { | ||
return []; | ||
} | ||
|
||
const ast = fromKueryExpression(kql); | ||
return [toElasticsearchQuery(ast)]; | ||
} | ||
|
||
export function rangeQuery( | ||
start?: number, | ||
end?: number, | ||
field = '@timestamp' | ||
): estypes.QueryDslQueryContainer[] { | ||
return [ | ||
{ | ||
range: { | ||
[field]: { | ||
gte: start, | ||
lte: end, | ||
format: 'epoch_millis', | ||
}, | ||
}, | ||
}, | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
module.exports = { | ||
preset: '@kbn/test', | ||
rootDir: '../../../../..', | ||
roots: [ | ||
'<rootDir>/x-pack/platform/plugins/shared/streams_app/public', | ||
'<rootDir>/x-pack/platform/plugins/shared/streams_app/common', | ||
'<rootDir>/x-pack/platform/plugins/shared/streams_app/server', | ||
], | ||
setupFiles: ['<rootDir>/x-pack/platform/plugins/shared/streams_app/.storybook/jest_setup.js'], | ||
collectCoverage: true, | ||
collectCoverageFrom: [ | ||
'<rootDir>/x-pack/platform/plugins/shared/streams_app/{public,common,server}/**/*.{js,ts,tsx}', | ||
], | ||
|
||
coverageReporters: ['html'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.