Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Infra UI] Add APM Section to Node Detail Page #42710

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
2947214
[Infra UI] Add APM to Metadata Endpoint
simianhacker Jul 29, 2019
0064ac5
migrating to new http api
simianhacker Aug 2, 2019
fcd0d73
Merge branch 'master' of github.com:elastic/kibana into fixes-42167
simianhacker Aug 2, 2019
b57bee7
[Infra UI] Add APM Metrics Endpoint
simianhacker Aug 2, 2019
c7c54e4
[Infra UI] Add APM Section to Node Detail Page
simianhacker Aug 6, 2019
87ec3c8
Merge branch 'master' of github.com:elastic/kibana into fixes-42170
simianhacker Aug 7, 2019
cce26e7
Fixing test
simianhacker Aug 7, 2019
d840ff7
Fixing types
simianhacker Aug 7, 2019
ac3e2fe
Removing extra check
simianhacker Aug 7, 2019
ffe42b8
Consolidating code; fixing charts;
simianhacker Aug 7, 2019
5ffec5a
Removing crosshair properties
simianhacker Aug 7, 2019
150bfc6
adding onChangeRangeTime back to section
simianhacker Aug 7, 2019
71e6962
translating apm link
simianhacker Aug 7, 2019
92f9a7a
Remove left over include
simianhacker Aug 8, 2019
938e182
Fixing i18n id
simianhacker Aug 8, 2019
5087b72
Removing xpack.infra.metrics.layoutLabelOverviewTitle
simianhacker Aug 8, 2019
2279377
Fixing the Typescript signature for the layout generation functions
simianhacker Aug 8, 2019
f17362f
Merge branch 'master' of github.com:elastic/kibana into fixes-42170
simianhacker Aug 8, 2019
5c180f5
removing bad merge
simianhacker Aug 9, 2019
7e45de0
Merge branch 'master' of github.com:elastic/kibana into fixes-42170
simianhacker Aug 9, 2019
bacb23d
Fixing typing error from merge
simianhacker Aug 9, 2019
2f15d5c
Merge branch 'master' of github.com:elastic/kibana into fixes-42170
simianhacker Aug 12, 2019
3ec1334
Merge branch 'master' of github.com:elastic/kibana into fixes-42170
simianhacker Aug 13, 2019
443cde1
Merge branch 'master' of github.com:elastic/kibana into fixes-42170
simianhacker Aug 14, 2019
4088c9e
Merge branch 'master' of github.com:elastic/kibana into fixes-42170
simianhacker Aug 16, 2019
7b8a9d0
Merge branch 'master' of github.com:elastic/kibana into fixes-42170
simianhacker Aug 19, 2019
5c82e99
Merge branch 'master' of github.com:elastic/kibana into fixes-42170
simianhacker Aug 21, 2019
7dc57ee
Fixing when the APM request is made. Turning on legends
simianhacker Aug 22, 2019
8f75596
Merge branch 'master' of github.com:elastic/kibana into fixes-42170
simianhacker Aug 22, 2019
878badc
Merge branch 'master' of github.com:elastic/kibana into fixes-42170
simianhacker Aug 26, 2019
f76975a
Merge branch 'master' of github.com:elastic/kibana into fixes-42170
simianhacker Aug 27, 2019
afd8bf0
updating yarn.lock
simianhacker Aug 27, 2019
e9c049b
Removing obsolute tests
simianhacker Aug 27, 2019
ce46c7d
Merge branch 'master' of github.com:elastic/kibana into fixes-42170
simianhacker Sep 3, 2019
17f73e3
Merge branch 'master' of github.com:elastic/kibana into fixes-42170
simianhacker Sep 10, 2019
559201c
Merge branch 'master' of github.com:elastic/kibana into fixes-42170
simianhacker Sep 11, 2019
c01f3f5
Upgrading to latest version of io-ts
simianhacker Sep 11, 2019
79e0006
Fixing incompatible error
simianhacker Sep 12, 2019
2228706
Merge branch 'master' of github.com:elastic/kibana into fixes-42170
simianhacker Sep 16, 2019
711255a
Removing interal requests in favor of exposed API's
simianhacker Sep 16, 2019
6862d42
Merge branch 'master' of github.com:elastic/kibana into fixes-42170
simianhacker Sep 19, 2019
ff6cd2e
Merge branch 'master' of github.com:elastic/kibana into fixes-42170
simianhacker Sep 19, 2019
e83a822
Merge branch 'master' of github.com:elastic/kibana into fixes-42170
simianhacker Sep 25, 2019
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
23 changes: 15 additions & 8 deletions x-pack/legacy/plugins/apm/server/routes/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import * as t from 'io-ts';
import { Legacy } from 'kibana';
import { AgentName } from '../../typings/es_schemas/ui/fields/Agent';
import { createApmTelementry, storeApmTelemetry } from '../lib/apm_telemetry';
import { setupRequest } from '../lib/helpers/setup_request';
Expand All @@ -14,12 +15,8 @@ import { getServiceTransactionTypes } from '../lib/services/get_service_transact
import { createRoute } from './create_route';
import { uiFiltersRt, rangeRt } from './default_api_types';

export const servicesRoute = createRoute(core => ({
path: '/api/apm/services',
params: {
query: t.intersection([uiFiltersRt, rangeRt])
},
handler: async req => {
export const servicesRoute = createRoute(core => {
const handler = async (req: Legacy.Request) => {
const setup = await setupRequest(req);
const services = await getServices(setup);
const { server } = core.http;
Expand All @@ -32,8 +29,18 @@ export const servicesRoute = createRoute(core => ({
storeApmTelemetry(server, apmTelemetry);

return services;
}
}));
};
// The Infra UI needs to be able to make requests to this endpoint without
// going through the server's router (via server.inject).
core.http.server.expose('getServices', handler);
return {
path: '/api/apm/services',
params: {
query: t.intersection([uiFiltersRt, rangeRt])
},
handler
};
});

export const serviceAgentNameRoute = createRoute(() => ({
path: '/api/apm/services/{serviceName}/agent_name',
Expand Down
47 changes: 30 additions & 17 deletions x-pack/legacy/plugins/apm/server/routes/transaction_groups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import * as t from 'io-ts';
import { Legacy } from 'kibana';
import { setupRequest } from '../lib/helpers/setup_request';
import { getTransactionCharts } from '../lib/transactions/charts';
import { getTransactionDistribution } from '../lib/transactions/distribution';
Expand Down Expand Up @@ -44,22 +45,23 @@ export const transactionGroupsRoute = createRoute(() => ({
}
}));

export const transactionGroupsChartsRoute = createRoute(() => ({
path: '/api/apm/services/{serviceName}/transaction_groups/charts',
params: {
path: t.type({
serviceName: t.string
export const transactionGroupsChartsRoute = createRoute(core => {
const PathRT = t.type({
serviceName: t.string
});
const QueryRT = t.intersection([
t.partial({
transactionType: t.string,
transactionName: t.string
}),
query: t.intersection([
t.partial({
transactionType: t.string,
transactionName: t.string
}),
uiFiltersRt,
rangeRt
])
},
handler: async (req, { path, query }) => {
uiFiltersRt,
rangeRt
]);
interface Params {
path: t.TypeOf<typeof PathRT>;
query: t.TypeOf<typeof QueryRT>;
}
const handler = async (req: Legacy.Request, { path, query }: Params) => {
const setup = await setupRequest(req);
const { serviceName } = path;
const { transactionType, transactionName } = query;
Expand All @@ -70,8 +72,19 @@ export const transactionGroupsChartsRoute = createRoute(() => ({
transactionName,
setup
});
}
}));
};
// The Infra UI needs to be able to make requests to this endpoint without
// going through the server's router (via server.inject).
core.http.server.expose('getTransactionGroupsCharts', handler);
return {
path: '/api/apm/services/{serviceName}/transaction_groups/charts',
params: {
path: PathRT,
query: QueryRT
},
handler
};
});

export const transactionGroupsDistributionRoute = createRoute(() => ({
path: '/api/apm/services/{serviceName}/transaction_groups/distribution',
Expand Down
1 change: 1 addition & 0 deletions x-pack/legacy/plugins/infra/common/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ export enum InfraMetric {
nginxRequestRate = 'nginxRequestRate',
nginxActiveConnections = 'nginxActiveConnections',
nginxRequestsPerConnection = 'nginxRequestsPerConnection',
apmMetrics = 'apmMetrics',
awsOverview = 'awsOverview',
awsCpuUtilization = 'awsCpuUtilization',
awsNetworkBytes = 'awsNetworkBytes',
Expand Down
116 changes: 116 additions & 0 deletions x-pack/legacy/plugins/infra/common/http_api/apm_metrics_api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/*
* 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 * as rt from 'io-ts';
import { InfraWrappableRequest } from '../../server/lib/adapters/framework';
import { InfraNodeTypeRT } from './common';

export const InfraApmMetricsRequestRT = rt.type({
timeRange: rt.type({
min: rt.number,
max: rt.number,
}),
nodeId: rt.string,
nodeType: InfraNodeTypeRT,
sourceId: rt.string,
});

export const InfraApmMetricsTransactionTypeRT = rt.keyof({
request: null,
job: null,
});

export const InfraApmMetricsDataPointRT = rt.type({
timestamp: rt.number,
value: rt.union([rt.number, rt.null]),
});

export const InfraApmMetricsSeriesRT = rt.type({
id: rt.string,
data: rt.array(InfraApmMetricsDataPointRT),
});

export const InfraApmMetricsDataSetRT = rt.type({
id: rt.string,
type: InfraApmMetricsTransactionTypeRT,
series: rt.array(InfraApmMetricsSeriesRT),
});

export const InfraApmMetricsServiceRT = rt.type({
id: rt.string,
dataSets: rt.array(InfraApmMetricsDataSetRT),
agentName: rt.string,
avgResponseTime: rt.number,
errorsPerMinute: rt.number,
transactionsPerMinute: rt.number,
});

export const InfraApmMetricsRT = rt.type({
id: rt.literal('apmMetrics'),
services: rt.array(InfraApmMetricsServiceRT),
});

export const APMDataPointRT = rt.type({
x: rt.number,
y: rt.union([rt.number, rt.null]),
});

export const APMTpmBucketsRT = rt.type({
key: rt.string,
dataPoints: rt.array(APMDataPointRT),
});

export const APMChartResponseRT = rt.type({
apmTimeseries: rt.intersection([
rt.type({
responseTimes: rt.type({
avg: rt.array(APMDataPointRT),
p95: rt.array(APMDataPointRT),
p99: rt.array(APMDataPointRT),
}),
tpmBuckets: rt.array(APMTpmBucketsRT),
}),
rt.partial({
overallAvgDuration: rt.union([rt.number, rt.null]),
}),
]),
});

export const APMServiceResponseRT = rt.type({
hasHistoricalData: rt.boolean,
hasLegacyData: rt.boolean,
items: rt.array(
rt.type({
agentName: rt.string,
avgResponseTime: rt.number,
environments: rt.array(rt.string),
errorsPerMinute: rt.number,
serviceName: rt.string,
transactionsPerMinute: rt.number,
})
),
});

export type InfraApmMetricsRequest = rt.TypeOf<typeof InfraApmMetricsRequestRT>;

export type InfraApmMetricsRequestWrapped = InfraWrappableRequest<InfraApmMetricsRequest>;

export type InfraApmMetrics = rt.TypeOf<typeof InfraApmMetricsRT>;

export type InfraApmMetricsService = rt.TypeOf<typeof InfraApmMetricsServiceRT>;

export type InfraApmMetricsSeries = rt.TypeOf<typeof InfraApmMetricsSeriesRT>;

export type InfraApmMetricsDataPoint = rt.TypeOf<typeof InfraApmMetricsDataPointRT>;

export type InfraApmMetricsTransactionType = rt.TypeOf<typeof InfraApmMetricsTransactionTypeRT>;

export type InfraApmMetricsDataSet = rt.TypeOf<typeof InfraApmMetricsDataSetRT>;

export type APMDataPoint = rt.TypeOf<typeof APMDataPointRT>;

export type APMTpmBuckets = rt.TypeOf<typeof APMTpmBucketsRT>;

export type APMChartResponse = rt.TypeOf<typeof APMChartResponseRT>;
14 changes: 14 additions & 0 deletions x-pack/legacy/plugins/infra/common/http_api/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* 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 * as rt from 'io-ts';

export const InfraNodeTypeRT = rt.keyof({
host: null,
container: null,
pod: null,
});

export type InfraNodeType = rt.TypeOf<typeof InfraNodeTypeRT>;
1 change: 1 addition & 0 deletions x-pack/legacy/plugins/infra/common/http_api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

export * from './log_analysis';
export * from './metadata_api';
export * from './apm_metrics_api';
11 changes: 2 additions & 9 deletions x-pack/legacy/plugins/infra/common/http_api/metadata_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@

import * as rt from 'io-ts';
import { InfraWrappableRequest } from '../../server/lib/adapters/framework';

export const InfraMetadataNodeTypeRT = rt.keyof({
host: null,
pod: null,
container: null,
});
import { InfraNodeTypeRT } from './common';

export const InfraMetadataRequestRT = rt.type({
nodeId: rt.string,
nodeType: InfraMetadataNodeTypeRT,
nodeType: InfraNodeTypeRT,
sourceId: rt.string,
});

Expand Down Expand Up @@ -98,5 +93,3 @@ export type InfraMetadataMachine = rt.TypeOf<typeof InfraMetadataMachineRT>;
export type InfraMetadataHost = rt.TypeOf<typeof InfraMetadataHostRT>;

export type InfraMetadataOS = rt.TypeOf<typeof InfraMetadataOSRT>;

export type InfraMetadataNodeType = rt.TypeOf<typeof InfraMetadataNodeTypeRT>;
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,20 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { InfraSourceConfiguration } from '../../../lib/sources';
import { InfraSourceConfiguration } from '../graphql/types';
import { InfraNodeType } from '../http_api/common';

export const getIdFieldName = (sourceConfiguration: InfraSourceConfiguration, nodeType: string) => {
export const getApmFieldName = (
sourceConfiguration: InfraSourceConfiguration,
nodeType: InfraNodeType
) => {
return nodeType === 'host' ? 'host.hostname' : getIdFieldName(sourceConfiguration, nodeType);
};

export const getIdFieldName = (
sourceConfiguration: InfraSourceConfiguration,
nodeType: InfraNodeType
) => {
switch (nodeType) {
case 'host':
return sourceConfiguration.fields.host;
Expand Down
3 changes: 1 addition & 2 deletions x-pack/legacy/plugins/infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
"build-graphql-types": "node scripts/generate_types_from_graphql.js"
},
"devDependencies": {
"@types/boom": "7.2.1",
"@types/lodash": "^4.14.110"
},
"dependencies": {
"@types/color": "^3.0.0",
"boom": "7.3.0",
"lodash": "^4.17.15"
}
}
}
Loading