Skip to content

Commit

Permalink
Merge branch 'master' into bumpMakelogsPackage
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored May 14, 2020
2 parents b27cb3c + bf796b2 commit 184c2cb
Show file tree
Hide file tree
Showing 54 changed files with 562 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,13 @@ export class IndexPattern implements IIndexPattern {
}

async popularizeField(fieldName: string, unit = 1) {
/**
* This function is just used by Discover and it's high likely to be removed in the near future
* It doesn't use the save function to skip the error message that's displayed when
* a user adds several columns in a higher frequency that the changes can be persisted to ES
* resulting in 409 errors
*/
if (!this.id) return;
const field = this.fields.getByName(fieldName);
if (!field) {
return;
Expand All @@ -308,7 +315,15 @@ export class IndexPattern implements IIndexPattern {
return;
}
field.count = count;
await this.save();

try {
const res = await this.savedObjectsClient.update(type, this.id, this.prepBody(), {
version: this.version,
});
this.version = res._version;
} catch (e) {
// no need for an error message here
}
}

getNonScriptedFields() {
Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/visualize/_tsvb_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
const security = getService('security');
const PageObjects = getPageObjects(['visualize', 'visualBuilder', 'timePicker', 'visChart']);

describe('visual builder', function describeIndexTests() {
// FLAKY: https://github.com/elastic/kibana/issues/43150
describe.skip('visual builder', function describeIndexTests() {
this.tags('includeFirefox');
beforeEach(async () => {
await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader']);
Expand Down
7 changes: 5 additions & 2 deletions x-pack/plugins/apm/public/application/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { UpdateBreadcrumbs } from '../components/app/Main/UpdateBreadcrumbs';
import { APMIndicesPermission } from '../components/app/APMIndicesPermission';
import { ScrollToTopOnPathChange } from '../components/app/Main/ScrollToTopOnPathChange';
import { routes } from '../components/app/Main/route_config';
import { history } from '../utils/history';
import { history, resetHistory } from '../utils/history';
import { ConfigSchema } from '..';
import 'react-vis/dist/style.css';

Expand Down Expand Up @@ -111,6 +111,7 @@ export const renderApp = (
{ element }: AppMountParameters,
config: ConfigSchema
) => {
resetHistory();
ReactDOM.render(
<ApmAppRoot
core={core}
Expand All @@ -120,5 +121,7 @@ export const renderApp = (
/>,
element
);
return () => ReactDOM.unmountComponentAtNode(element);
return () => {
ReactDOM.unmountComponentAtNode(element);
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ import {
AGENT,
URL,
USER,
CUSTOM_ERROR
CUSTOM_ERROR,
TRACE,
TRANSACTION
} from '../sections';

export const ERROR_METADATA_SECTIONS: Section[] = [
{ ...LABELS, required: true },
TRACE,
TRANSACTION,
ERROR,
HTTP,
HOST,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import {

export const SPAN_METADATA_SECTIONS: Section[] = [
LABELS,
SPAN,
TRANSACTION,
TRACE,
TRANSACTION,
SPAN,
SERVICE,
MESSAGE_SPAN,
AGENT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ import {
USER,
USER_AGENT,
CUSTOM_TRANSACTION,
MESSAGE_TRANSACTION
MESSAGE_TRANSACTION,
TRACE
} from '../sections';

export const TRANSACTION_METADATA_SECTIONS: Section[] = [
{ ...LABELS, required: true },
TRACE,
TRANSACTION,
HTTP,
HOST,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ export const TRACE: Section = {
key: 'trace',
label: i18n.translate('xpack.apm.metadataTable.section.traceLabel', {
defaultMessage: 'Trace'
})
}),
properties: ['id']
};

export const ERROR: Section = {
Expand Down
6 changes: 5 additions & 1 deletion x-pack/plugins/apm/public/utils/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { createHashHistory } from 'history';

// Make history singleton available across APM project
// TODO: Explore using React context or hook instead?
const history = createHashHistory();
let history = createHashHistory();

export const resetHistory = () => {
history = createHashHistory();
};

export { history };
13 changes: 5 additions & 8 deletions x-pack/plugins/apm/server/routes/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import * as t from 'io-ts';
import Boom from 'boom';
import { unique } from 'lodash';
import { ScopedAnnotationsClient } from '../../../observability/server';
import { setupRequest } from '../lib/helpers/setup_request';
import { getServiceAgentName } from '../lib/services/get_service_agent_name';
import { getServices } from '../lib/services/get_services';
Expand Down Expand Up @@ -95,13 +94,10 @@ export const serviceAnnotationsRoute = createRoute(() => ({
const { serviceName } = context.params.path;
const { environment } = context.params.query;

let annotationsClient: ScopedAnnotationsClient | undefined;

if (context.plugins.observability) {
annotationsClient = await context.plugins.observability.getScopedAnnotationsClient(
request
);
}
const annotationsClient = await context.plugins.observability?.getScopedAnnotationsClient(
context,
request
);

return getServiceAnnotations({
setup,
Expand Down Expand Up @@ -143,6 +139,7 @@ export const serviceAnnotationsCreateRoute = createRoute(() => ({
},
handler: async ({ request, context }) => {
const annotationsClient = await context.plugins.observability?.getScopedAnnotationsClient(
context,
request
);

Expand Down
3 changes: 3 additions & 0 deletions x-pack/plugins/ingest_manager/common/types/models/epm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ export interface IndexTemplate {
mappings: object;
aliases: object;
};
data_stream: {
timestamp_field: string;
};
}

export interface TemplateRef {
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ function getBaseTemplate(
// To be filled with the aliases that we need
aliases: {},
},
data_stream: {
timestamp_field: '@timestamp',
},
};
}

Expand Down
43 changes: 35 additions & 8 deletions x-pack/plugins/lens/public/app_plugin/app.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ describe('Lens App', () => {
storage: Storage;
docId?: string;
docStorage: SavedObjectStore;
redirectTo: (id?: string, returnToOrigin?: boolean, newlyCreated?: boolean) => void;
redirectTo: (
id?: string,
returnToOrigin?: boolean,
originatingApp?: string | undefined,
newlyCreated?: boolean
) => void;
originatingApp: string | undefined;
}> {
return ({
Expand Down Expand Up @@ -140,7 +145,14 @@ describe('Lens App', () => {
load: jest.fn(),
save: jest.fn(),
},
redirectTo: jest.fn((id?: string, returnToOrigin?: boolean, newlyCreated?: boolean) => {}),
redirectTo: jest.fn(
(
id?: string,
returnToOrigin?: boolean,
originatingApp?: string | undefined,
newlyCreated?: boolean
) => {}
),
} as unknown) as jest.Mocked<{
navigation: typeof navigationStartMock;
editorFrame: EditorFrameInstance;
Expand All @@ -149,7 +161,12 @@ describe('Lens App', () => {
storage: Storage;
docId?: string;
docStorage: SavedObjectStore;
redirectTo: (id?: string, returnToOrigin?: boolean, newlyCreated?: boolean) => void;
redirectTo: (
id?: string,
returnToOrigin?: boolean,
originatingApp?: string | undefined,
newlyCreated?: boolean
) => void;
originatingApp: string | undefined;
}>;
}
Expand Down Expand Up @@ -348,7 +365,12 @@ describe('Lens App', () => {
storage: Storage;
docId?: string;
docStorage: SavedObjectStore;
redirectTo: (id?: string, returnToOrigin?: boolean, newlyCreated?: boolean) => void;
redirectTo: (
id?: string,
returnToOrigin?: boolean,
originatingApp?: string | undefined,
newlyCreated?: boolean
) => void;
originatingApp: string | undefined;
}>;

Expand Down Expand Up @@ -521,7 +543,7 @@ describe('Lens App', () => {
expression: 'kibana 3',
});

expect(args.redirectTo).toHaveBeenCalledWith('aaa', undefined, true);
expect(args.redirectTo).toHaveBeenCalledWith('aaa', undefined, undefined, true);

inst.setProps({ docId: 'aaa' });

Expand All @@ -541,7 +563,7 @@ describe('Lens App', () => {
expression: 'kibana 3',
});

expect(args.redirectTo).toHaveBeenCalledWith('aaa', undefined, true);
expect(args.redirectTo).toHaveBeenCalledWith('aaa', undefined, undefined, true);

inst.setProps({ docId: 'aaa' });

Expand Down Expand Up @@ -609,7 +631,7 @@ describe('Lens App', () => {
title: 'hello there',
});

expect(args.redirectTo).toHaveBeenCalledWith('aaa', true, true);
expect(args.redirectTo).toHaveBeenCalledWith('aaa', true, undefined, true);
});

it('saves app filters and does not save pinned filters', async () => {
Expand Down Expand Up @@ -677,7 +699,12 @@ describe('Lens App', () => {
storage: Storage;
docId?: string;
docStorage: SavedObjectStore;
redirectTo: (id?: string, returnToOrigin?: boolean, newlyCreated?: boolean) => void;
redirectTo: (
id?: string,
returnToOrigin?: boolean,
originatingApp?: string | undefined,
newlyCreated?: boolean
) => void;
}>;

beforeEach(() => {
Expand Down
Loading

0 comments on commit 184c2cb

Please sign in to comment.