Skip to content

Commit

Permalink
Merge branch 'main' into json-view-api
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 authored Dec 19, 2023
2 parents 5a7840e + b247e89 commit 7122c20
Show file tree
Hide file tree
Showing 277 changed files with 3,028 additions and 1,128 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/skip-failed-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: ./actions/permission-check
with:
permission: admin
teams: appex-qa
teams: appex-qa, security-solution-test-skippers
token: ${{secrets.KIBANAMACHINE_TOKEN}}

- name: Checkout kibana-operations
Expand Down
3 changes: 3 additions & 0 deletions docs/management/advanced-options.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,9 @@ preview:[] When enabled, allows users to create Service Groups from the APM Serv
[[observability-apm-trace-explorer-tab]]`observability:apmTraceExplorerTab`::
preview:[] Enable the APM Trace Explorer feature, that allows you to search and inspect traces with KQL or EQL.

[[observability-infrastructure-profiling-integration]]`observability:enableInfrastructureProfilingIntegration`::
preview:[] Enables the Profiling view in Host details within Infrastructure.

[float]
[[kibana-reporting-settings]]
==== Reporting
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-doc-links/src/get_doc_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
cronExpressions: `${ELASTICSEARCH_DOCS}cron-expressions.html`,
executeWatchActionModes: `${ELASTICSEARCH_DOCS}watcher-api-execute-watch.html#watcher-api-execute-watch-action-mode`,
indexExists: `${ELASTICSEARCH_DOCS}indices-exists.html`,
inferTrainedModel: `${ELASTICSEARCH_DOCS}infer-trained-model.html`,
multiSearch: `${ELASTICSEARCH_DOCS}search-multi-search.html`,
openIndex: `${ELASTICSEARCH_DOCS}indices-open-close.html`,
putComponentTemplate: `${ELASTICSEARCH_DOCS}indices-component-template.html`,
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-doc-links/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ export interface DocLinks {
cronExpressions: string;
executeWatchActionModes: string;
indexExists: string;
inferTrainedModel: string;
multiSearch: string;
openIndex: string;
putComponentTemplate: string;
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-es-query/src/expressions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { Filter, Query, TimeRange } from '../filters';

export interface ExecutionContextSearch {
now?: number;
filters?: Filter[];
query?: Query | Query[];
timeRange?: TimeRange;
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pageLoadAssetSize:
kibanaUsageCollection: 16463
kibanaUtils: 79713
kubernetesSecurity: 77234
lens: 39000
lens: 41000
licenseManagement: 41817
licensing: 29004
links: 44490
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/plugins/data/common/search/expressions/kibana.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ describe('interpreter/functions#kibana', () => {
beforeEach(() => {
input = { timeRange: { from: '0', to: '1' } };
search = {
now: 0,
type: 'kibana_context',
query: { language: 'lucene', query: 'geo.src:US' },
filters: [
Expand Down
1 change: 1 addition & 0 deletions src/plugins/data/common/search/expressions/kibana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const kibana: ExpressionFunctionKibana = {
// TODO: But it shouldn't be need.
...input,
type: 'kibana_context',
now: getSearchContext().now ?? Date.now(),
query: [...toArray(getSearchContext().query), ...toArray((input || {}).query)],
filters: [...(getSearchContext().filters || []), ...((input || {}).filters || [])],
timeRange: getSearchContext().timeRange || (input ? input.timeRange : undefined),
Expand Down
9 changes: 7 additions & 2 deletions src/plugins/discover/common/locator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,17 +218,22 @@ describe('Discover url generator', () => {
expect(path).toContain('__test__');
});

test('can specify columns, interval, sort and savedQuery', async () => {
test('can specify columns, grid, interval, sort and savedQuery', async () => {
const { locator } = await setup();
const { path } = await locator.getLocation({
columns: ['_source'],
grid: {
columns: {
_source: { width: 150 },
},
},
interval: 'auto',
sort: [['timestamp, asc']] as string[][] & SerializableRecord,
savedQuery: '__savedQueryId__',
});

expect(path).toMatchInlineSnapshot(
`"#/?_a=(columns:!(_source),interval:auto,savedQuery:__savedQueryId__,sort:!(!('timestamp,%20asc')))"`
`"#/?_a=(columns:!(_source),grid:(columns:(_source:(width:150))),interval:auto,savedQuery:__savedQueryId__,sort:!(!('timestamp,%20asc')))"`
);
});

Expand Down
9 changes: 9 additions & 0 deletions src/plugins/discover/common/locator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type { SerializableRecord } from '@kbn/utility-types';
import type { Filter, TimeRange, Query, AggregateQuery } from '@kbn/es-query';
import type { GlobalQueryStateFromUrl, RefreshInterval } from '@kbn/data-plugin/public';
import type { LocatorDefinition, LocatorPublic } from '@kbn/share-plugin/public';
import type { DiscoverGridSettings } from '@kbn/saved-search-plugin/common';
import { DataViewSpec } from '@kbn/data-views-plugin/common';
import { setStateToKbnUrl } from '@kbn/kibana-utils-plugin/common';
import { VIEW_MODE } from './constants';
Expand Down Expand Up @@ -70,6 +71,11 @@ export interface DiscoverAppLocatorParams extends SerializableRecord {
*/
columns?: string[];

/**
* Data Grid related state
*/
grid?: DiscoverGridSettings;

/**
* Used interval of the histogram
*/
Expand Down Expand Up @@ -139,6 +145,7 @@ export class DiscoverAppLocatorDefinition implements LocatorDefinition<DiscoverA
timeRange,
searchSessionId,
columns,
grid,
savedQuery,
sort,
interval,
Expand All @@ -154,6 +161,7 @@ export class DiscoverAppLocatorDefinition implements LocatorDefinition<DiscoverA
filters?: Filter[];
index?: string;
columns?: string[];
grid?: DiscoverGridSettings;
interval?: string;
sort?: string[][];
savedQuery?: string;
Expand All @@ -169,6 +177,7 @@ export class DiscoverAppLocatorDefinition implements LocatorDefinition<DiscoverA
if (indexPatternId) appState.index = indexPatternId;
if (dataViewId) appState.index = dataViewId;
if (columns) appState.columns = columns;
if (grid) appState.grid = grid;
if (savedQuery) appState.savedQuery = savedQuery;
if (sort) appState.sort = sort;
if (interval) appState.interval = interval;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,11 @@ export const getTopNavLinks = ({
const { timefilter } = services.data.query.timefilter;
const timeRange = timefilter.getTime();
const refreshInterval = timefilter.getRefreshInterval();
const { grid, ...otherState } = appState;
const filters = services.filterManager.getFilters();

// Share -> Get links -> Snapshot
const params: DiscoverAppLocatorParams = {
...otherState,
...appState,
...(savedSearch.id ? { savedSearchId: savedSearch.id } : {}),
...(dataView?.isPersisted()
? { dataViewId: dataView?.id }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { SavedSearch, VIEW_MODE } from '@kbn/saved-search-plugin/public';
import { IKbnUrlStateStorage, ISyncStateRef, syncState } from '@kbn/kibana-utils-plugin/public';
import { isEqual } from 'lodash';
import { connectToQueryState, syncGlobalQueryStateWithUrl } from '@kbn/data-plugin/public';
import type { UnifiedDataTableSettings } from '@kbn/unified-data-table';
import type { DiscoverGridSettings } from '@kbn/saved-search-plugin/common';
import type { DiscoverServices } from '../../../build_services';
import { addLog } from '../../../utils/add_log';
import { cleanupUrlState } from '../utils/cleanup_url_state';
Expand Down Expand Up @@ -94,7 +94,7 @@ export interface DiscoverAppState {
/**
* Data Grid related state
*/
grid?: UnifiedDataTableSettings;
grid?: DiscoverGridSettings;
/**
* Hide chart
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ function createUrlGeneratorState({
: data.query.timefilter.timefilter.getTime(),
searchSessionId: shouldRestoreSearchSession ? data.search.session.getSessionId() : undefined,
columns: appState.columns,
grid: appState.grid,
sort: appState.sort,
savedQuery: appState.savedQuery,
interval: appState.interval,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export * from './overall_metric';
export * from './derivative';
export * from './moving_average';
export * from './ui_setting';
export * from './math_column';
export type { MapColumnArguments } from './map_column';
export { mapColumn } from './map_column';
export type { MathArguments, MathInput } from './math';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ export type MathColumnArguments = MathArguments & {
copyMetaFrom?: string | null;
};

export const mathColumn: ExpressionFunctionDefinition<
export type ExpressionFunctionMathColumn = ExpressionFunctionDefinition<
'mathColumn',
Datatable,
MathColumnArguments,
Promise<Datatable>
> = {
>;

export const mathColumn: ExpressionFunctionMathColumn = {
name: 'mathColumn',
type: 'datatable',
inputTypes: ['datatable'],
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/expressions/common/expression_functions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
ExpressionFunctionDerivative,
ExpressionFunctionMovingAverage,
ExpressionFunctionOverallMetric,
ExpressionFunctionMathColumn,
} from './specs';
import { ExpressionAstFunction } from '../ast';

Expand Down Expand Up @@ -132,4 +133,5 @@ export interface ExpressionFunctionDefinitions {
overall_metric: ExpressionFunctionOverallMetric;
derivative: ExpressionFunctionDerivative;
moving_average: ExpressionFunctionMovingAverage;
math_column: ExpressionFunctionMathColumn;
}
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,10 @@ export const stackManagementSchema: MakeSchemaFrom<UsageStats> = {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'observability:enableInfrastructureProfilingIntegration': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
},
'securitySolution:enableGroupedNav': {
type: 'boolean',
_meta: { description: 'Non-default value of setting.' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export interface UsageStats {
'observability:apmAWSLambdaPriceFactor': string;
'observability:apmAWSLambdaRequestCostPerMillion': number;
'observability:enableInfrastructureHostsView': boolean;
'observability:enableInfrastructureProfilingIntegration': boolean;
'observability:apmAgentExplorerView': boolean;
'visualization:heatmap:maxBuckets': number;
'visualization:colorMapping': string;
Expand Down
13 changes: 5 additions & 8 deletions src/plugins/saved_search/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
import type { ISearchSource, RefreshInterval, TimeRange } from '@kbn/data-plugin/common';
import type { SavedObjectReference } from '@kbn/core-saved-objects-server';
import type { SavedObjectsResolveResponse } from '@kbn/core/server';
import type { SerializableRecord } from '@kbn/utility-types';
import { VIEW_MODE } from '.';

export interface DiscoverGridSettings {
export interface DiscoverGridSettings extends SerializableRecord {
columns?: Record<string, DiscoverGridSettingsColumn>;
}

export interface DiscoverGridSettingsColumn {
export interface DiscoverGridSettingsColumn extends SerializableRecord {
width?: number;
}

Expand All @@ -25,9 +26,7 @@ export interface SavedSearchAttributes {
sort: Array<[string, string]>;
columns: string[];
description: string;
grid: {
columns?: Record<string, DiscoverGridSettingsColumn>;
};
grid: DiscoverGridSettings;
hideChart: boolean;
isTextBasedQuery: boolean;
usesAdHocDataView?: boolean;
Expand Down Expand Up @@ -59,9 +58,7 @@ export interface SavedSearch {
columns?: string[];
description?: string;
tags?: string[] | undefined;
grid?: {
columns?: Record<string, DiscoverGridSettingsColumn>;
};
grid?: DiscoverGridSettings;
hideChart?: boolean;
viewMode?: VIEW_MODE;
hideAggregatedPreview?: boolean;
Expand Down
1 change: 1 addition & 0 deletions src/plugins/saved_search/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@kbn/discover-utils",
"@kbn/logging",
"@kbn/core-plugins-server",
"@kbn/utility-types",
],
"exclude": [
"target/**/*",
Expand Down
6 changes: 6 additions & 0 deletions src/plugins/telemetry/schema/oss_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -10061,6 +10061,12 @@
"description": "Non-default value of setting."
}
},
"observability:enableInfrastructureProfilingIntegration": {
"type": "boolean",
"_meta": {
"description": "Non-default value of setting."
}
},
"securitySolution:enableGroupedNav": {
"type": "boolean",
"_meta": {
Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/discover/group1/_discover_histogram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const log = getService('log');
const queryBar = getService('queryBar');

describe('discover histogram', function describeIndexTests() {
// FLAKY: https://github.com/elastic/kibana/issues/173586
describe.skip('discover histogram', function describeIndexTests() {
before(async () => {
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
await esArchiver.load('test/functional/fixtures/es_archiver/long_window_logstash');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});

describe('index pattern edit', function () {
// FLAKY: https://github.com/elastic/kibana/issues/173625
describe.skip('index pattern edit', function () {
it('should update field list', async function () {
await PageObjects.settings.editIndexPattern(
'kibana_sample_data_flights',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export const SelectConnector: React.FC = () => {
'xpack.enterpriseSearch.selectConnector.p.areAvailableDirectlyWithinLabel',
{
defaultMessage:
'Are available directly within Elastic Cloud deployments No additional infrastructure is required You can also convert them as self hosted Connectors client at any moment',
'Available directly within Elastic Cloud deployments. No additional infrastructure is required. You can also convert native connectors to self-hosted connector clients.',
}
)}
</p>
Expand Down Expand Up @@ -259,7 +259,7 @@ export const SelectConnector: React.FC = () => {
'xpack.enterpriseSearch.selectConnector.p.deployConnectorsOnYourLabel',
{
defaultMessage:
'Deploy connectors on your own infrastructure You can also customize existing Connector clients or build your own using our connector framework',
'Deploy connectors on your own infrastructure. You can also customize existing connector clients, or build your own using our connector framework.',
}
)}
</p>
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/fleet/common/types/models/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ export interface AgentUpgradeDetails {
metadata?: {
scheduled_at?: string;
download_percent?: number;
download_rate?: number; // bytes per second
failed_state?: AgentUpgradeStateType;
error_msg?: string;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,38 @@ describe('getDownloadEstimate', () => {
expect(getDownloadEstimate()).toEqual('');
});

it('should return an empty string if the agent has a zero download percent', () => {
expect(getDownloadEstimate(0)).toEqual('');
it('should display 0% if the agent has a zero download percent', () => {
expect(getDownloadEstimate({ download_percent: 0 })).toEqual(' (0%)');
});

it('should display 0 Bps if the agent has a zero download rate', () => {
expect(getDownloadEstimate({ download_rate: 0 })).toEqual(' (at 0.0 Bps)');
});

it('should return a formatted string if the agent has a positive download percent', () => {
expect(getDownloadEstimate(16.4)).toEqual(' (16.4%)');
expect(getDownloadEstimate({ download_percent: 16.4 })).toEqual(' (16.4%)');
});

it('should return a formatted string if the agent has a kBps download rate', () => {
expect(getDownloadEstimate({ download_rate: 1024 })).toEqual(' (at 1.0 kBps)');
});

it('should return a formatted string if the agent has a download rate and download percent', () => {
expect(getDownloadEstimate({ download_rate: 10, download_percent: 99 })).toEqual(
' (99% at 10.0 Bps)'
);
});

it('should return a formatted string if the agent has a MBps download rate', () => {
expect(getDownloadEstimate({ download_rate: 1200000 })).toEqual(' (at 1.1 MBps)');
});

it('should return a formatted string if the agent has a GBps download rate', () => {
expect(getDownloadEstimate({ download_rate: 2400000000 })).toEqual(' (at 2.2 GBps)');
});

it('should return a formatted string if the agent has a GBps download rate more than 1024', () => {
expect(getDownloadEstimate({ download_rate: 1200000000 * 1024 })).toEqual(' (at 1144.4 GBps)');
});
});

Expand Down
Loading

0 comments on commit 7122c20

Please sign in to comment.