Skip to content

Commit

Permalink
Merge branch 'tech-debt/rename_examples' of github.com:clintandrewhal…
Browse files Browse the repository at this point in the history
…l/kibana into tech-debt/rename_examples
  • Loading branch information
clintandrewhall committed Jul 31, 2020
2 parents 6949957 + de8799f commit 32d3328
Show file tree
Hide file tree
Showing 312 changed files with 2,977 additions and 2,683 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,6 @@ export function extractNanos(timeFieldValue: string = ''): string {
return fractionSeconds.length !== 9 ? fractionSeconds.padEnd(9, '0') : fractionSeconds;
}

/**
* extract the nanoseconds as string of a given ISO formatted timestamp
*/
export function convertIsoToNanosAsStr(isoValue: string): string {
const nanos = extractNanos(isoValue);
const millis = convertIsoToMillis(isoValue);
return `${millis}${nanos.substr(3, 6)}`;
}

/**
* convert an iso formatted string to number of milliseconds since
* 1970-01-01T00:00:00.000Z
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
import { convertIsoToNanosAsStr } from './date_conversion';
import { SurrDocType, EsHitRecordList, EsHitRecord } from '../context';

export type EsQuerySearchAfter = [string | number, string | number];
Expand All @@ -38,15 +37,10 @@ export function getEsQuerySearchAfter(
// already surrounding docs -> first or last record is used
const afterTimeRecIdx = type === 'successors' && documents.length ? documents.length - 1 : 0;
const afterTimeDoc = documents[afterTimeRecIdx];
const afterTimeValue = nanoSeconds
? convertIsoToNanosAsStr(afterTimeDoc.fields[timeFieldName][0])
: afterTimeDoc.sort[0];
const afterTimeValue = nanoSeconds ? afterTimeDoc._source[timeFieldName] : afterTimeDoc.sort[0];
return [afterTimeValue, afterTimeDoc.sort[1]];
}
// if data_nanos adapt timestamp value for sorting, since numeric value was rounded by browser
// ES search_after also works when number is provided as string
return [
nanoSeconds ? convertIsoToNanosAsStr(anchor.fields[timeFieldName][0]) : anchor.sort[0],
anchor.sort[1],
];
return [nanoSeconds ? anchor._source[timeFieldName] : anchor.sort[0], anchor.sort[1]];
}
3 changes: 1 addition & 2 deletions test/functional/apps/context/_date_nanos.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['common', 'context', 'timePicker', 'discover']);
const esArchiver = getService('esArchiver');

// FLAKY/FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/58815
describe.skip('context view for date_nanos', () => {
describe('context view for date_nanos', () => {
before(async function () {
await security.testUser.setRoles(['kibana_admin', 'kibana_date_nanos']);
await esArchiver.loadIfNeeded('date_nanos');
Expand Down
5 changes: 1 addition & 4 deletions test/functional/apps/context/_date_nanos_custom_timestamp.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ export default function ({ getService, getPageObjects }) {
const PageObjects = getPageObjects(['common', 'context', 'timePicker', 'discover']);
const esArchiver = getService('esArchiver');

// skipped due to a recent change in ES that caused search_after queries with data containing
// custom timestamp formats like in the testdata to fail
// https://github.com/elastic/kibana/issues/58815
describe.skip('context view for date_nanos with custom timestamp', () => {
describe('context view for date_nanos with custom timestamp', () => {
before(async function () {
await security.testUser.setRoles(['kibana_admin', 'kibana_date_nanos_custom']);
await esArchiver.loadIfNeeded('date_nanos_custom');
Expand Down
22 changes: 13 additions & 9 deletions test/functional/page_objects/discover_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
* under the License.
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../ftr_provider_context';

export function DiscoverPageProvider({ getService, getPageObjects }: FtrProviderContext) {
const log = getService('log');
const retry = getService('retry');
const testSubjects = getService('testSubjects');
const find = getService('find');
Expand Down Expand Up @@ -51,19 +49,25 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider
}

public async saveSearch(searchName: string) {
log.debug('saveSearch');
await this.clickSaveSearchButton();
await testSubjects.setValue('savedObjectTitle', searchName);
// preventing an occasional flakiness when the saved object wasn't set and the form can't be submitted
await retry.waitFor(
`saved search title is set to ${searchName} and save button is clickable`,
async () => {
const saveButton = await testSubjects.find('confirmSaveSavedObjectButton');
await testSubjects.setValue('savedObjectTitle', searchName);
return (await saveButton.getAttribute('disabled')) !== 'true';
}
);
await testSubjects.click('confirmSaveSavedObjectButton');
await header.waitUntilLoadingHasFinished();
// LeeDr - this additional checking for the saved search name was an attempt
// to cause this method to wait for the reloading of the page to complete so
// that the next action wouldn't have to retry. But it doesn't really solve
// that issue. But it does typically take about 3 retries to
// complete with the expected searchName.
await retry.try(async () => {
const name = await this.getCurrentQueryName();
expect(name).to.be(searchName);
await retry.waitFor(`saved search was persisted with name ${searchName}`, async () => {
return (await this.getCurrentQueryName()) === searchName;
});
}

Expand Down Expand Up @@ -96,11 +100,11 @@ export function DiscoverPageProvider({ getService, getPageObjects }: FtrProvider

// We need this try loop here because previous actions in Discover like
// saving a search cause reloading of the page and the "Open" menu item goes stale.
await retry.try(async () => {
await retry.waitFor('saved search panel is opened', async () => {
await this.clickLoadSavedSearchButton();
await header.waitUntilLoadingHasFinished();
isOpen = await testSubjects.exists('loadSearchForm');
expect(isOpen).to.be(true);
return isOpen === true;
});
}

Expand Down
14 changes: 14 additions & 0 deletions x-pack/plugins/apm/common/processor_event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,18 @@ export enum ProcessorEvent {
transaction = 'transaction',
error = 'error',
metric = 'metric',
span = 'span',
onboarding = 'onboarding',
sourcemap = 'sourcemap',
}
/**
* Processor events that are searchable in the UI via the query bar.
*
* Some client-sideroutes will define 1 or more processor events that
* will be used to fetch the dynamic index pattern for the query bar.
*/

export type UIProcessorEvent =
| ProcessorEvent.transaction
| ProcessorEvent.error
| ProcessorEvent.metric;
16 changes: 16 additions & 0 deletions x-pack/plugins/apm/common/projections.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export enum Projection {
services = 'services',
transactionGroups = 'transactionGroups',
traces = 'traces',
transactions = 'transactions',
metrics = 'metrics',
errorGroups = 'errorGroups',
serviceNodes = 'serviceNodes',
rumOverview = 'rumOverview',
}
64 changes: 0 additions & 64 deletions x-pack/plugins/apm/common/projections/services.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { i18n } from '@kbn/i18n';
import React, { useMemo } from 'react';
import { useTrackPageview } from '../../../../../observability/public';
import { PROJECTION } from '../../../../common/projections/typings';
import { Projection } from '../../../../common/projections';
import { useFetcher } from '../../../hooks/useFetcher';
import { useUrlParams } from '../../../hooks/useUrlParams';
import { callApmApi } from '../../../services/rest/createCallApmApi';
Expand Down Expand Up @@ -79,7 +79,7 @@ function ErrorGroupOverview() {
params: {
serviceName,
},
projection: PROJECTION.ERROR_GROUPS,
projection: Projection.errorGroups,
};

return config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from '@elastic/eui';
import { useTrackPageview } from '../../../../../observability/public';
import { LocalUIFilters } from '../../shared/LocalUIFilters';
import { PROJECTION } from '../../../../common/projections/typings';
import { Projection } from '../../../../common/projections';
import { RumDashboard } from './RumDashboard';
import { ServiceNameFilter } from '../../shared/LocalUIFilters/ServiceNameFilter';
import { useUrlParams } from '../../../hooks/useUrlParams';
Expand All @@ -28,7 +28,7 @@ export function RumOverview() {
const localUIFiltersConfig = useMemo(() => {
const config: React.ComponentProps<typeof LocalUIFilters> = {
filterNames: ['transactionUrl', 'location', 'device', 'os', 'browser'],
projection: PROJECTION.RUM_OVERVIEW,
projection: Projection.rumOverview,
};

return config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { useServiceMetricCharts } from '../../../hooks/useServiceMetricCharts';
import { MetricsChart } from '../../shared/charts/MetricsChart';
import { useUrlParams } from '../../../hooks/useUrlParams';
import { ChartsSyncContextProvider } from '../../../context/ChartsSyncContext';
import { PROJECTION } from '../../../../common/projections/typings';
import { Projection } from '../../../../common/projections';
import { LocalUIFilters } from '../../shared/LocalUIFilters';

interface ServiceMetricsProps {
Expand All @@ -36,7 +36,7 @@ export function ServiceMetrics({ agentName }: ServiceMetricsProps) {
serviceName,
serviceNodeName,
},
projection: PROJECTION.METRICS,
projection: Projection.metrics,
showCount: false,
}),
[serviceName, serviceNodeName]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { i18n } from '@kbn/i18n';
import styled from 'styled-components';
import { UNIDENTIFIED_SERVICE_NODES_LABEL } from '../../../../common/i18n';
import { SERVICE_NODE_NAME_MISSING } from '../../../../common/service_nodes';
import { PROJECTION } from '../../../../common/projections/typings';
import { Projection } from '../../../../common/projections';
import { LocalUIFilters } from '../../shared/LocalUIFilters';
import { useUrlParams } from '../../../hooks/useUrlParams';
import { ManagedTable, ITableColumn } from '../../shared/ManagedTable';
Expand Down Expand Up @@ -46,7 +46,7 @@ function ServiceNodeOverview() {
params: {
serviceName,
},
projection: PROJECTION.SERVICE_NODES,
projection: Projection.serviceNodes,
}),
[serviceName]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { NoServicesMessage } from './NoServicesMessage';
import { ServiceList } from './ServiceList';
import { useUrlParams } from '../../../hooks/useUrlParams';
import { useTrackPageview } from '../../../../../observability/public';
import { PROJECTION } from '../../../../common/projections/typings';
import { Projection } from '../../../../common/projections';
import { LocalUIFilters } from '../../shared/LocalUIFilters';
import { useApmPluginContext } from '../../../hooks/useApmPluginContext';

Expand Down Expand Up @@ -88,7 +88,7 @@ export function ServiceOverview() {
const localFiltersConfig: React.ComponentProps<typeof LocalUIFilters> = useMemo(
() => ({
filterNames: ['host', 'agentName'],
projection: PROJECTION.SERVICES,
projection: Projection.services,
}),
[]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { TraceList } from './TraceList';
import { useUrlParams } from '../../../hooks/useUrlParams';
import { useTrackPageview } from '../../../../../observability/public';
import { LocalUIFilters } from '../../shared/LocalUIFilters';
import { PROJECTION } from '../../../../common/projections/typings';
import { Projection } from '../../../../common/projections';
import { APIReturnType } from '../../../services/rest/createCallApmApi';

type TracesAPIResponse = APIReturnType<'/api/apm/traces'>;
Expand Down Expand Up @@ -48,7 +48,7 @@ export function TraceOverview() {
const localUIFiltersConfig = useMemo(() => {
const config: React.ComponentProps<typeof LocalUIFilters> = {
filterNames: ['transactionResult', 'host', 'containerId', 'podName'],
projection: PROJECTION.TRACES,
projection: Projection.traces,
};

return config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { FETCH_STATUS } from '../../../hooks/useFetcher';
import { TransactionBreakdown } from '../../shared/TransactionBreakdown';
import { ChartsSyncContextProvider } from '../../../context/ChartsSyncContext';
import { useTrackPageview } from '../../../../../observability/public';
import { PROJECTION } from '../../../../common/projections/typings';
import { Projection } from '../../../../common/projections';
import { LocalUIFilters } from '../../shared/LocalUIFilters';
import { HeightRetainer } from '../../shared/HeightRetainer';
import { ErroneousTransactionsRateChart } from '../../shared/charts/ErroneousTransactionsRateChart';
Expand All @@ -52,7 +52,7 @@ export function TransactionDetails() {
const localUIFiltersConfig = useMemo(() => {
const config: React.ComponentProps<typeof LocalUIFilters> = {
filterNames: ['transactionResult', 'serviceVersion'],
projection: PROJECTION.TRANSACTIONS,
projection: Projection.transactions,
params: {
transactionName,
transactionType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { ChartsSyncContextProvider } from '../../../context/ChartsSyncContext';
import { useTrackPageview } from '../../../../../observability/public';
import { fromQuery, toQuery } from '../../shared/Links/url_helpers';
import { LocalUIFilters } from '../../shared/LocalUIFilters';
import { PROJECTION } from '../../../../common/projections/typings';
import { Projection } from '../../../../common/projections';
import { useUrlParams } from '../../../hooks/useUrlParams';
import { useServiceTransactionTypes } from '../../../hooks/useServiceTransactionTypes';
import { TransactionTypeFilter } from '../../shared/LocalUIFilters/TransactionTypeFilter';
Expand Down Expand Up @@ -103,7 +103,7 @@ export function TransactionOverview() {
serviceName,
transactionType,
},
projection: PROJECTION.TRANSACTION_GROUPS,
projection: Projection.transactionGroups,
}),
[serviceName, transactionType]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { uniqueId, startsWith } from 'lodash';
import styled from 'styled-components';
import { i18n } from '@kbn/i18n';
import { fromQuery, toQuery } from '../Links/url_helpers';
// @ts-ignore
// @ts-expect-error
import { Typeahead } from './Typeahead';
import { getBoolFilter } from './get_bool_filter';
import { useLocation } from '../../../hooks/useLocation';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import styled from 'styled-components';
import { LocalUIFilterName } from '../../../../server/lib/ui_filters/local_ui_filters/config';
import { Filter } from './Filter';
import { useLocalUIFilters } from '../../../hooks/useLocalUIFilters';
import { PROJECTION } from '../../../../common/projections/typings';
import { Projection } from '../../../../common/projections';

interface Props {
projection: PROJECTION;
projection: Projection;
filterNames: LocalUIFilterName[];
params?: Record<string, string | number | boolean | undefined>;
showCount?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { EuiTitle } from '@elastic/eui';
import React from 'react';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { GenericMetricsChart } from '../../../../../server/lib/metrics/transform_metrics_chart';
// @ts-ignore
// @ts-expect-error
import CustomPlot from '../CustomPlot';
import {
asDecimal,
Expand Down
Loading

0 comments on commit 32d3328

Please sign in to comment.