Skip to content

Commit

Permalink
[Infra UI] Add APM to Metadata Endpoint
Browse files Browse the repository at this point in the history
- Adds APM feature to metadata
- Closes elastic#42167
- Based on elastic#41836
  • Loading branch information
simianhacker committed Aug 2, 2019
1 parent 4a234b9 commit 2947214
Show file tree
Hide file tree
Showing 6 changed files with 17,841 additions and 160 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { GraphQLSchema } from 'graphql';
import { Lifecycle, ResponseToolkit, RouteOptions } from 'hapi';
import { Legacy } from 'kibana';

import { KibanaConfig } from 'src/legacy/server/kbn_server';
import { JsonObject } from '../../../../common/typed_json';
import { InfraMetricModel } from '../metrics/adapter_types';

Expand Down Expand Up @@ -60,6 +61,7 @@ export interface InfraBackendFrameworkAdapter {
timerange: { min: number; max: number },
filters: JsonObject[]
): Promise<InfraTSVBResponse>;
config(req: InfraFrameworkRequest): KibanaConfig;
}
/* eslint-enable @typescript-eslint/unified-signatures */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { GenericParams } from 'elasticsearch';
import { GraphQLSchema } from 'graphql';
import { Legacy } from 'kibana';

import { KibanaConfig } from 'src/legacy/server/kbn_server';
import { InfraMetricModel } from '../metrics/adapter_types';
import {
InfraBackendFrameworkAdapter,
Expand Down Expand Up @@ -36,6 +37,11 @@ export class InfraKibanaBackendFrameworkAdapter implements InfraBackendFramework
this.version = server.config().get('pkg.version');
}

public config(req: InfraFrameworkRequest<Legacy.Request>): KibanaConfig {
const internalRequest = req[internalInfraFrameworkRequest];
return internalRequest.server.config();
}

public exposeStaticDir(urlPath: string, dir: string): void {
this.server.route({
handler: {
Expand Down
10 changes: 10 additions & 0 deletions x-pack/legacy/plugins/infra/server/routes/metadata/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
import { InfraBackendLibs } from '../../lib/infra_types';
import { getMetricMetadata } from './lib/get_metric_metadata';
import { pickFeatureName } from './lib/pick_feature_name';
// import { hasAPMData } from './lib/has_apm_data';
import { getCloudMetricsMetadata } from './lib/get_cloud_metric_metadata';
import { getNodeInfo } from './lib/get_node_info';
import { throwErrors } from '../../../common/runtime_types';
Expand Down Expand Up @@ -54,6 +55,15 @@ export const initMetadataRoute = (libs: InfraBackendLibs) => {
nameToFeature('metrics')
);

// const hasAPMData = await hasAPMData(
// framework,
// req,
// configuration,
// nodeId,
// nodeType
// );
// const apmMetricData = hasAPMData ? [{ name: 'apm.transaction', source: 'apm' }] : [];

const id = metricsMetadata.id;
const name = metricsMetadata.name || id;
return InfraMetadataRT.decode({
Expand Down
Loading

0 comments on commit 2947214

Please sign in to comment.