Skip to content

Commit

Permalink
Merge branch 'master' into eui-39.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Oct 18, 2021
2 parents 7f78ab4 + 7e1acab commit e398a70
Show file tree
Hide file tree
Showing 24 changed files with 313 additions and 87 deletions.
2 changes: 1 addition & 1 deletion docs/getting-started/quick-start-guide.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ image::images/dashboard_sampleDataAddFilter_7.15.0.png[The [eCommerce] Revenue D
[[quick-start-whats-next]]
== What's next?

*Add your own data.* Ready to add your own data? Go to {fleet-guide}/fleet-quick-start.html[Quick start: Get logs and metrics into the Elastic Stack] to learn how to ingest your data, or go to <<connect-to-elasticsearch,Add data to {kib}>> and learn about all the other ways you can add data.
*Add your own data.* Ready to add your own data? Go to {observability-guide}/ingest-logs-metrics-uptime.html[Ingest logs, metrics, and uptime data with {agent}], or go to <<connect-to-elasticsearch,Add data to {kib}>> and learn about all the other ways you can add data.

*Explore your own data in Discover.* Ready to learn more about exploring your data in *Discover*? Go to <<discover, Discover>>.

Expand Down
2 changes: 1 addition & 1 deletion docs/osquery/osquery.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ The following is an example of an **error response** for an undefined action que
== System requirements

* {fleet-guide}/fleet-overview.html[Fleet] is enabled on your cluster, and
one or more {fleet-guide}/elastic-agent-installation-configuration.html[Elastic Agents] is enrolled.
one or more {fleet-guide}/elastic-agent-installation.html[Elastic Agents] is enrolled.
* The https://docs.elastic.co/en/integrations/osquery_manager[*Osquery Manager*] integration
has been added and configured
for an agent policy through Fleet.
Expand Down
2 changes: 1 addition & 1 deletion docs/setup/connect-to-elasticsearch.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ so you can quickly get insights into your data, and {fleet} mode offers several
image::images/addData_fleet_7.15.0.png[Add data using Fleet]

To get started, refer to
{fleet-guide}/fleet-quick-start.html[Quick start: Get logs and metrics into the Elastic Stack].
{observability-guide}/ingest-logs-metrics-uptime.html[Ingest logs, metrics, and uptime data with {agent}].

[discrete]
[[upload-data-kibana]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ const registerHttpRequestMockHelpers = (server: SinonFakeServer) => {
]);
};

const setReloadIndicesResponse = (response: HttpResponse = []) => {
server.respondWith('POST', `${API_BASE_PATH}/indices/reload`, [
200,
{ 'Content-Type': 'application/json' },
JSON.stringify(response),
]);
};

const setLoadDataStreamsResponse = (response: HttpResponse = []) => {
server.respondWith('GET', `${API_BASE_PATH}/data_streams`, [
200,
Expand Down Expand Up @@ -118,6 +126,7 @@ const registerHttpRequestMockHelpers = (server: SinonFakeServer) => {
return {
setLoadTemplatesResponse,
setLoadIndicesResponse,
setReloadIndicesResponse,
setLoadDataStreamsResponse,
setLoadDataStreamResponse,
setDeleteDataStreamResponse,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,26 @@ export const setup = async (overridingDependencies: any = {}): Promise<IndicesTe
*/

const clickContextMenuOption = async (optionDataTestSubject: string) => {
const { find } = testBed;
const contextMenu = find('indexContextMenu');
contextMenu.find(`button[data-test-subj="${optionDataTestSubject}"]`).simulate('click');
const { find, component } = testBed;

await act(async () => {
find(`indexContextMenu.${optionDataTestSubject}`).simulate('click');
});
component.update();
};

const clickIncludeHiddenIndicesToggle = () => {
const { find } = testBed;
find('indexTableIncludeHiddenIndicesToggle').simulate('click');
};

const clickManageContextMenuButton = () => {
const { find } = testBed;
find('indexActionsContextMenuButton').simulate('click');
const clickManageContextMenuButton = async () => {
const { find, component } = testBed;

await act(async () => {
find('indexActionsContextMenuButton').simulate('click');
});
component.update();
};

const getIncludeHiddenIndicesToggleStatus = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { act } from 'react-dom/test-utils';
import { API_BASE_PATH } from '../../../common/constants';
import { setupEnvironment, nextTick } from '../helpers';
import { IndicesTestBed, setup } from './indices_tab.helpers';
import { createDataStreamPayload } from './data_streams_tab.helpers';
import { createDataStreamPayload, createNonDataStreamIndex } from './data_streams_tab.helpers';

/**
* The below import is required to avoid a console error warn from the "brace" package
Expand All @@ -23,9 +23,14 @@ import { createMemoryHistory } from 'history';
stubWebWorker();

// unhandled promise rejection https://github.com/elastic/kibana/issues/112699
describe.skip('<IndexManagementHome />', () => {
const { server, httpRequestsMockHelpers } = setupEnvironment();
describe('<IndexManagementHome />', () => {
let testBed: IndicesTestBed;
let server: ReturnType<typeof setupEnvironment>['server'];
let httpRequestsMockHelpers: ReturnType<typeof setupEnvironment>['httpRequestsMockHelpers'];

beforeEach(() => {
({ server, httpRequestsMockHelpers } = setupEnvironment());
});

afterAll(() => {
server.restore();
Expand Down Expand Up @@ -108,19 +113,9 @@ describe.skip('<IndexManagementHome />', () => {

describe('index detail panel with % character in index name', () => {
const indexName = 'test%';

beforeEach(async () => {
const index = {
health: 'green',
status: 'open',
primary: 1,
replica: 1,
documents: 10000,
documents_deleted: 100,
size: '156kb',
primary_size: '156kb',
name: indexName,
};
httpRequestsMockHelpers.setLoadIndicesResponse([index]);
httpRequestsMockHelpers.setLoadIndicesResponse([createNonDataStreamIndex(indexName)]);

testBed = await setup();
const { component, find } = testBed;
Expand Down Expand Up @@ -165,20 +160,11 @@ describe.skip('<IndexManagementHome />', () => {

describe('index actions', () => {
const indexName = 'testIndex';

beforeEach(async () => {
const index = {
health: 'green',
status: 'open',
primary: 1,
replica: 1,
documents: 10000,
documents_deleted: 100,
size: '156kb',
primary_size: '156kb',
name: indexName,
};

httpRequestsMockHelpers.setLoadIndicesResponse([index]);
httpRequestsMockHelpers.setLoadIndicesResponse([createNonDataStreamIndex(indexName)]);
httpRequestsMockHelpers.setReloadIndicesResponse({ indexNames: [indexName] });

testBed = await setup();
const { find, component } = testBed;
component.update();
Expand All @@ -188,11 +174,15 @@ describe.skip('<IndexManagementHome />', () => {

test('should be able to flush index', async () => {
const { actions } = testBed;

await actions.clickManageContextMenuButton();
await actions.clickContextMenuOption('flushIndexMenuButton');

const latestRequest = server.requests[server.requests.length - 1];
expect(latestRequest.url).toBe(`${API_BASE_PATH}/indices/flush`);
const requestsCount = server.requests.length;
expect(server.requests[requestsCount - 2].url).toBe(`${API_BASE_PATH}/indices/flush`);
// After the indices are flushed, we imediately reload them. So we need to expect to see
// a reload server call also.
expect(server.requests[requestsCount - 1].url).toBe(`${API_BASE_PATH}/indices/reload`);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ import {
MONITORS_DURATION_LABEL,
PAGE_LOAD_TIME_LABEL,
LABELS_FIELD,
STEP_NAME_LABEL,
} from './labels';
import { SYNTHETICS_STEP_NAME } from './field_names/synthetics';

export const DEFAULT_TIME = { from: 'now-1h', to: 'now' };

Expand Down Expand Up @@ -77,6 +79,7 @@ export const FieldLabels: Record<string, string> = {
'monitor.id': MONITOR_ID_LABEL,
'monitor.status': MONITOR_STATUS_LABEL,
'monitor.duration.us': MONITORS_DURATION_LABEL,
[SYNTHETICS_STEP_NAME]: STEP_NAME_LABEL,

'agent.hostname': AGENT_HOST_LABEL,
'host.hostname': HOST_NAME_LABEL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ export const SYNTHETICS_LCP = 'browser.experience.lcp.us';
export const SYNTHETICS_FCP = 'browser.experience.fcp.us';
export const SYNTHETICS_DOCUMENT_ONLOAD = 'browser.experience.load.us';
export const SYNTHETICS_DCL = 'browser.experience.dcl.us';
export const SYNTHETICS_STEP_NAME = 'synthetics.step.name.keyword';
export const SYNTHETICS_STEP_DURATION = 'synthetics.step.duration.us';
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,20 @@ export const MONITORS_DURATION_LABEL = i18n.translate(
}
);

export const STEP_DURATION_LABEL = i18n.translate(
'xpack.observability.expView.fieldLabels.stepDurationLabel',
{
defaultMessage: 'Step duration',
}
);

export const STEP_NAME_LABEL = i18n.translate(
'xpack.observability.expView.fieldLabels.stepNameLabel',
{
defaultMessage: 'Step name',
}
);

export const WEB_APPLICATION_LABEL = i18n.translate(
'xpack.observability.expView.fieldLabels.webApplication',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,12 @@ export class LensAttributes {
label,
sourceField,
columnType,
columnFilter,
operationType,
}: {
sourceField: string;
columnType?: string;
columnFilter?: ColumnFilter;
operationType?: string;
label?: string;
seriesConfig: SeriesConfig;
Expand All @@ -214,6 +216,7 @@ export class LensAttributes {
operationType,
label,
seriesConfig,
columnFilter,
});
}
if (operationType?.includes('th')) {
Expand All @@ -228,11 +231,13 @@ export class LensAttributes {
label,
seriesConfig,
operationType,
columnFilter,
}: {
sourceField: string;
operationType: 'average' | 'median' | 'sum' | 'unique_count';
label?: string;
seriesConfig: SeriesConfig;
columnFilter?: ColumnFilter;
}):
| AvgIndexPatternColumn
| MedianIndexPatternColumn
Expand All @@ -247,6 +252,7 @@ export class LensAttributes {
operationType: capitalize(operationType),
},
}),
filter: columnFilter,
operationType,
};
}
Expand Down Expand Up @@ -391,6 +397,7 @@ export class LensAttributes {
return this.getNumberColumn({
sourceField: fieldName,
columnType,
columnFilter: columnFilters?.[0],
operationType,
label: columnLabel || label,
seriesConfig: layerConfig.seriesConfig,
Expand Down Expand Up @@ -447,10 +454,10 @@ export class LensAttributes {

return this.getColumnBasedOnType({
sourceField,
operationType: breakdown === PERCENTILE ? PERCENTILE_RANKS[0] : operationType,
label,
layerConfig,
colIndex: 0,
operationType: breakdown === PERCENTILE ? PERCENTILE_RANKS[0] : operationType,
});
}

Expand Down Expand Up @@ -629,7 +636,12 @@ export class LensAttributes {
[`y-axis-column-${layerId}`]: {
...mainYAxis,
label,
filter: { query: columnFilter, language: 'kuery' },
filter: {
query: mainYAxis.filter
? `${columnFilter} and ${mainYAxis.filter.query}`
: columnFilter,
language: 'kuery',
},
...(timeShift ? { timeShift } : {}),
},
...(breakdown && sourceField !== USE_BREAK_DOWN_COLUMN && breakdown !== PERCENTILE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
SYNTHETICS_FCP,
SYNTHETICS_LCP,
} from '../constants/field_names/synthetics';
import { buildExistsFilter } from '../utils';

export function getSyntheticsDistributionConfig({
series,
Expand Down Expand Up @@ -58,7 +59,10 @@ export function getSyntheticsDistributionConfig({
'url.port',
],
baseFilters: [],
definitionFields: ['monitor.name', 'url.full'],
definitionFields: [
{ field: 'monitor.name', nested: 'synthetics.step.name.keyword', singleSelection: true },
{ field: 'url.full', filters: buildExistsFilter('summary.up', indexPattern) },
],
metricOptions: [
{
label: MONITORS_DURATION_LABEL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
SYNTHETICS_DOCUMENT_ONLOAD,
SYNTHETICS_FCP,
SYNTHETICS_LCP,
SYNTHETICS_STEP_DURATION,
} from '../constants/field_names/synthetics';

export const syntheticsFieldFormats: FieldFormat[] = [
Expand All @@ -27,6 +28,19 @@ export const syntheticsFieldFormats: FieldFormat[] = [
},
},
},
{
field: SYNTHETICS_STEP_DURATION,
format: {
id: 'duration',
params: {
inputFormat: 'microseconds',
outputFormat: 'humanizePrecise',
outputPrecision: 1,
showSuffix: true,
useShortSuffix: true,
},
},
},
{
field: SYNTHETICS_LCP,
format: {
Expand Down
Loading

0 comments on commit e398a70

Please sign in to comment.