Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions x-pack/plugins/apm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import { resolve } from 'path';
import { initTransactionsApi } from './server/routes/transactions';
import { initTransactionGroupsApi } from './server/routes/transaction_groups';
import { initServicesApi } from './server/routes/services';
import { initErrorsApi } from './server/routes/errors';
import { initStatusApi } from './server/routes/status_check';
Expand Down Expand Up @@ -64,6 +65,7 @@ export function apm(kibana) {

init(server) {
initTransactionsApi(server);
initTransactionGroupsApi(server);
initTracesApi(server);
initServicesApi(server);
initErrorsApi(server);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import React from 'react';
import { shallow } from 'enzyme';
import { ServiceOverview } from '../view';
import { STATUS } from '../../../../constants';
import * as apmRestServices from '../../../../services/rest/apm';

jest.mock('../../../../services/rest/apm');
import * as apmRestServices from '../../../../services/rest/apm/status_check';
jest.mock('../../../../services/rest/apm/status_check');

describe('Service Overview -> View', () => {
let mockAgentStatus;
Expand All @@ -22,7 +21,6 @@ describe('Service Overview -> View', () => {
dataFound: true
};

// eslint-disable-next-line import/namespace
apmRestServices.loadAgentStatus = jest.fn(() =>
Promise.resolve(mockAgentStatus)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React, { Component } from 'react';
import { RRRRenderResponse } from 'react-redux-request';
import { IUrlParams } from 'x-pack/plugins/apm/public/store/urlParams';
import { IServiceListItem } from 'x-pack/plugins/apm/server/lib/services/get_services';
import { loadAgentStatus } from '../../../services/rest/apm';
import { loadAgentStatus } from '../../../services/rest/apm/status_check';
import { ServiceListRequest } from '../../../store/reactReduxRequest/serviceList';
import { EmptyMessage } from '../../shared/EmptyMessage';
import { SetupInstructionsLink } from '../../shared/SetupInstructionsLink';
Expand Down
314 changes: 0 additions & 314 deletions x-pack/plugins/apm/public/services/rest/apm.ts

This file was deleted.

36 changes: 36 additions & 0 deletions x-pack/plugins/apm/public/services/rest/apm/apm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* 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.
*/

import { Span } from 'x-pack/plugins/apm/typings/Span';
import { Transaction } from 'x-pack/plugins/apm/typings/Transaction';
// @ts-ignore
import { convertKueryToEsQuery } from '../../kuery';
// @ts-ignore
import { getAPMIndexPattern } from '../savedObjects';

export async function getEncodedEsQuery(kuery?: string) {
if (!kuery) {
return;
}

const indexPattern = await getAPMIndexPattern();
if (!indexPattern) {
return;
}

const esFilterQuery = convertKueryToEsQuery(kuery, indexPattern);
return encodeURIComponent(JSON.stringify(esFilterQuery));
}

export function addVersion<T extends Span | Transaction | null | undefined>(
item: T
): T {
if (item != null) {
item.version = item.hasOwnProperty('trace') ? 'v2' : 'v1';
}

return item;
}
Loading