Skip to content

Commit

Permalink
[Metrics UI] Remove APM Hard Dependency (elastic#64952)
Browse files Browse the repository at this point in the history
* [Metrics UI] Remove APM Hard Dependency

* removing unused variable

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
simianhacker and elasticmachine committed May 5, 2020
1 parent 07b2bfb commit d679d84
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 94 deletions.
1 change: 0 additions & 1 deletion x-pack/plugins/infra/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"kibanaVersion": "kibana",
"requiredPlugins": [
"features",
"apm",
"usageCollection",
"spaces",
"home",
Expand Down
6 changes: 1 addition & 5 deletions x-pack/plugins/infra/server/routes/metadata/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ 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 @@ -67,16 +66,13 @@ export const initMetadataRoute = (libs: InfraBackendLibs) => {
const cloudMetricsFeatures = pickFeatureName(cloudMetricsMetadata.buckets).map(
nameToFeature('metrics')
);
const hasAPM = await hasAPMData(framework, requestContext, configuration, nodeId, nodeType);
const apmMetricFeatures = hasAPM ? [{ name: 'apm.transaction', source: 'apm' }] : [];

const id = metricsMetadata.id;
const name = metricsMetadata.name || id;
return response.ok({
body: InfraMetadataRT.encode({
id,
name,
features: [...metricFeatures, ...cloudMetricsFeatures, ...apmMetricFeatures],
features: [...metricFeatures, ...cloudMetricsFeatures],
info,
}),
});
Expand Down
54 changes: 0 additions & 54 deletions x-pack/plugins/infra/server/routes/metadata/lib/has_apm_data.ts

This file was deleted.

46 changes: 12 additions & 34 deletions x-pack/test/api_integration/apis/infra/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ import {
} from '../../../../plugins/infra/common/http_api/metadata_api';
import { FtrProviderContext } from '../../ftr_provider_context';

import { DATES } from './constants';

const timeRange700 = {
from: DATES['7.0.0'].hosts.min,
to: DATES[`7.0.0`].hosts.max,
};

const timeRange660 = {
from: DATES['6.6.0'].docker.min,
to: DATES[`6.6.0`].docker.max,
};

export default function({ getService }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const supertest = getService('supertest');
Expand Down Expand Up @@ -241,40 +253,6 @@ export default function({ getService }: FtrProviderContext) {
}
});
});
describe('APM metrics', () => {
const archiveName = 'infra/8.0.0/metrics_and_apm';
before(() => esArchiver.load(archiveName));
after(() => esArchiver.unload(archiveName));

it('host without APM data', async () => {
const metadata = await fetchMetadata({
sourceId: 'default',
nodeId: 'gke-observability-8--observability-8--bc1afd95-f0zc',
nodeType: 'host',
});
if (metadata) {
expect(
metadata.features.some(f => f.name === 'apm.transaction' && f.source === 'apm')
).to.be(false);
} else {
throw new Error('Metadata should never be empty');
}
});
it('pod with APM data', async () => {
const metadata = await fetchMetadata({
sourceId: 'default',
nodeId: 'c1031331-9ae0-11e9-9a96-42010a84004d',
nodeType: 'pod',
});
if (metadata) {
expect(
metadata.features.some(f => f.name === 'apm.transaction' && f.source === 'apm')
).to.be(true);
} else {
throw new Error('Metadata should never be empty');
}
});
});
});
});
}

0 comments on commit d679d84

Please sign in to comment.